summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-08-20 16:42:23 (EDT)
committerKaren Butzke2012-08-20 17:11:37 (EDT)
commit8386b88866c694a15ea0d0db7c61b33e36753044 (patch)
tree5a9aef15ca51d82f5e69388c7d272841f163d3f1
parent285778800a2ff1cbc0f1cf3e998a522bab622db2 (diff)
downloadwebtools.dali-8386b88866c694a15ea0d0db7c61b33e36753044.zip
webtools.dali-8386b88866c694a15ea0d0db7c61b33e36753044.tar.gz
webtools.dali-8386b88866c694a15ea0d0db7c61b33e36753044.tar.bz2
380150 - Need tolerance for EclipseLink NoSQL support - refactoring
the Generator hierarchy
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DbGenerator.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDbGenerator.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDbGenerator.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaDbGenerator.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmDbGenerator.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDbGeneratorAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDbGeneratorAnnotation.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DbGeneratorAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUuidGenerator.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java17
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java13
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java11
40 files changed, 964 insertions, 786 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DbGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DbGenerator.java
new file mode 100644
index 0000000..37c6f9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DbGenerator.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.context;
+
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Sequence and table generators.
+ * <p>
+ * Sequences can be defined on<ul>
+ * <li>Java and <code>orm.xml</code> entities
+ * <li>Java and <code>orm.xml</code> ID mappings
+ * <li><code>orm.xml</code> entity mappings elements
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.3
+ * @since 3.3
+ */
+public interface DbGenerator
+ extends Generator
+{
+
+ // ********** initial value **********
+
+ /**
+ * Return the specified initial value if present, otherwise return the
+ * default initial value.
+ */
+ int getInitialValue();
+ Integer getSpecifiedInitialValue();
+ void setSpecifiedInitialValue(Integer value);
+ String SPECIFIED_INITIAL_VALUE_PROPERTY = "specifiedInitialValue"; //$NON-NLS-1$
+ int getDefaultInitialValue();
+ String DEFAULT_INITIAL_VALUE_PROPERTY = "defaultInitialValue"; //$NON-NLS-1$
+
+
+ // ********** allocation size **********
+
+ /**
+ * Return the specified allocation size if present, otherwise return the
+ * default allocation size.
+ */
+ int getAllocationSize();
+ Integer getSpecifiedAllocationSize();
+ void setSpecifiedAllocationSize(Integer value);
+ String SPECIFIED_ALLOCATION_SIZE_PROPERTY = "specifiedAllocationSize"; //$NON-NLS-1$
+ int getDefaultAllocationSize();
+ String DEFAULT_ALLOCATION_SIZE_PROPERTY = "defaultAllocationSize"; //$NON-NLS-1$
+ int DEFAULT_ALLOCATION_SIZE = 50;
+
+
+ // ********** database stuff **********
+
+ /**
+ * Return the schema container that holds the relevant schemata.
+ */
+ SchemaContainer getDbSchemaContainer();
+
+ /**
+ * Return the generator's database catalog.
+ * Return null if the generator's catalog (name) is invalid.
+ */
+ Catalog getDbCatalog();
+
+ /**
+ * Return the generator's database schema.
+ * Return null if the generator's schema (name) is invalid.
+ */
+ Schema getDbSchema();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java
index 1b60d59..bb4bd3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.context;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
/**
- * Sequence and table generators.
+ * Named generators, typically sequence and table generators
* <p>
- * Sequences can be defined on<ul>
+ * Generators can be defined on<ul>
* <li>Java and <code>orm.xml</code> entities
* <li>Java and <code>orm.xml</code> ID mappings
* <li><code>orm.xml</code> entity mappings elements
@@ -29,7 +27,8 @@ import org.eclipse.jpt.jpa.db.SchemaContainer;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.2
+ * @see PersistenceUnit#getGenerators()
+ * @version 3.3
* @since 2.0
*/
public interface Generator
@@ -45,52 +44,4 @@ public interface Generator
SequenceGenerator.class,
TableGenerator.class
);
-
- // ********** initial value **********
-
- /**
- * Return the specified initial value if present, otherwise return the
- * default initial value.
- */
- int getInitialValue();
- Integer getSpecifiedInitialValue();
- void setSpecifiedInitialValue(Integer value);
- String SPECIFIED_INITIAL_VALUE_PROPERTY = "specifiedInitialValue"; //$NON-NLS-1$
- int getDefaultInitialValue();
- String DEFAULT_INITIAL_VALUE_PROPERTY = "defaultInitialValue"; //$NON-NLS-1$
-
-
- // ********** allocation size **********
-
- /**
- * Return the specified allocation size if present, otherwise return the
- * default allocation size.
- */
- int getAllocationSize();
- Integer getSpecifiedAllocationSize();
- void setSpecifiedAllocationSize(Integer value);
- String SPECIFIED_ALLOCATION_SIZE_PROPERTY = "specifiedAllocationSize"; //$NON-NLS-1$
- int getDefaultAllocationSize();
- String DEFAULT_ALLOCATION_SIZE_PROPERTY = "defaultAllocationSize"; //$NON-NLS-1$
- int DEFAULT_ALLOCATION_SIZE = 50;
-
-
- // ********** database stuff **********
-
- /**
- * Return the schema container that holds the relevant schemata.
- */
- SchemaContainer getDbSchemaContainer();
-
- /**
- * Return the generator's database catalog.
- * Return null if the generator's catalog (name) is invalid.
- */
- Catalog getDbCatalog();
-
- /**
- * Return the generator's database schema.
- * Return null if the generator's schema (name) is invalid.
- */
- Schema getDbSchema();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java
index fd164b1..d27b3c4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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,7 +22,7 @@ package org.eclipse.jpt.jpa.core.context;
* @since 2.0
*/
public interface SequenceGenerator
- extends Generator
+ extends DbGenerator
{
int DEFAULT_INITIAL_VALUE = 1;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java
index 7b7de4f..e0d492c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java
@@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.db.Table;
* @since 2.0
*/
public interface TableGenerator
- extends Generator
+ extends DbGenerator
{
int DEFAULT_INITIAL_VALUE = 0;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDbGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDbGenerator.java
new file mode 100644
index 0000000..feaa409
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDbGenerator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.DbGeneratorAnnotation;
+
+/**
+ * Java sequence and table generators
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.3
+ * @since 3.3
+ */
+public interface JavaDbGenerator
+ extends JavaGenerator, DbGenerator
+{
+ DbGeneratorAnnotation getGeneratorAnnotation();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java
index f00727d..526d468 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -25,7 +25,7 @@ import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
* @since 2.0
*/
public interface JavaSequenceGenerator
- extends JavaGenerator, SequenceGenerator
+ extends JavaDbGenerator, SequenceGenerator
{
SequenceGeneratorAnnotation getGeneratorAnnotation();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java
index ee8dba6..7eb5ee6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -25,7 +25,7 @@ import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
* @since 2.0
*/
public interface JavaTableGenerator
- extends JavaGenerator, TableGenerator
+ extends JavaDbGenerator, TableGenerator
{
TableGeneratorAnnotation getGeneratorAnnotation();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDbGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDbGenerator.java
new file mode 100644
index 0000000..73ca875
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDbGenerator.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
+
+/**
+ * <code>orm.xml</code> sequence and table generators
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.3
+ * @since 3.3
+ */
+public interface OrmDbGenerator
+ extends OrmGenerator, DbGenerator
+{
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java
index 5e36b01..5019455 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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,7 +26,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
* @since 2.0
*/
public interface OrmSequenceGenerator
- extends SequenceGenerator, OrmGenerator
+ extends SequenceGenerator, OrmDbGenerator
{
XmlSequenceGenerator getXmlGenerator();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java
index b38d692c..329a722 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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,7 +26,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
* @since 2.0
*/
public interface OrmTableGenerator
- extends TableGenerator, OrmGenerator
+ extends TableGenerator, OrmDbGenerator
{
XmlTableGenerator getXmlGenerator();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaDbGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaDbGenerator.java
new file mode 100644
index 0000000..711cdea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaDbGenerator.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.java.JavaDbGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.resource.java.DbGeneratorAnnotation;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Java sequence or table generator
+ */
+public abstract class AbstractJavaDbGenerator<A extends DbGeneratorAnnotation>
+ extends AbstractJavaGenerator<A>
+ implements JavaDbGenerator
+{
+
+ protected Integer specifiedInitialValue;
+ protected int defaultInitialValue;
+
+ protected Integer specifiedAllocationSize;
+ protected int defaultAllocationSize;
+
+
+ protected AbstractJavaDbGenerator(JavaGeneratorContainer parent, A generatorAnnotation) {
+ super(parent, generatorAnnotation);
+ this.specifiedInitialValue = generatorAnnotation.getInitialValue();
+ this.specifiedAllocationSize = generatorAnnotation.getAllocationSize();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedInitialValue_(this.generatorAnnotation.getInitialValue());
+ this.setSpecifiedAllocationSize_(this.generatorAnnotation.getAllocationSize());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultInitialValue(this.buildDefaultInitialValue());
+ this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
+ }
+
+
+ // ********** initial value **********
+
+ public int getInitialValue() {
+ return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer value) {
+ this.generatorAnnotation.setInitialValue(value);
+ this.setSpecifiedInitialValue_(value);
+ }
+
+ protected void setSpecifiedInitialValue_(Integer value) {
+ Integer old = this.specifiedInitialValue;
+ this.specifiedInitialValue = value;
+ this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, value);
+ }
+
+ public int getDefaultInitialValue() {
+ return this.defaultInitialValue;
+ }
+
+ protected void setDefaultInitialValue(int value) {
+ int old = this.defaultInitialValue;
+ this.defaultInitialValue = value;
+ this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, value);
+ }
+
+ protected abstract int buildDefaultInitialValue();
+
+
+ // ********** allocation size **********
+
+ public int getAllocationSize() {
+ return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer size) {
+ this.generatorAnnotation.setAllocationSize(size);
+ this.setSpecifiedAllocationSize_(size);
+ }
+
+ protected void setSpecifiedAllocationSize_(Integer size) {
+ Integer old = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = size;
+ this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, size);
+ }
+
+ public int getDefaultAllocationSize() {
+ return this.defaultAllocationSize;
+ }
+
+ protected void setDefaultAllocationSize(int size) {
+ int old = this.defaultAllocationSize;
+ this.defaultAllocationSize = size;
+ this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, size);
+ }
+
+ protected int buildDefaultAllocationSize() {
+ return DEFAULT_ALLOCATION_SIZE;
+ }
+
+ // ********** validation **********
+
+ @Override
+ public boolean isEquivalentTo(Generator generator) {
+ return super.isEquivalentTo(generator) &&
+ this.isEquivalentTo((DbGenerator) generator);
+ }
+
+ protected boolean isEquivalentTo(DbGenerator generator) {
+ return super.isEquivalentTo(generator) &&
+ Tools.valuesAreEqual(this.specifiedAllocationSize, generator.getSpecifiedAllocationSize()) &&
+ Tools.valuesAreEqual(this.specifiedInitialValue, generator.getSpecifiedInitialValue());
+ }
+
+ // ********** database stuff **********
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ protected abstract String getSchema();
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected abstract String getCatalog();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
index 591de58..ce719f8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
@@ -21,9 +21,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -38,19 +35,11 @@ public abstract class AbstractJavaGenerator<A extends GeneratorAnnotation>
protected String name;
- protected Integer specifiedInitialValue;
- protected int defaultInitialValue;
-
- protected Integer specifiedAllocationSize;
- protected int defaultAllocationSize;
-
protected AbstractJavaGenerator(JavaGeneratorContainer parent, A generatorAnnotation) {
super(parent);
this.generatorAnnotation = generatorAnnotation;
this.name = generatorAnnotation.getName();
- this.specifiedInitialValue = generatorAnnotation.getInitialValue();
- this.specifiedAllocationSize = generatorAnnotation.getAllocationSize();
}
@@ -60,15 +49,6 @@ public abstract class AbstractJavaGenerator<A extends GeneratorAnnotation>
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
this.setName_(this.generatorAnnotation.getName());
- this.setSpecifiedInitialValue_(this.generatorAnnotation.getInitialValue());
- this.setSpecifiedAllocationSize_(this.generatorAnnotation.getAllocationSize());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultInitialValue(this.buildDefaultInitialValue());
- this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
}
@@ -89,75 +69,6 @@ public abstract class AbstractJavaGenerator<A extends GeneratorAnnotation>
this.firePropertyChanged(NAME_PROPERTY, old, name);
}
-
- // ********** initial value **********
-
- public int getInitialValue() {
- return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
- }
-
- public Integer getSpecifiedInitialValue() {
- return this.specifiedInitialValue;
- }
-
- public void setSpecifiedInitialValue(Integer value) {
- this.generatorAnnotation.setInitialValue(value);
- this.setSpecifiedInitialValue_(value);
- }
-
- protected void setSpecifiedInitialValue_(Integer value) {
- Integer old = this.specifiedInitialValue;
- this.specifiedInitialValue = value;
- this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, value);
- }
-
- public int getDefaultInitialValue() {
- return this.defaultInitialValue;
- }
-
- protected void setDefaultInitialValue(int value) {
- int old = this.defaultInitialValue;
- this.defaultInitialValue = value;
- this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, value);
- }
-
- protected abstract int buildDefaultInitialValue();
-
-
- // ********** allocation size **********
-
- public int getAllocationSize() {
- return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
- }
-
- public Integer getSpecifiedAllocationSize() {
- return this.specifiedAllocationSize;
- }
-
- public void setSpecifiedAllocationSize(Integer size) {
- this.generatorAnnotation.setAllocationSize(size);
- this.setSpecifiedAllocationSize_(size);
- }
-
- protected void setSpecifiedAllocationSize_(Integer size) {
- Integer old = this.specifiedAllocationSize;
- this.specifiedAllocationSize = size;
- this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, size);
- }
-
- public int getDefaultAllocationSize() {
- return this.defaultAllocationSize;
- }
-
- protected void setDefaultAllocationSize(int size) {
- int old = this.defaultAllocationSize;
- this.defaultAllocationSize = size;
- this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, size);
- }
-
- protected int buildDefaultAllocationSize() {
- return DEFAULT_ALLOCATION_SIZE;
- }
// ********** validation **********
@@ -195,41 +106,9 @@ public abstract class AbstractJavaGenerator<A extends GeneratorAnnotation>
}
protected boolean isEquivalentTo(Generator generator) {
- return Tools.valuesAreEqual(this.name, generator.getName()) &&
- Tools.valuesAreEqual(this.specifiedAllocationSize, generator.getSpecifiedAllocationSize()) &&
- Tools.valuesAreEqual(this.specifiedInitialValue, generator.getSpecifiedInitialValue());
- }
-
- // ********** database stuff **********
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ return Tools.valuesAreEqual(this.name, generator.getName());
}
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- protected abstract String getSchema();
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDbCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- protected abstract String getCatalog();
-
// ********** misc **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
index f2f0a7f..1307e36 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
@@ -27,7 +27,7 @@ import org.eclipse.jpt.jpa.db.Schema;
* Java sequence generator
*/
public abstract class AbstractJavaSequenceGenerator<A extends SequenceGeneratorAnnotation>
- extends AbstractJavaGenerator<A>
+ extends AbstractJavaDbGenerator<A>
implements JavaSequenceGenerator
{
protected String specifiedSequenceName;
@@ -139,11 +139,11 @@ public abstract class AbstractJavaSequenceGenerator<A extends SequenceGeneratorA
public Class<SequenceGenerator> getType() {
return SequenceGenerator.class;
}
-
+
// ********** validation **********
@Override
- protected boolean isEquivalentTo(Generator generator) {
+ protected boolean isEquivalentTo(DbGenerator generator) {
return super.isEquivalentTo(generator)
&& this.isEquivalentTo((SequenceGenerator) generator);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmDbGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmDbGenerator.java
new file mode 100644
index 0000000..a7e2398
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmDbGenerator.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.internal.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaDbGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmDbGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * <code>orm.xml</code> sequence or table generator
+ */
+public abstract class AbstractOrmDbGenerator<X extends XmlGenerator>
+ extends AbstractOrmGenerator<X>
+ implements OrmDbGenerator
+{
+
+ protected Integer specifiedInitialValue;
+ protected int defaultInitialValue;
+
+ protected Integer specifiedAllocationSize;
+ protected int defaultAllocationSize;
+
+
+ protected AbstractOrmDbGenerator(XmlContextNode parent, X xmlGenerator) {
+ super(parent, xmlGenerator);
+ this.specifiedInitialValue = xmlGenerator.getInitialValue();
+ this.specifiedAllocationSize = xmlGenerator.getAllocationSize();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedInitialValue_(this.xmlGenerator.getInitialValue());
+ this.setSpecifiedAllocationSize_(this.xmlGenerator.getAllocationSize());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultInitialValue(this.buildDefaultInitialValue());
+ this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
+ }
+
+
+ // ********** initial value **********
+
+ public int getInitialValue() {
+ return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer specifiedInitialValue) {
+ this.setSpecifiedInitialValue_(specifiedInitialValue);
+ this.xmlGenerator.setInitialValue(specifiedInitialValue);
+ }
+
+ protected void setSpecifiedInitialValue_(Integer specifiedInitialValue) {
+ Integer old = this.specifiedInitialValue;
+ this.specifiedInitialValue = specifiedInitialValue;
+ this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue);
+ }
+
+ public int getDefaultInitialValue() {
+ return this.defaultInitialValue;
+ }
+
+ protected void setDefaultInitialValue(int defaultInitialValue) {
+ int old = this.defaultInitialValue;
+ this.defaultInitialValue = defaultInitialValue;
+ this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, defaultInitialValue);
+ }
+
+ protected abstract int buildDefaultInitialValue();
+
+
+ // ********** allocation size **********
+
+ public int getAllocationSize() {
+ return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer specifiedAllocationSize) {
+ this.setSpecifiedAllocationSize_(specifiedAllocationSize);
+ this.xmlGenerator.setAllocationSize(specifiedAllocationSize);
+ }
+
+ protected void setSpecifiedAllocationSize_(Integer specifiedAllocationSize) {
+ Integer old = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = specifiedAllocationSize;
+ this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize);
+ }
+
+ public int getDefaultAllocationSize() {
+ return this.defaultAllocationSize;
+ }
+
+ protected void setDefaultAllocationSize(int defaultAllocationSize) {
+ int old = this.defaultAllocationSize;
+ this.defaultAllocationSize = defaultAllocationSize;
+ this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, defaultAllocationSize);
+ }
+
+ protected int buildDefaultAllocationSize() {
+ return DEFAULT_ALLOCATION_SIZE;
+ }
+
+
+ @Override
+ protected boolean isEquivalentTo(Generator generator) {
+ return super.isEquivalentTo(generator) &&
+ this.isEquivalentTo((DbGenerator) generator);
+ }
+
+ protected boolean isEquivalentTo(DbGenerator generator) {
+ return Tools.valuesAreEqual(this.specifiedAllocationSize, generator.getSpecifiedAllocationSize()) &&
+ Tools.valuesAreEqual(this.specifiedInitialValue, generator.getSpecifiedInitialValue());
+ }
+
+ // ************* completion proposals *************
+ /**
+ * called if the database is connected:
+ * table, schema, catalog, pkColumnName, valueColumnName
+ */
+ @Override
+ protected Iterable<String> getConnectedXmlCompletionProposals(int pos) {
+ Iterable<String> result = super.getConnectedXmlCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.schemaTouches(pos)) {
+ return this.getCandidateSchemata();
+ }
+ if (this.catalogTouches(pos)) {
+ return this.getCandidateCatalogs();
+ }
+ return null;
+ }
+
+ // ********** content assist: schema
+
+ protected boolean schemaTouches(int pos) {
+ return this.xmlGenerator.schemaTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateSchemata() {
+ SchemaContainer schemaContainer = this.getDbSchemaContainer();
+ return (schemaContainer != null) ? schemaContainer.getSortedSchemaIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** content assist: catalog
+
+ protected boolean catalogTouches(int pos) {
+ return this.xmlGenerator.catalogTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateCatalogs() {
+ Database db = this.getDatabase();
+ return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** database stuff **********
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ protected abstract String getSchema();
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected abstract String getCatalog();
+
+
+ // ********** metadata conversion **********
+
+ public void convertFrom(JavaDbGenerator javaGenerator) {
+ super.convertFrom(javaGenerator);
+ this.setSpecifiedInitialValue(javaGenerator.getSpecifiedInitialValue());
+ this.setSpecifiedAllocationSize(javaGenerator.getSpecifiedAllocationSize());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
index 6ff23b0..581fc80 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
@@ -13,7 +13,6 @@ import java.util.List;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.context.Generator;
import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
@@ -22,10 +21,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -40,19 +35,11 @@ public abstract class AbstractOrmGenerator<X extends XmlGenerator>
protected String name;
- protected Integer specifiedInitialValue;
- protected int defaultInitialValue;
-
- protected Integer specifiedAllocationSize;
- protected int defaultAllocationSize;
-
protected AbstractOrmGenerator(XmlContextNode parent, X xmlGenerator) {
super(parent);
this.xmlGenerator = xmlGenerator;
this.name = xmlGenerator.getName();
- this.specifiedInitialValue = xmlGenerator.getInitialValue();
- this.specifiedAllocationSize = xmlGenerator.getAllocationSize();
}
@@ -62,15 +49,6 @@ public abstract class AbstractOrmGenerator<X extends XmlGenerator>
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
this.setName_(this.xmlGenerator.getName());
- this.setSpecifiedInitialValue_(this.xmlGenerator.getInitialValue());
- this.setSpecifiedAllocationSize_(this.xmlGenerator.getAllocationSize());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultInitialValue(this.buildDefaultInitialValue());
- this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
}
@@ -92,75 +70,6 @@ public abstract class AbstractOrmGenerator<X extends XmlGenerator>
}
- // ********** initial value **********
-
- public int getInitialValue() {
- return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
- }
-
- public Integer getSpecifiedInitialValue() {
- return this.specifiedInitialValue;
- }
-
- public void setSpecifiedInitialValue(Integer specifiedInitialValue) {
- this.setSpecifiedInitialValue_(specifiedInitialValue);
- this.xmlGenerator.setInitialValue(specifiedInitialValue);
- }
-
- protected void setSpecifiedInitialValue_(Integer specifiedInitialValue) {
- Integer old = this.specifiedInitialValue;
- this.specifiedInitialValue = specifiedInitialValue;
- this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue);
- }
-
- public int getDefaultInitialValue() {
- return this.defaultInitialValue;
- }
-
- protected void setDefaultInitialValue(int defaultInitialValue) {
- int old = this.defaultInitialValue;
- this.defaultInitialValue = defaultInitialValue;
- this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, defaultInitialValue);
- }
-
- protected abstract int buildDefaultInitialValue();
-
-
- // ********** allocation size **********
-
- public int getAllocationSize() {
- return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
- }
-
- public Integer getSpecifiedAllocationSize() {
- return this.specifiedAllocationSize;
- }
-
- public void setSpecifiedAllocationSize(Integer specifiedAllocationSize) {
- this.setSpecifiedAllocationSize_(specifiedAllocationSize);
- this.xmlGenerator.setAllocationSize(specifiedAllocationSize);
- }
-
- protected void setSpecifiedAllocationSize_(Integer specifiedAllocationSize) {
- Integer old = this.specifiedAllocationSize;
- this.specifiedAllocationSize = specifiedAllocationSize;
- this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize);
- }
-
- public int getDefaultAllocationSize() {
- return this.defaultAllocationSize;
- }
-
- protected void setDefaultAllocationSize(int defaultAllocationSize) {
- int old = this.defaultAllocationSize;
- this.defaultAllocationSize = defaultAllocationSize;
- this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, defaultAllocationSize);
- }
-
- protected int buildDefaultAllocationSize() {
- return DEFAULT_ALLOCATION_SIZE;
- }
-
// ********** validation **********
@@ -197,90 +106,14 @@ public abstract class AbstractOrmGenerator<X extends XmlGenerator>
}
protected boolean isEquivalentTo(Generator generator) {
- return Tools.valuesAreEqual(this.name, generator.getName()) &&
- Tools.valuesAreEqual(this.specifiedAllocationSize, generator.getSpecifiedAllocationSize()) &&
- Tools.valuesAreEqual(this.specifiedInitialValue, generator.getSpecifiedInitialValue());
- }
-
- // ************* completion proposals *************
- /**
- * called if the database is connected:
- * table, schema, catalog, pkColumnName, valueColumnName
- */
- @Override
- protected Iterable<String> getConnectedXmlCompletionProposals(int pos) {
- Iterable<String> result = super.getConnectedXmlCompletionProposals(pos);
- if (result != null) {
- return result;
- }
- if (this.schemaTouches(pos)) {
- return this.getCandidateSchemata();
- }
- if (this.catalogTouches(pos)) {
- return this.getCandidateCatalogs();
- }
- return null;
- }
-
- // ********** content assist: schema
-
- protected boolean schemaTouches(int pos) {
- return this.xmlGenerator.schemaTouches(pos);
- }
-
- protected Iterable<String> getCandidateSchemata() {
- SchemaContainer schemaContainer = this.getDbSchemaContainer();
- return (schemaContainer != null) ? schemaContainer.getSortedSchemaIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** content assist: catalog
-
- protected boolean catalogTouches(int pos) {
- return this.xmlGenerator.catalogTouches(pos);
+ return Tools.valuesAreEqual(this.name, generator.getName());
}
- protected Iterable<String> getCandidateCatalogs() {
- Database db = this.getDatabase();
- return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** database stuff **********
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- protected abstract String getSchema();
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDbCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- protected abstract String getCatalog();
-
// ********** metadata conversion **********
public void convertFrom(JavaGenerator javaGenerator) {
this.setName(javaGenerator.getName());
- this.setSpecifiedInitialValue(javaGenerator.getSpecifiedInitialValue());
- this.setSpecifiedAllocationSize(javaGenerator.getSpecifiedAllocationSize());
}
// ********** misc **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
index f8cf7cf..1e173be 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
@@ -23,7 +23,7 @@ import org.eclipse.jpt.jpa.db.Schema;
* <code>orm.xml</code> sequence generator
*/
public abstract class AbstractOrmSequenceGenerator
- extends AbstractOrmGenerator<XmlSequenceGenerator>
+ extends AbstractOrmDbGenerator<XmlSequenceGenerator>
implements OrmSequenceGenerator
{
protected String specifiedSequenceName;
@@ -103,7 +103,7 @@ public abstract class AbstractOrmSequenceGenerator
// ********** validation **********
@Override
- protected boolean isEquivalentTo(Generator generator) {
+ protected boolean isEquivalentTo(DbGenerator generator) {
return super.isEquivalentTo(generator)
&& this.isEquivalentTo((SequenceGenerator) generator);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
index f00d645..a2060da 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.ArrayList;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -18,14 +19,14 @@ import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.TableGenerator;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaDbGenerator;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
import org.eclipse.jpt.jpa.db.Database;
@@ -37,7 +38,7 @@ import org.eclipse.jpt.jpa.db.Table;
* Java table generator
*/
public class GenericJavaTableGenerator
- extends AbstractJavaGenerator<TableGeneratorAnnotation>
+ extends AbstractJavaDbGenerator<TableGeneratorAnnotation>
implements JavaTableGenerator, UniqueConstraint.Owner
{
protected String specifiedTable;
@@ -567,7 +568,7 @@ public class GenericJavaTableGenerator
// ********** validation **********
@Override
- protected boolean isEquivalentTo(Generator generator) {
+ protected boolean isEquivalentTo(DbGenerator generator) {
return super.isEquivalentTo(generator)
&& this.isEquivalentTo((TableGenerator) generator);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
index ed9eed7..b06b66c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.TableGenerator;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
@@ -23,7 +23,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmDbGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
@@ -34,7 +34,7 @@ import org.eclipse.jpt.jpa.db.Table;
* <code>orm.xml</code> table generator
*/
public class GenericOrmTableGenerator
- extends AbstractOrmGenerator<XmlTableGenerator>
+ extends AbstractOrmDbGenerator<XmlTableGenerator>
implements OrmTableGenerator, UniqueConstraint.Owner
{
protected String specifiedTable;
@@ -433,7 +433,7 @@ public class GenericOrmTableGenerator
// ********** validation **********
@Override
- protected boolean isEquivalentTo(Generator generator) {
+ protected boolean isEquivalentTo(DbGenerator generator) {
return super.isEquivalentTo(generator)
&& this.isEquivalentTo((TableGenerator) generator);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDbGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDbGeneratorAnnotation.java
new file mode 100644
index 0000000..c77e3c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDbGeneratorAnnotation.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.DbGeneratorAnnotation;
+
+/**
+ * <ul>
+ * <li>javax.persistence.SequenceGenerator
+ * <li>javax.persistence.TableGenerator
+ * </ul>
+ */
+abstract class BinaryDbGeneratorAnnotation
+ extends BinaryGeneratorAnnotation
+ implements DbGeneratorAnnotation
+{
+ Integer initialValue;
+ Integer allocationSize;
+
+
+ BinaryDbGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.initialValue = this.buildInitialValue();
+ this.allocationSize = this.buildAllocationSize();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setInitialValue_(this.buildInitialValue());
+ this.setAllocationSize_(this.buildAllocationSize());
+ }
+
+ // ********** DbGeneratorAnnotation implementation **********
+
+ // ***** initial value
+ public Integer getInitialValue() {
+ return this.initialValue;
+ }
+
+ public void setInitialValue(Integer initialValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setInitialValue_(Integer initialValue) {
+ Integer old = this.initialValue;
+ this.initialValue = initialValue;
+ this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
+ }
+
+ private Integer buildInitialValue() {
+ return (Integer) this.getJdtMemberValue(this.getInitialValueElementName());
+ }
+
+ abstract String getInitialValueElementName();
+
+ public TextRange getInitialValueTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** allocation size
+ public Integer getAllocationSize() {
+ return this.allocationSize;
+ }
+
+ public void setAllocationSize(Integer allocationSize) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setAllocationSize_(Integer allocationSize) {
+ Integer old = this.allocationSize;
+ this.allocationSize = allocationSize;
+ this.firePropertyChanged(NAME_PROPERTY, old, allocationSize);
+ }
+
+ private Integer buildAllocationSize() {
+ return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName());
+ }
+
+ abstract String getAllocationSizeElementName();
+
+ public TextRange getAllocationSizeTextRange() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
index e12c635..515cf92 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
@@ -21,28 +21,22 @@ import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
* <li>javax.persistence.TableGenerator
* </ul>
*/
-abstract class BinaryGeneratorAnnotation
+public abstract class BinaryGeneratorAnnotation
extends BinaryAnnotation
implements GeneratorAnnotation
{
String name;
- Integer initialValue;
- Integer allocationSize;
- BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ protected BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.name = this.buildName();
- this.initialValue = this.buildInitialValue();
- this.allocationSize = this.buildAllocationSize();
}
@Override
public void update() {
super.update();
this.setName_(this.buildName());
- this.setInitialValue_(this.buildInitialValue());
- this.setAllocationSize_(this.buildAllocationSize());
}
@Override
@@ -72,59 +66,10 @@ abstract class BinaryGeneratorAnnotation
return (String) this.getJdtMemberValue(this.getNameElementName());
}
- abstract String getNameElementName();
+ protected abstract String getNameElementName();
public TextRange getNameTextRange() {
throw new UnsupportedOperationException();
}
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setInitialValue_(Integer initialValue) {
- Integer old = this.initialValue;
- this.initialValue = initialValue;
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
- }
-
- private Integer buildInitialValue() {
- return (Integer) this.getJdtMemberValue(this.getInitialValueElementName());
- }
-
- abstract String getInitialValueElementName();
-
- public TextRange getInitialValueTextRange() {
- throw new UnsupportedOperationException();
- }
-
- // ***** name
- public Integer getAllocationSize() {
- return this.allocationSize;
- }
-
- public void setAllocationSize(Integer allocationSize) {
- throw new UnsupportedOperationException();
- }
-
- private void setAllocationSize_(Integer allocationSize) {
- Integer old = this.allocationSize;
- this.allocationSize = allocationSize;
- this.firePropertyChanged(NAME_PROPERTY, old, allocationSize);
- }
-
- private Integer buildAllocationSize() {
- return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName());
- }
-
- abstract String getAllocationSizeElementName();
-
- public TextRange getAllocationSizeTextRange() {
- throw new UnsupportedOperationException();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
index a40eb80..0e47cbb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
@@ -19,7 +19,7 @@ import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
* <code>javax.persistence.SequenceGenerator</code>
*/
public abstract class BinarySequenceGeneratorAnnotation
- extends BinaryGeneratorAnnotation
+ extends BinaryDbGeneratorAnnotation
implements SequenceGeneratorAnnotation
{
private String sequenceName;
@@ -44,7 +44,7 @@ public abstract class BinarySequenceGeneratorAnnotation
// ********** BinaryGeneratorAnnotation implementation **********
@Override
- String getNameElementName() {
+ protected String getNameElementName() {
return JPA.SEQUENCE_GENERATOR__NAME;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
index 600a7e5..6298c9b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
@@ -23,7 +23,7 @@ import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
* <code>javax.persistence.TableGenerator</code>
*/
public final class BinaryTableGeneratorAnnotation
- extends BinaryGeneratorAnnotation
+ extends BinaryDbGeneratorAnnotation
implements TableGeneratorAnnotation
{
private String table;
@@ -66,7 +66,7 @@ public final class BinaryTableGeneratorAnnotation
// ********** AbstractGeneratorAnnotation implementation **********
@Override
- String getNameElementName() {
+ protected String getNameElementName() {
return JPA.TABLE_GENERATOR__NAME;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDbGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDbGeneratorAnnotation.java
new file mode 100644
index 0000000..8e6c3db
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDbGeneratorAnnotation.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.DbGeneratorAnnotation;
+
+/**
+ * <ul>
+ * <li>javax.persistence.SequenceGenerator
+ * <li>javax.persistence.TableGenerator
+ * </ul>
+ */
+abstract class SourceDbGeneratorAnnotation
+ extends SourceGeneratorAnnotation
+ implements DbGeneratorAnnotation
+{
+
+ final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
+ final AnnotationElementAdapter<Integer> initialValueAdapter;
+ Integer initialValue;
+ TextRange initialValueTextRange;
+
+ final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
+ final AnnotationElementAdapter<Integer> allocationSizeAdapter;
+ Integer allocationSize;
+ TextRange allocationSizeTextRange;
+
+
+ SourceDbGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
+ this.initialValueDeclarationAdapter = this.getInitialValueAdapter();
+ this.initialValueAdapter = this.buildIntegerAdapter(this.initialValueDeclarationAdapter);
+ this.allocationSizeDeclarationAdapter = this.getAllocationSizeAdapter();
+ this.allocationSizeAdapter = this.buildIntegerAdapter(this.allocationSizeDeclarationAdapter);
+ }
+
+ protected AnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea);
+ }
+
+ @Override
+ public void initialize(Annotation astAnnotation) {
+ super.initialize(astAnnotation);
+
+ this.initialValue = this.buildInitialValue(astAnnotation);
+ this.initialValueTextRange = this.buildInitialValueTextRange(astAnnotation);
+
+ this.allocationSize = this.buildAllocationSize(astAnnotation);
+ this.allocationSizeTextRange = this.buildAllocationSizeTextRange(astAnnotation);
+ }
+
+ @Override
+ public void synchronizeWith(Annotation astAnnotation) {
+ super.synchronizeWith(astAnnotation);
+
+ this.syncInitialValue(this.buildInitialValue(astAnnotation));
+ this.initialValueTextRange = this.buildInitialValueTextRange(astAnnotation);
+
+ this.syncAllocationSize(this.buildAllocationSize(astAnnotation));
+ this.allocationSizeTextRange = this.buildAllocationSizeTextRange(astAnnotation);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.initialValue == null) &&
+ (this.allocationSize == null);
+ }
+
+
+ // ********** DbGeneratorAnnotation implementation **********
+
+ // ***** initial value
+ public Integer getInitialValue() {
+ return this.initialValue;
+ }
+
+ public void setInitialValue(Integer initialValue) {
+ if (this.attributeValueHasChanged(this.initialValue, initialValue)) {
+ this.initialValue = initialValue;
+ this.initialValueAdapter.setValue(initialValue);
+ }
+ }
+
+ private void syncInitialValue(Integer astIinitialValue) {
+ Integer old = this.initialValue;
+ this.initialValue = astIinitialValue;
+ this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, astIinitialValue);
+ }
+
+ private Integer buildInitialValue(Annotation astAnnotation) {
+ return this.initialValueAdapter.getValue(astAnnotation);
+ }
+
+ public TextRange getInitialValueTextRange() {
+ return this.initialValueTextRange;
+ }
+
+ private TextRange buildInitialValueTextRange(Annotation astAnnotation) {
+ return this.getElementTextRange(this.initialValueDeclarationAdapter, astAnnotation);
+ }
+
+ abstract DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter();
+
+ // ***** allocation size
+ public Integer getAllocationSize() {
+ return this.allocationSize;
+ }
+
+ public void setAllocationSize(Integer allocationSize) {
+ if (this.attributeValueHasChanged(this.allocationSize, allocationSize)) {
+ this.allocationSize = allocationSize;
+ this.allocationSizeAdapter.setValue(allocationSize);
+ }
+ }
+
+ private void syncAllocationSize(Integer astAllocationSize) {
+ Integer old = this.allocationSize;
+ this.allocationSize = astAllocationSize;
+ this.firePropertyChanged(ALLOCATION_SIZE_PROPERTY, old, astAllocationSize);
+ }
+
+ private Integer buildAllocationSize(Annotation astAnnotation) {
+ return this.allocationSizeAdapter.getValue(astAnnotation);
+ }
+
+ public TextRange getAllocationSizeTextRange() {
+ return this.allocationSizeTextRange;
+ }
+
+ private TextRange buildAllocationSizeTextRange(Annotation astAnnotation) {
+ return this.getElementTextRange(this.allocationSizeDeclarationAdapter, astAnnotation);
+ }
+
+ abstract DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter();
+
+
+ // ********** static methods **********
+
+ static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
index fe38d8d..2bdd853 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
@@ -13,7 +13,6 @@ import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
@@ -28,7 +27,7 @@ import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
* <li>javax.persistence.TableGenerator
* </ul>
*/
-abstract class SourceGeneratorAnnotation
+public abstract class SourceGeneratorAnnotation
extends SourceAnnotation
implements GeneratorAnnotation
{
@@ -37,46 +36,23 @@ abstract class SourceGeneratorAnnotation
String name;
TextRange nameTextRange;
- final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
- final AnnotationElementAdapter<Integer> initialValueAdapter;
- Integer initialValue;
- TextRange initialValueTextRange;
- final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
- final AnnotationElementAdapter<Integer> allocationSizeAdapter;
- Integer allocationSize;
- TextRange allocationSizeTextRange;
-
-
- SourceGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ protected SourceGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
super(parent, element, daa);
this.nameDeclarationAdapter = this.getNameAdapter();
this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
- this.initialValueDeclarationAdapter = this.getInitialValueAdapter();
- this.initialValueAdapter = this.buildIntegerAdapter(this.initialValueDeclarationAdapter);
- this.allocationSizeDeclarationAdapter = this.getAllocationSizeAdapter();
- this.allocationSizeAdapter = this.buildIntegerAdapter(this.allocationSizeDeclarationAdapter);
}
protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
}
- protected AnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
- return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea);
- }
@Override
public void initialize(Annotation astAnnotation) {
super.initialize(astAnnotation);
this.name = this.buildName(astAnnotation);
this.nameTextRange = this.buildNameTextRange(astAnnotation);
-
- this.initialValue = this.buildInitialValue(astAnnotation);
- this.initialValueTextRange = this.buildInitialValueTextRange(astAnnotation);
-
- this.allocationSize = this.buildAllocationSize(astAnnotation);
- this.allocationSizeTextRange = this.buildAllocationSizeTextRange(astAnnotation);
}
@Override
@@ -84,20 +60,12 @@ abstract class SourceGeneratorAnnotation
super.synchronizeWith(astAnnotation);
this.syncName(this.buildName(astAnnotation));
this.nameTextRange = this.buildNameTextRange(astAnnotation);
-
- this.syncInitialValue(this.buildInitialValue(astAnnotation));
- this.initialValueTextRange = this.buildInitialValueTextRange(astAnnotation);
-
- this.syncAllocationSize(this.buildAllocationSize(astAnnotation));
- this.allocationSizeTextRange = this.buildAllocationSizeTextRange(astAnnotation);
}
@Override
public boolean isUnset() {
return super.isUnset() &&
- (this.name == null) &&
- (this.initialValue == null) &&
- (this.allocationSize == null);
+ (this.name == null);
}
@Override
@@ -138,80 +106,12 @@ abstract class SourceGeneratorAnnotation
return this.getElementTextRange(this.nameDeclarationAdapter, astAnnotation);
}
- abstract DeclarationAnnotationElementAdapter<String> getNameAdapter();
-
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- if (this.attributeValueHasChanged(this.initialValue, initialValue)) {
- this.initialValue = initialValue;
- this.initialValueAdapter.setValue(initialValue);
- }
- }
-
- private void syncInitialValue(Integer astIinitialValue) {
- Integer old = this.initialValue;
- this.initialValue = astIinitialValue;
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, astIinitialValue);
- }
-
- private Integer buildInitialValue(Annotation astAnnotation) {
- return this.initialValueAdapter.getValue(astAnnotation);
- }
-
- public TextRange getInitialValueTextRange() {
- return this.initialValueTextRange;
- }
-
- private TextRange buildInitialValueTextRange(Annotation astAnnotation) {
- return this.getElementTextRange(this.initialValueDeclarationAdapter, astAnnotation);
- }
-
- abstract DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter();
-
- // ***** allocation size
- public Integer getAllocationSize() {
- return this.allocationSize;
- }
-
- public void setAllocationSize(Integer allocationSize) {
- if (this.attributeValueHasChanged(this.allocationSize, allocationSize)) {
- this.allocationSize = allocationSize;
- this.allocationSizeAdapter.setValue(allocationSize);
- }
- }
-
- private void syncAllocationSize(Integer astAllocationSize) {
- Integer old = this.allocationSize;
- this.allocationSize = astAllocationSize;
- this.firePropertyChanged(ALLOCATION_SIZE_PROPERTY, old, astAllocationSize);
- }
-
- private Integer buildAllocationSize(Annotation astAnnotation) {
- return this.allocationSizeAdapter.getValue(astAnnotation);
- }
-
- public TextRange getAllocationSizeTextRange() {
- return this.allocationSizeTextRange;
- }
-
- private TextRange buildAllocationSizeTextRange(Annotation astAnnotation) {
- return this.getElementTextRange(this.allocationSizeDeclarationAdapter, astAnnotation);
- }
-
- abstract DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter();
+ protected abstract DeclarationAnnotationElementAdapter<String> getNameAdapter();
// ********** static methods **********
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
}
-
- static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
index 8d713e6..9f6f0d3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
@@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
* <code>javax.persistence.SequenceGenerator</code>
*/
public abstract class SourceSequenceGeneratorAnnotation
- extends SourceGeneratorAnnotation
+ extends SourceDbGeneratorAnnotation
implements SequenceGeneratorAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -74,7 +74,7 @@ public abstract class SourceSequenceGeneratorAnnotation
// ********** AbstractGeneratorAnnotation implementation **********
@Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter() {
+ protected DeclarationAnnotationElementAdapter<String> getNameAdapter() {
return NAME_ADAPTER;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
index 8edf061..cf236b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
@@ -28,7 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
* <code>javax.persistence.TableGenerator</code>
*/
public final class SourceTableGeneratorAnnotation
- extends SourceGeneratorAnnotation
+ extends SourceDbGeneratorAnnotation
implements TableGeneratorAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -151,7 +151,7 @@ public final class SourceTableGeneratorAnnotation
// ********** AbstractGeneratorAnnotation implementation **********
@Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter() {
+ protected DeclarationAnnotationElementAdapter<String> getNameAdapter() {
return NAME_ADAPTER;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DbGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DbGeneratorAnnotation.java
new file mode 100644
index 0000000..d3b3c58
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DbGeneratorAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.resource.java;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol among:<code><ul>
+ * <li>javax.persistence.SequenceGenerator
+ * <li>javax.persistence.TableGenerator
+ * </ul></code>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.3
+ * @since 3.3
+ */
+public interface DbGeneratorAnnotation
+ extends GeneratorAnnotation
+{
+
+ /**
+ * Corresponds to the 'initialValue' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getInitialValue();
+ String INITIAL_VALUE_PROPERTY = "initialValue"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'initialValue' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setInitialValue(Integer initialValue);
+
+ /**
+ * Return the {@link TextRange} for the 'initialValue' element. If the element
+ * does not exist return the {@link TextRange} for the *Generator annotation.
+ */
+ TextRange getInitialValueTextRange();
+
+
+ /**
+ * Corresponds to the 'allocationSize' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getAllocationSize();
+ String ALLOCATION_SIZE_PROPERTY = "allocationSize"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'allocationSize' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setAllocationSize(Integer allocationSize);
+
+ /**
+ * Return the {@link TextRange} for the 'allocationSize' element. If the element
+ * does not exist return the {@link TextRange} for the *Generator annotation.
+ */
+ TextRange getAllocationSizeTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
index 5819c5f..7ea7c4d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
@@ -23,7 +23,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.2
+ * @version 3.3
* @since 2.0
*/
public interface GeneratorAnnotation
@@ -48,43 +48,4 @@ public interface GeneratorAnnotation
*/
TextRange getNameTextRange();
-
- /**
- * Corresponds to the 'initialValue' element of the *Generator annotation.
- * Return null if the element does not exist in Java.
- */
- Integer getInitialValue();
- String INITIAL_VALUE_PROPERTY = "initialValue"; //$NON-NLS-1$
-
- /**
- * Corresponds to the 'initialValue' element of the *Generator annotation.
- * Set to null to remove the element.
- */
- void setInitialValue(Integer initialValue);
-
- /**
- * Return the {@link TextRange} for the 'initialValue' element. If the element
- * does not exist return the {@link TextRange} for the *Generator annotation.
- */
- TextRange getInitialValueTextRange();
-
-
- /**
- * Corresponds to the 'allocationSize' element of the *Generator annotation.
- * Return null if the element does not exist in Java.
- */
- Integer getAllocationSize();
- String ALLOCATION_SIZE_PROPERTY = "allocationSize"; //$NON-NLS-1$
-
- /**
- * Corresponds to the 'allocationSize' element of the *Generator annotation.
- * Set to null to remove the element.
- */
- void setAllocationSize(Integer allocationSize);
-
- /**
- * Return the {@link TextRange} for the 'allocationSize' element. If the element
- * does not exist return the {@link TextRange} for the *Generator annotation.
- */
- TextRange getAllocationSizeTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java
index ab9a2cc..fa09885 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java
@@ -25,7 +25,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.0
*/
public interface SequenceGeneratorAnnotation
- extends GeneratorAnnotation
+ extends DbGeneratorAnnotation
{
String ANNOTATION_NAME = JPA.SEQUENCE_GENERATOR;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
index 00603a5..1668c3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
@@ -26,7 +26,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
* @since 2.0
*/
public interface TableGeneratorAnnotation
- extends GeneratorAnnotation
+ extends DbGeneratorAnnotation
{
String ANNOTATION_NAME = JPA.TABLE_GENERATOR;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java
index f40cfea..660d495 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.context.java;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4;
@@ -23,7 +23,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGenerat
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface JavaUuidGenerator
- extends UuidGenerator, JavaJpaContextNode
+ extends UuidGenerator, JavaGenerator
{
EclipseLinkUuidGeneratorAnnotation2_4 getGeneratorAnnotation();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java
index 55a2e43..15a60b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.context.orm;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaUuidGenerator;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2_4;
@@ -24,7 +24,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface OrmUuidGenerator
- extends UuidGenerator, XmlContextNode
+ extends UuidGenerator, OrmGenerator
{
XmlUuidGenerator_2_4 getXmlGenerator();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java
index ec37c7f..0094b9e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java
@@ -31,14 +31,6 @@ public class JavaEclipseLinkUuidGenerator
}
- // ********** initial value **********
-
- @Override
- protected int buildDefaultInitialValue() {
- return 0;
- }
-
-
// ********** misc **********
public Class<UuidGenerator> getType() {
@@ -59,14 +51,4 @@ public class JavaEclipseLinkUuidGenerator
public void delete() {
this.getParent().removeUuidGenerator();
}
-
- @Override
- protected String getSchema() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected String getCatalog() {
- throw new UnsupportedOperationException();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java
index ec8ba1d..eb297a0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java
@@ -32,7 +32,7 @@ public class OrmEclipseLinkUuidGenerator
// ********** metadata conversion **********
public void convertFrom(JavaUuidGenerator javaGenerator) {
- this.setName(javaGenerator.getName());
+ super.convertFrom(javaGenerator);
}
// ********** misc **********
@@ -40,18 +40,4 @@ public class OrmEclipseLinkUuidGenerator
public Class<UuidGenerator> getType() {
return UuidGenerator.class;
}
-
- //TODO remove these methods after refactoring UuidGenerator to extend JpaNamedContextNode
- @Override
- protected int buildDefaultInitialValue() {
- return 0;
- }
- @Override
- protected String getSchema() {
- return null;
- }
- @Override
- protected String getCatalog() {
- return null;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java
index 9e212f3..1b99c13 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java
@@ -11,25 +11,22 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryGeneratorAnnotation;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4;
/**
- * org.eclipse.persistence.annotations.Multitenant
+ * org.eclipse.persistence.annotations.UuidGenerator
*/
public class BinaryEclipseLinkUuidGeneratorAnnotation2_4
- extends BinaryAnnotation
+ extends BinaryGeneratorAnnotation
implements EclipseLinkUuidGeneratorAnnotation2_4
{
- private String name;
public BinaryEclipseLinkUuidGeneratorAnnotation2_4(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
- this.name = this.buildName();
}
public String getAnnotationName() {
@@ -37,54 +34,8 @@ public class BinaryEclipseLinkUuidGeneratorAnnotation2_4
}
@Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
+ protected String getNameElementName() {
+ return EclipseLink.UUID_GENERATOR__NAME;
}
-
- // ********** EclipseLinkMultitenantAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(EclipseLink.UUID_GENERATOR__NAME);
- }
-
- public TextRange getNameTextRange() {
- throw new UnsupportedOperationException();
- }
-
-
- public Integer getInitialValue() {
- return null;
- }
- public void setInitialValue(Integer initialValue) {
- throw new UnsupportedOperationException();
- }
- public TextRange getInitialValueTextRange() {
- throw new UnsupportedOperationException();
- }
- public Integer getAllocationSize() {
- return null;
- }
- public void setAllocationSize(Integer allocationSize) {
- throw new UnsupportedOperationException();
- }
- public TextRange getAllocationSizeTextRange() {
- throw new UnsupportedOperationException();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java
index a1cdf0f..ef2000e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java
@@ -10,42 +10,29 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4;
/**
* org.eclipse.persistence.annotations.UuidGenerator
*/
public class SourceEclipseLinkUuidGeneratorAnnotation2_4
- extends SourceAnnotation
+ extends SourceGeneratorAnnotation
implements EclipseLinkUuidGeneratorAnnotation2_4
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER
= new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__NAME);
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
- TextRange nameTextRange;
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(EclipseLink.UUID_GENERATOR__NAME);
public SourceEclipseLinkUuidGeneratorAnnotation2_4(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = this.buildAdapter(NAME_ADAPTER);
- }
-
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
}
public String getAnnotationName() {
@@ -53,58 +40,8 @@ public class SourceEclipseLinkUuidGeneratorAnnotation2_4
}
@Override
- public void initialize(Annotation astAnnotation) {
- super.initialize(astAnnotation);
- this.name = this.buildName(astAnnotation);
- this.nameTextRange = this.buildNameTextRange(astAnnotation);
- }
-
- @Override
- public void synchronizeWith(Annotation astAnnotation) {
- super.synchronizeWith(astAnnotation);
- this.syncName(this.buildName(astAnnotation));
- this.nameTextRange = this.buildNameTextRange(astAnnotation);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- if (this.attributeValueHasChanged(this.name, name)) {
- this.name = name;
- this.nameAdapter.setValue(name);
- }
- }
-
- private void syncName(String astName) {
- String old = this.name;
- this.name = astName;
- this.firePropertyChanged(NAME_PROPERTY, old, astName);
- }
-
- private String buildName(Annotation astAnnotation) {
- return this.nameAdapter.getValue(astAnnotation);
- }
-
- public TextRange getNameTextRange() {
- return this.nameTextRange;
- }
-
- private TextRange buildNameTextRange(Annotation astAnnotation) {
- return this.getElementTextRange(NAME_ADAPTER, astAnnotation);
+ protected DeclarationAnnotationElementAdapter<String> getNameAdapter() {
+ return NAME_ADAPTER;
}
@@ -114,27 +51,4 @@ public class SourceEclipseLinkUuidGeneratorAnnotation2_4
return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
}
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
-
- public Integer getInitialValue() {
- return null;
- }
- public void setInitialValue(Integer initialValue) {
- throw new UnsupportedOperationException();
- }
- public TextRange getInitialValueTextRange() {
- throw new UnsupportedOperationException();
- }
- public Integer getAllocationSize() {
- return null;
- }
- public void setAllocationSize(Integer allocationSize) {
- throw new UnsupportedOperationException();
- }
- public TextRange getAllocationSizeTextRange() {
- throw new UnsupportedOperationException();
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUuidGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUuidGenerator.java
index e42a40d..1431f66 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUuidGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUuidGenerator.java
@@ -423,7 +423,8 @@ public class XmlUuidGenerator extends EBaseObjectImpl implements XmlUuidGenerato
public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
return new SimpleTranslator(
elementName,
- structuralFeature,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
EclipseLinkOrmPackage.eINSTANCE.getXmlUuidGenerator(),
buildTranslatorChildren());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
index 17d36da..1eca1bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
@@ -12,9 +12,10 @@ package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.Generator;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.swt.widgets.Composite;
@@ -30,7 +31,7 @@ import org.eclipse.swt.widgets.Composite;
* @version 2.2
* @since 1.0
*/
-public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
+public abstract class GeneratorComposite<T extends DbGenerator> extends Pane<T>
{
protected GeneratorBuilder<T> generatorBuilder;
@@ -100,7 +101,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
}
protected void addAllocationSizeCombo(Composite container) {
- new IntegerCombo<Generator>(this, getSubjectHolder(), container) {
+ new IntegerCombo<DbGenerator>(this, getSubjectHolder(), container) {
@Override
protected String getHelpId() {
@@ -109,7 +110,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
@Override
protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Generator, Integer>(getSubjectHolder(), Generator.DEFAULT_ALLOCATION_SIZE_PROPERTY) {
+ return new PropertyAspectAdapter<DbGenerator, Integer>(getSubjectHolder(), DbGenerator.DEFAULT_ALLOCATION_SIZE_PROPERTY) {
@Override
protected Integer buildValue_() {
return Integer.valueOf(this.subject.getDefaultAllocationSize());
@@ -119,7 +120,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
@Override
protected ModifiablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Generator, Integer>(getSubjectHolder(), Generator.SPECIFIED_ALLOCATION_SIZE_PROPERTY) {
+ return new PropertyAspectAdapter<DbGenerator, Integer>(getSubjectHolder(), DbGenerator.SPECIFIED_ALLOCATION_SIZE_PROPERTY) {
@Override
protected Integer buildValue_() {
return this.subject.getSpecifiedAllocationSize();
@@ -135,7 +136,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
}
protected void addInitialValueCombo(Composite container) {
- new IntegerCombo<Generator>(this, getSubjectHolder(), container) {
+ new IntegerCombo<DbGenerator>(this, getSubjectHolder(), container) {
@Override
protected String getHelpId() {
return null;//JpaHelpContextIds.MAPPING_COLUMN_LENGTH;
@@ -143,7 +144,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
@Override
protected PropertyValueModel<Integer> buildDefaultHolder() {
- return new PropertyAspectAdapter<Generator, Integer>(getSubjectHolder(), Generator.DEFAULT_INITIAL_VALUE_PROPERTY) {
+ return new PropertyAspectAdapter<DbGenerator, Integer>(getSubjectHolder(), DbGenerator.DEFAULT_INITIAL_VALUE_PROPERTY) {
@Override
protected Integer buildValue_() {
return Integer.valueOf(this.subject.getDefaultInitialValue());
@@ -153,7 +154,7 @@ public abstract class GeneratorComposite<T extends Generator> extends Pane<T>
@Override
protected ModifiablePropertyValueModel<Integer> buildSelectedItemHolder() {
- return new PropertyAspectAdapter<Generator, Integer>(getSubjectHolder(), Generator.SPECIFIED_INITIAL_VALUE_PROPERTY) {
+ return new PropertyAspectAdapter<DbGenerator, Integer>(getSubjectHolder(), DbGenerator.SPECIFIED_INITIAL_VALUE_PROPERTY) {
@Override
protected Integer buildValue_() {
return this.subject.getSpecifiedInitialValue();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
index 06495d7..52674f6 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,12 +10,13 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
+
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
@@ -139,7 +140,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getAllocationSize());
JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
JavaResourceField resourceField = resourceType.getFields().iterator().next();
@@ -158,11 +159,11 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
idMapping.getGeneratorContainer().getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getSequenceGenerator().getDefaultAllocationSize());
assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getSequenceGenerator().getSpecifiedAllocationSize());
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
index 7910911..0242179 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
@@ -11,13 +11,14 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
+
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.DbGenerator;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.TableGenerator;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
@@ -407,7 +408,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getAllocationSize());
JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
JavaResourceField resourceField = resourceType.getFields().iterator().next();
@@ -426,11 +427,11 @@ public class JavaTableGeneratorTests extends ContextModelTestCase
IdMapping idMapping = (IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping();
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
idMapping.getGeneratorContainer().getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
- assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
+ assertEquals(DbGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getGeneratorContainer().getTableGenerator().getDefaultAllocationSize());
assertEquals(Integer.valueOf(20), idMapping.getGeneratorContainer().getTableGenerator().getSpecifiedAllocationSize());
}