diff options
author | Tran Le | 2013-02-26 22:44:33 +0000 |
---|---|---|
committer | Tran Le | 2013-02-27 00:16:32 +0000 |
commit | b14cbb3b2289d2b0d74dc83e9fa754e727c44596 (patch) | |
tree | 3bc0e28307668955fc2e38f8efe6507790b2c24a | |
parent | dbc9c863534206a1e2b56a83576c37b5b507e187 (diff) | |
download | webtools.dali-b14cbb3b2289d2b0d74dc83e9fa754e727c44596.tar.gz webtools.dali-b14cbb3b2289d2b0d74dc83e9fa754e727c44596.tar.xz webtools.dali-b14cbb3b2289d2b0d74dc83e9fa754e727c44596.zip |
Added model for DDL Gen 2.1v201302270750v201302270427
32 files changed, 1752 insertions, 30 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF index 8080be2318..29bcb03748 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF @@ -68,6 +68,8 @@ Export-Package: org.eclipse.jpt.jpa.core, org.eclipse.jpt.jpa.core.internal.jpa2_1.context;x-internal:=true, org.eclipse.jpt.jpa.core.internal.jpa2_1.context.java;x-internal:=true, org.eclipse.jpt.jpa.core.internal.jpa2_1.context.orm;x-internal:=true, + org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence;x-internal:=true, + org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen;x-internal:=true, org.eclipse.jpt.jpa.core.internal.jpa2_1.resource.java;x-internal:=true, org.eclipse.jpt.jpa.core.internal.jpa2_1.resource.java.binary;x-internal:=true, org.eclipse.jpt.jpa.core.internal.jpa2_1.resource.java.source;x-internal:=true, @@ -94,6 +96,8 @@ Export-Package: org.eclipse.jpt.jpa.core, org.eclipse.jpt.jpa.core.jpa2_1.context, org.eclipse.jpt.jpa.core.jpa2_1.context.java, org.eclipse.jpt.jpa.core.jpa2_1.context.orm, + org.eclipse.jpt.jpa.core.jpa2_1.context.persistence, + org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen, org.eclipse.jpt.jpa.core.jpa2_1.resource.java, org.eclipse.jpt.jpa.core.jpql, org.eclipse.jpt.jpa.core.jpql.spi, diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java index 14e852503b..d54994c2cb 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 Oracle. All rights reserved. + * Copyright (c) 2007, 2013 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. @@ -67,4 +67,5 @@ public interface PersistenceXmlContextNodeFactory PersistenceUnitProperties buildOptions(PersistenceUnit parent); + PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java index ebb6ba8418..915f0c0ff9 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java @@ -97,6 +97,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.PersistenceUnit2_1; import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper; import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory; @@ -120,7 +121,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public abstract class AbstractPersistenceUnit extends AbstractPersistenceXmlContextNode - implements PersistenceUnit2_0 + implements PersistenceUnit2_0, PersistenceUnit2_1 { protected final XmlPersistenceUnit xmlPersistenceUnit; @@ -192,6 +193,9 @@ public abstract class AbstractPersistenceUnit protected PersistenceUnitProperties connection; protected PersistenceUnitProperties options; + //****** JPA 2.1 features + protected PersistenceUnitProperties genericSchemaGeneration; + protected SharedCacheMode specifiedSharedCacheMode; protected SharedCacheMode defaultSharedCacheMode; @@ -1206,6 +1210,7 @@ public abstract class AbstractPersistenceUnit public void propertyValueChanged(String propertyName, String newValue) { this.connection.propertyValueChanged(propertyName, newValue); this.options.propertyValueChanged(propertyName, newValue); + this.genericSchemaGeneration.propertyValueChanged(propertyName, newValue); } protected void propertyAdded(String propertyName, String value) { @@ -1215,11 +1220,13 @@ public abstract class AbstractPersistenceUnit protected void propertyRemoved(String propertyName) { this.connection.propertyRemoved(propertyName); this.options.propertyRemoved(propertyName); + this.genericSchemaGeneration.propertyRemoved(propertyName); } protected void initializeProperties() { this.connection = this.getContextNodeFactory().buildConnection(this); this.options = this.getContextNodeFactory().buildOptions(this); + this.genericSchemaGeneration = this.getContextNodeFactory().buildSchemaGeneration(this); } protected void syncProperties() { @@ -1414,6 +1421,14 @@ public abstract class AbstractPersistenceUnit } + // ********** PersistenceUnit2_1 implementation ********** + + public PersistenceUnitProperties getSchemaGeneration() { + return this.genericSchemaGeneration; + } + + + // ********** shared cache mode ********** public SharedCacheMode getSharedCacheMode() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java index 3f329ec9bd..601f439582 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2013 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -13,6 +13,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.NullConnection2_0; import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.NullOptions2_0; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.NullGenericSchemaGeneration2_1; public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory @@ -25,5 +26,9 @@ public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistence public PersistenceUnitProperties buildOptions(PersistenceUnit parent) { return new NullOptions2_0(parent); } + + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new NullGenericSchemaGeneration2_1(parent); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java index cc6131ac51..7244903f26 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2013 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,9 +10,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.GenericConnection2_0; import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.GenericOptions2_0; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.NullGenericSchemaGeneration2_1; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; @@ -27,5 +29,9 @@ public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersiste public JpaOptions2_0 buildOptions(PersistenceUnit parent) { return new GenericOptions2_0(parent); } + + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new NullGenericSchemaGeneration2_1(parent); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/Generic2_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/Generic2_1JpaPlatformProvider.java index ba9654a79f..3f6b399cf8 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/Generic2_1JpaPlatformProvider.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/Generic2_1JpaPlatformProvider.java @@ -46,8 +46,8 @@ import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaVersionMappingDef import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition; import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_1Definition; import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.java.JavaConverterTypeDefinition; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.GenericPersistenceXml2_1Definition; /** * All the state in the JPA platform should be "static" (i.e. unchanging once diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/Generic2_1PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/Generic2_1PersistenceXmlContextNodeFactory.java new file mode 100644 index 0000000000..28d3785ba0 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/Generic2_1PersistenceXmlContextNodeFactory.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.GenericConnection2_0; +import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.GenericOptions2_0; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.GenericSchemaGeneration2_1; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.JpaSchemaGeneration2_1; + +/** + * Generic2_1PersistenceXmlContextNodeFactory + */ +public class Generic2_1PersistenceXmlContextNodeFactory + extends AbstractPersistenceXmlContextNodeFactory +{ + + public JpaConnection2_0 buildConnection(PersistenceUnit parent) { + return new GenericConnection2_0(parent); + } + + public JpaOptions2_0 buildOptions(PersistenceUnit parent) { + return new GenericOptions2_0(parent); + } + + public JpaSchemaGeneration2_1 buildSchemaGeneration(PersistenceUnit parent) { + return new GenericSchemaGeneration2_1(parent); + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/GenericPersistenceXml2_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/GenericPersistenceXml2_1Definition.java index 058b83abfa..eb99e26bb1 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/GenericPersistenceXml2_1Definition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/GenericPersistenceXml2_1Definition.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. + * Copyright (c) 2012, 2013 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. @@ -7,7 +7,7 @@ * Contributors: * Oracle - initial API and implementation ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence; +package org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence; import org.eclipse.emf.ecore.EFactory; import org.eclipse.jpt.common.core.JptResourceType; @@ -49,6 +49,7 @@ public class GenericPersistenceXml2_1Definition @Override protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new Generic2_0PersistenceXmlContextNodeFactory(); + return new Generic2_1PersistenceXmlContextNodeFactory(); } -} + } + diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/GenericSchemaGeneration2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/GenericSchemaGeneration2_1.java new file mode 100644 index 0000000000..3c3f1e1414 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/GenericSchemaGeneration2_1.java @@ -0,0 +1,549 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence.schemagen; + +import java.util.Map; +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.PersistenceUnit2_1; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.JpaSchemaGeneration2_1; + +/** + * GenericSchemaGeneration2_1 + */ +public class GenericSchemaGeneration2_1 extends AbstractPersistenceUnitProperties + implements JpaSchemaGeneration2_1 +{ + // ********** GenericSchemaGeneration2_1 properties ********** + private SchemaGenerationAction schemaGenDatabaseAction; + private SchemaGenerationAction schemaGenScriptsAction; + private SchemaGenerationTarget schemaGenCreateSource; + private SchemaGenerationTarget schemaGenDropSource; + private Boolean createDatabaseSchemas; + private String scriptsCreateTarget; + private String scriptsDropTarget; + private String databaseProductName; + private String databaseMajorVersion; + private String databaseMinorVersion; + private String createScriptSource; + private String dropScriptSource; + private String connection; + private String sqlLoadScriptSource; + + // ********** constructors ********** + public GenericSchemaGeneration2_1(PersistenceUnit parent) { + super(parent); + } + + // ********** initialization ********** + /** + * Initializes properties with values from the persistence unit. + */ + @Override + protected void initializeProperties() { + this.schemaGenDatabaseAction = + this.getEnumValue(PERSISTENCE_SCHEMAGEN_DATABASE_ACTION, SchemaGenerationAction.values()); + this.schemaGenScriptsAction = + this.getEnumValue(PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION, SchemaGenerationAction.values()); + this.schemaGenCreateSource = + this.getEnumValue(PERSISTENCE_SCHEMAGEN_CREATE_SOURCE, SchemaGenerationTarget.values()); + this.schemaGenDropSource = + this.getEnumValue(PERSISTENCE_SCHEMAGEN_DROP_SOURCE, SchemaGenerationTarget.values()); + this.createDatabaseSchemas = + this.getBooleanValue(PERSISTENCE_CREATE_DATABASE_SCHEMAS); + this.scriptsCreateTarget = + this.getStringValue(PERSISTENCE_SCRIPTS_CREATE_TARGET); + this.scriptsDropTarget = + this.getStringValue(PERSISTENCE_SCRIPTS_DROP_TARGET); + this.databaseProductName = + this.getStringValue(PERSISTENCE_DATABASE_PRODUCT_NAME); + this.databaseMajorVersion = + this.getStringValue(PERSISTENCE_DATABASE_MAJOR_VERSION); + this.databaseMinorVersion = + this.getStringValue(PERSISTENCE_DATABASE_MINOR_VERSION); + this.createScriptSource = + this.getStringValue(PERSISTENCE_CREATE_SCRIPT_SOURCE); + this.dropScriptSource = + this.getStringValue(PERSISTENCE_DROP_SCRIPT_SOURCE); + this.connection = + this.getStringValue(PERSISTENCE_CONNECTION); + this.sqlLoadScriptSource = + this.getStringValue(PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE); + } + + // ********** behavior ********** + + public void propertyValueChanged(String propertyName, String newValue) { + if (propertyName.equals(PERSISTENCE_SCHEMAGEN_DATABASE_ACTION)) { + this.schemaGenDatabaseActionChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION)) { + this.schemaGenScriptsActionChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_CREATE_SOURCE)) { + this.schemaGenCreateSourceChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_DROP_SOURCE)) { + this.schemaGenDropSourceChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_CREATE_DATABASE_SCHEMAS)) { + this.createDatabaseSchemasChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SCRIPTS_CREATE_TARGET)) { + this.scriptsCreateTargetChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SCRIPTS_DROP_TARGET)) { + this.scriptsDropTargetChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_PRODUCT_NAME)) { + this.databaseProductNameChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_MAJOR_VERSION)) { + this.databaseMajorVersionChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_MINOR_VERSION)) { + this.databaseMinorVersionChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_CREATE_SCRIPT_SOURCE)) { + this.createScriptSourceChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_DROP_SCRIPT_SOURCE)) { + this.dropScriptSourceChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_CONNECTION)) { + this.connectionChanged(newValue); + } + else if (propertyName.equals(PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE)) { + this.sqlLoadScriptSourceChanged(newValue); + } + } + + public void propertyRemoved(String propertyName) { + if (propertyName.equals(PERSISTENCE_SCHEMAGEN_DATABASE_ACTION)) { + this.schemaGenDatabaseActionChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION)) { + this.schemaGenScriptsActionChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_CREATE_SOURCE)) { + this.schemaGenCreateSourceChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SCHEMAGEN_DROP_SOURCE)) { + this.schemaGenDropSourceChanged(null); + } + else if (propertyName.equals(PERSISTENCE_CREATE_DATABASE_SCHEMAS)) { + this.createDatabaseSchemasChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SCRIPTS_CREATE_TARGET)) { + this.scriptsCreateTargetChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SCRIPTS_DROP_TARGET)) { + this.scriptsDropTargetChanged(null); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_PRODUCT_NAME)) { + this.databaseProductNameChanged(null); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_MAJOR_VERSION)) { + this.databaseMajorVersionChanged(null); + } + else if (propertyName.equals(PERSISTENCE_DATABASE_MINOR_VERSION)) { + this.databaseMinorVersionChanged(null); + } + else if (propertyName.equals(PERSISTENCE_CREATE_SCRIPT_SOURCE)) { + this.createScriptSourceChanged(null); + } + else if (propertyName.equals(PERSISTENCE_DROP_SCRIPT_SOURCE)) { + this.dropScriptSourceChanged(null); + } + else if (propertyName.equals(PERSISTENCE_CONNECTION)) { + this.connectionChanged(null); + } + else if (propertyName.equals(PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE)) { + this.sqlLoadScriptSourceChanged(null); + } + } + + /** + * Adds property names key/value pairs, where: + * key = PU property key + * value = property id + */ + @Override + protected void addPropertyNames(Map<String, String> propertyNames) { + propertyNames.put( + PERSISTENCE_SCHEMAGEN_DATABASE_ACTION, + SCHEMAGEN_DATABASE_ACTION_PROPERTY); + propertyNames.put( + PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION, + SCHEMAGEN_SCRIPTS_ACTION_PROPERTY); + propertyNames.put( + PERSISTENCE_SCHEMAGEN_CREATE_SOURCE, + SCHEMAGEN_CREATE_SOURCE_PROPERTY); + propertyNames.put( + PERSISTENCE_SCHEMAGEN_DROP_SOURCE, + SCHEMAGEN_DROP_SOURCE_PROPERTY); + propertyNames.put( + PERSISTENCE_CREATE_DATABASE_SCHEMAS, + CREATE_DATABASE_SCHEMAS_PROPERTY); + propertyNames.put( + PERSISTENCE_SCRIPTS_CREATE_TARGET, + SCRIPTS_CREATE_TARGET_PROPERTY); + propertyNames.put( + PERSISTENCE_SCRIPTS_DROP_TARGET, + SCRIPTS_DROP_TARGET_PROPERTY); + propertyNames.put( + PERSISTENCE_DATABASE_PRODUCT_NAME, + DATABASE_PRODUCT_NAME_PROPERTY); + propertyNames.put( + PERSISTENCE_DATABASE_MAJOR_VERSION, + DATABASE_MAJOR_VERSION_PROPERTY); + propertyNames.put( + PERSISTENCE_DATABASE_MINOR_VERSION, + DATABASE_MINOR_VERSION_PROPERTY); + propertyNames.put( + PERSISTENCE_CREATE_SCRIPT_SOURCE, + CREATE_SCRIPT_SOURCE_PROPERTY); + propertyNames.put( + PERSISTENCE_DROP_SCRIPT_SOURCE, + DROP_SCRIPT_SOURCE_PROPERTY); + propertyNames.put( + PERSISTENCE_CONNECTION, + CONNECTION_PROPERTY); + propertyNames.put( + PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE, + SQL_LOAD_SCRIPT_SOURCE_PROPERTY); + } + + @Override + public PersistenceUnit2_1 getPersistenceUnit() { + return (PersistenceUnit2_1) super.getPersistenceUnit(); + } + + // ********** SchemaGenDatabaseAction ********** + + public SchemaGenerationAction getSchemaGenDatabaseAction() { + return this.schemaGenDatabaseAction; + } + + public void setSchemaGenDatabaseAction(SchemaGenerationAction newSchemaGenDatabaseAction) { + SchemaGenerationAction old = this.schemaGenDatabaseAction; + this.schemaGenDatabaseAction = newSchemaGenDatabaseAction; + this.putProperty(SCHEMAGEN_DATABASE_ACTION_PROPERTY, newSchemaGenDatabaseAction); + this.firePropertyChanged(SCHEMAGEN_DATABASE_ACTION_PROPERTY, old, newSchemaGenDatabaseAction); + } + + private void schemaGenDatabaseActionChanged(String stringValue) { + SchemaGenerationAction newValue = this.getEnumValueOf(stringValue, SchemaGenerationAction.values()); + SchemaGenerationAction old = this.schemaGenDatabaseAction; + this.schemaGenDatabaseAction = newValue; + this.firePropertyChanged(SCHEMAGEN_DATABASE_ACTION_PROPERTY, old, newValue); + } + + public SchemaGenerationAction getDefaultSchemaGenDatabaseAction() { + return DEFAULT_SCHEMAGEN_DATABASE_ACTION; + } + + // ********** SchemaGenScriptsAction ********** + + public SchemaGenerationAction getSchemaGenScriptsAction() { + return this.schemaGenScriptsAction; + } + + public void setSchemaGenScriptsAction(SchemaGenerationAction newSchemaGenScriptsAction) { + SchemaGenerationAction old = this.schemaGenScriptsAction; + this.schemaGenScriptsAction = newSchemaGenScriptsAction; + this.putProperty(SCHEMAGEN_SCRIPTS_ACTION_PROPERTY, newSchemaGenScriptsAction); + this.firePropertyChanged(SCHEMAGEN_SCRIPTS_ACTION_PROPERTY, old, newSchemaGenScriptsAction); + } + + private void schemaGenScriptsActionChanged(String stringValue) { + SchemaGenerationAction newValue = this.getEnumValueOf(stringValue, SchemaGenerationAction.values()); + SchemaGenerationAction old = this.schemaGenScriptsAction; + this.schemaGenScriptsAction = newValue; + this.firePropertyChanged(SCHEMAGEN_SCRIPTS_ACTION_PROPERTY, old, newValue); + } + + public SchemaGenerationAction getDefaultSchemaGenScriptsAction() { + return DEFAULT_SCHEMAGEN_SCRIPTS_ACTION; + } + + // ********** SchemaGenCreateSource ********** + + public SchemaGenerationTarget getSchemaGenCreateSource() { + return this.schemaGenCreateSource; + } + + public void setSchemaGenCreateSource(SchemaGenerationTarget newSchemaGenCreateSource) { + SchemaGenerationTarget old = this.schemaGenCreateSource; + this.schemaGenCreateSource = newSchemaGenCreateSource; + this.putProperty(SCHEMAGEN_CREATE_SOURCE_PROPERTY, newSchemaGenCreateSource); + this.firePropertyChanged(SCHEMAGEN_CREATE_SOURCE_PROPERTY, old, newSchemaGenCreateSource); + } + + private void schemaGenCreateSourceChanged(String stringValue) { + SchemaGenerationTarget newValue = this.getEnumValueOf(stringValue, SchemaGenerationTarget.values()); + SchemaGenerationTarget old = this.schemaGenCreateSource; + this.schemaGenCreateSource = newValue; + this.firePropertyChanged(SCHEMAGEN_CREATE_SOURCE_PROPERTY, old, newValue); + } + + public SchemaGenerationTarget getDefaultSchemaGenCreateSource() { + return DEFAULT_SCHEMAGEN_CREATE_SOURCE; + } + + // ********** SchemaGenDropSource ********** + + public SchemaGenerationTarget getSchemaGenDropSource() { + return this.schemaGenDropSource; + } + + public void setSchemaGenDropSource(SchemaGenerationTarget newSchemaGenDropSource) { + SchemaGenerationTarget old = this.schemaGenDropSource; + this.schemaGenDropSource = newSchemaGenDropSource; + this.putProperty(SCHEMAGEN_DROP_SOURCE_PROPERTY, newSchemaGenDropSource); + this.firePropertyChanged(SCHEMAGEN_DROP_SOURCE_PROPERTY, old, newSchemaGenDropSource); + } + + private void schemaGenDropSourceChanged(String stringValue) { + SchemaGenerationTarget newValue = this.getEnumValueOf(stringValue, SchemaGenerationTarget.values()); + SchemaGenerationTarget old = this.schemaGenDropSource; + this.schemaGenDropSource = newValue; + this.firePropertyChanged(SCHEMAGEN_DROP_SOURCE_PROPERTY, old, newValue); + } + + public SchemaGenerationTarget getDefaultSchemaGenDropSource() { + return DEFAULT_SCHEMAGEN_DROP_SOURCE; + } + + // ********** CreateDatabaseSchemas ********** + public Boolean getCreateDatabaseSchemas() { + return this.createDatabaseSchemas; + } + + public void setCreateDatabaseSchemas(Boolean newCreateDatabaseSchemas) { + Boolean old = this.createDatabaseSchemas; + this.createDatabaseSchemas = newCreateDatabaseSchemas; + this.putProperty(CREATE_DATABASE_SCHEMAS_PROPERTY, newCreateDatabaseSchemas); + this.firePropertyChanged(CREATE_DATABASE_SCHEMAS_PROPERTY, old, newCreateDatabaseSchemas); + } + + private void createDatabaseSchemasChanged(String stringValue) { + Boolean newValue = getBooleanValueOf(stringValue); + + Boolean old = this.createDatabaseSchemas; + this.createDatabaseSchemas = newValue; + this.firePropertyChanged(CREATE_DATABASE_SCHEMAS_PROPERTY, old, newValue); + } + + public Boolean getDefaultCreateDatabaseSchemas() { + return DEFAULT_CREATE_DATABASE_SCHEMAS; + } + + // ********** ScriptsCreateTarget ********** + public String getScriptsCreateTarget() { + return this.scriptsCreateTarget; + } + + public void setScriptsCreateTarget(String newScriptsCreateTarget) { + String old = this.scriptsCreateTarget; + this.scriptsCreateTarget = newScriptsCreateTarget; + this.putProperty(SCRIPTS_CREATE_TARGET_PROPERTY, newScriptsCreateTarget); + this.firePropertyChanged(SCRIPTS_CREATE_TARGET_PROPERTY, old, newScriptsCreateTarget); + } + + private void scriptsCreateTargetChanged(String newValue) { + String old = this.scriptsCreateTarget; + this.scriptsCreateTarget = newValue; + this.firePropertyChanged(SCRIPTS_CREATE_TARGET_PROPERTY, old, newValue); + } + + public String getDefaultScriptsCreateTarget() { + return DEFAULT_SCRIPTS_CREATE_TARGET; + } + + // ********** ScriptsDropTarget ********** + public String getScriptsDropTarget() { + return this.scriptsDropTarget; + } + + public void setScriptsDropTarget(String newScriptsDropTarget) { + String old = this.scriptsDropTarget; + this.scriptsDropTarget = newScriptsDropTarget; + this.putProperty(SCRIPTS_DROP_TARGET_PROPERTY, newScriptsDropTarget); + this.firePropertyChanged(SCRIPTS_DROP_TARGET_PROPERTY, old, newScriptsDropTarget); + } + + private void scriptsDropTargetChanged(String newValue) { + String old = this.scriptsDropTarget; + this.scriptsDropTarget = newValue; + this.firePropertyChanged(SCRIPTS_DROP_TARGET_PROPERTY, old, newValue); + } + + public String getDefaultScriptsDropTarget() { + return DEFAULT_SCRIPTS_DROP_TARGET; + } + + // ********** DatabaseProductName ********** + public String getDatabaseProductName() { + return this.databaseProductName; + } + + public void setDatabaseProductName(String newDatabaseProductName) { + String old = this.databaseProductName; + this.databaseProductName = newDatabaseProductName; + this.putProperty(DATABASE_PRODUCT_NAME_PROPERTY, newDatabaseProductName); + this.firePropertyChanged(DATABASE_PRODUCT_NAME_PROPERTY, old, newDatabaseProductName); + } + + private void databaseProductNameChanged(String newValue) { + String old = this.databaseProductName; + this.databaseProductName = newValue; + this.firePropertyChanged(DATABASE_PRODUCT_NAME_PROPERTY, old, newValue); + } + + public String getDefaultDatabaseProductName() { + return DEFAULT_DATABASE_PRODUCT_NAME; + } + + // ********** DatabaseMajorVersion ********** + public String getDatabaseMajorVersion() { + return this.databaseMajorVersion; + } + + public void setDatabaseMajorVersion(String newDatabaseMajorVersion) { + String old = this.databaseMajorVersion; + this.databaseMajorVersion = newDatabaseMajorVersion; + this.putProperty(DATABASE_MAJOR_VERSION_PROPERTY, newDatabaseMajorVersion); + this.firePropertyChanged(DATABASE_MAJOR_VERSION_PROPERTY, old, newDatabaseMajorVersion); + } + + private void databaseMajorVersionChanged(String newValue) { + String old = this.databaseMajorVersion; + this.databaseMajorVersion = newValue; + this.firePropertyChanged(DATABASE_MAJOR_VERSION_PROPERTY, old, newValue); + } + + public String getDefaultDatabaseMajorVersion() { + return DEFAULT_DATABASE_MAJOR_VERSION; + } + + // ********** DatabaseMinorVersion ********** + public String getDatabaseMinorVersion() { + return this.databaseMinorVersion; + } + + public void setDatabaseMinorVersion(String newDatabaseMinorVersion) { + String old = this.databaseMinorVersion; + this.databaseMinorVersion = newDatabaseMinorVersion; + this.putProperty(DATABASE_MINOR_VERSION_PROPERTY, newDatabaseMinorVersion); + this.firePropertyChanged(DATABASE_MINOR_VERSION_PROPERTY, old, newDatabaseMinorVersion); + } + + private void databaseMinorVersionChanged(String newValue) { + String old = this.databaseMinorVersion; + this.databaseMinorVersion = newValue; + this.firePropertyChanged(DATABASE_MINOR_VERSION_PROPERTY, old, newValue); + } + + public String getDefaultDatabaseMinorVersion() { + return DEFAULT_DATABASE_MINOR_VERSION; + } + + // ********** CreateScriptSource ********** + public String getCreateScriptSource() { + return this.createScriptSource; + } + + public void setCreateScriptSource(String newCreateScriptSource) { + String old = this.createScriptSource; + this.createScriptSource = newCreateScriptSource; + this.putProperty(CREATE_SCRIPT_SOURCE_PROPERTY, newCreateScriptSource); + this.firePropertyChanged(CREATE_SCRIPT_SOURCE_PROPERTY, old, newCreateScriptSource); + } + + private void createScriptSourceChanged(String newValue) { + String old = this.createScriptSource; + this.createScriptSource = newValue; + this.firePropertyChanged(CREATE_SCRIPT_SOURCE_PROPERTY, old, newValue); + } + + public String getDefaultCreateScriptSource() { + return DEFAULT_CREATE_SCRIPT_SOURCE; + } + + // ********** DropScriptSource ********** + public String getDropScriptSource() { + return this.dropScriptSource; + } + + public void setDropScriptSource(String newDropScriptSource) { + String old = this.dropScriptSource; + this.dropScriptSource = newDropScriptSource; + this.putProperty(DROP_SCRIPT_SOURCE_PROPERTY, newDropScriptSource); + this.firePropertyChanged(DROP_SCRIPT_SOURCE_PROPERTY, old, newDropScriptSource); + } + + private void dropScriptSourceChanged(String newValue) { + String old = this.dropScriptSource; + this.dropScriptSource = newValue; + this.firePropertyChanged(DROP_SCRIPT_SOURCE_PROPERTY, old, newValue); + } + + public String getDefaultDropScriptSource() { + return DEFAULT_DROP_SCRIPT_SOURCE; + } + + // ********** Connection ********** + public String getConnection() { + return this.connection; + } + + public void setConnection(String newConnection) { + String old = this.connection; + this.connection = newConnection; + this.putProperty(CONNECTION_PROPERTY, newConnection); + this.firePropertyChanged(CONNECTION_PROPERTY, old, newConnection); + } + + private void connectionChanged(String newValue) { + String old = this.connection; + this.connection = newValue; + this.firePropertyChanged(CONNECTION_PROPERTY, old, newValue); + } + + public String getDefaultConnection() { + return DEFAULT_CONNECTION; + } + + // ********** SqlLoadScriptSource ********** + public String getSqlLoadScriptSource() { + return this.sqlLoadScriptSource; + } + + public void setSqlLoadScriptSource(String newSqlLoadScriptSource) { + String old = this.sqlLoadScriptSource; + this.sqlLoadScriptSource = newSqlLoadScriptSource; + this.putProperty(SQL_LOAD_SCRIPT_SOURCE_PROPERTY, newSqlLoadScriptSource); + this.firePropertyChanged(SQL_LOAD_SCRIPT_SOURCE_PROPERTY, old, newSqlLoadScriptSource); + } + + private void sqlLoadScriptSourceChanged(String newValue) { + String old = this.sqlLoadScriptSource; + this.sqlLoadScriptSource = newValue; + this.firePropertyChanged(SQL_LOAD_SCRIPT_SOURCE_PROPERTY, old, newValue); + } + + public String getDefaultSqlLoadScriptSource() { + return DEFAULT_SQL_LOAD_SCRIPT_SOURCE; + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/NullGenericSchemaGeneration2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/NullGenericSchemaGeneration2_1.java new file mode 100644 index 0000000000..32a26f828a --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/persistence/schemagen/NullGenericSchemaGeneration2_1.java @@ -0,0 +1,246 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence.schemagen; + +import java.util.Map; +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.JpaSchemaGeneration2_1; + +/** + * NullGenericSchemaGeneration2_1 + */ +public class NullGenericSchemaGeneration2_1 extends AbstractPersistenceUnitProperties + implements JpaSchemaGeneration2_1 +{ + // ********** constructors ********** + public NullGenericSchemaGeneration2_1(PersistenceUnit parent) { + super(parent); + } + + // ********** initialization ********** + /** + * Initializes properties with values from the persistence unit. + */ + @Override + protected void initializeProperties() { + //do nothing + } + + // ********** behavior ********** + + public void propertyValueChanged(String propertyName, String newValue) { + //do nothing + } + + public void propertyRemoved(String propertyName) { + //do nothing + } + + /** + * Adds property names key/value pairs, where: + * key = PU property key + * value = property id + */ + @Override + protected void addPropertyNames(Map<String, String> propertyNames) { + //do nothing + } + + + // ********** SchemaGenDatabaseAction ********** + + public SchemaGenerationAction getSchemaGenDatabaseAction() { + return null; + } + + public void setSchemaGenDatabaseAction(SchemaGenerationAction newSchemaGenDatabaseAction) { + throw new UnsupportedOperationException(); + } + + public SchemaGenerationAction getDefaultSchemaGenDatabaseAction() { + return DEFAULT_SCHEMAGEN_DATABASE_ACTION; + } + + // ********** SchemaGenScriptsAction ********** + + public SchemaGenerationAction getSchemaGenScriptsAction() { + return null; + } + + public void setSchemaGenScriptsAction(SchemaGenerationAction newSchemaGenScriptsAction) { + throw new UnsupportedOperationException(); + } + + public SchemaGenerationAction getDefaultSchemaGenScriptsAction() { + return DEFAULT_SCHEMAGEN_SCRIPTS_ACTION; + } + + // ********** SchemaGenCreateSource ********** + + public SchemaGenerationTarget getSchemaGenCreateSource() { + return null; + } + + public void setSchemaGenCreateSource(SchemaGenerationTarget newSchemaGenCreateSource) { + throw new UnsupportedOperationException(); + } + + public SchemaGenerationTarget getDefaultSchemaGenCreateSource() { + return DEFAULT_SCHEMAGEN_CREATE_SOURCE; + } + + // ********** SchemaGenDropSource ********** + + public SchemaGenerationTarget getSchemaGenDropSource() { + return null; + } + + public void setSchemaGenDropSource(SchemaGenerationTarget newSchemaGenDropSource) { + throw new UnsupportedOperationException(); + } + + public SchemaGenerationTarget getDefaultSchemaGenDropSource() { + return DEFAULT_SCHEMAGEN_DROP_SOURCE; + } + + // ********** CreateDatabaseSchemas ********** + public Boolean getCreateDatabaseSchemas() { + return null; + } + + public void setCreateDatabaseSchemas(Boolean newCreateDatabaseSchemas) { + throw new UnsupportedOperationException(); + } + + public Boolean getDefaultCreateDatabaseSchemas() { + return DEFAULT_CREATE_DATABASE_SCHEMAS; + } + + // ********** ScriptsCreateTarget ********** + public String getScriptsCreateTarget() { + return null; + } + + public void setScriptsCreateTarget(String newScriptsCreateTarget) { + throw new UnsupportedOperationException(); + } + + + public String getDefaultScriptsCreateTarget() { + return DEFAULT_SCRIPTS_CREATE_TARGET; + } + + // ********** ScriptsDropTarget ********** + public String getScriptsDropTarget() { + return null; + } + + public void setScriptsDropTarget(String newScriptsDropTarget) { + throw new UnsupportedOperationException(); + } + + public String getDefaultScriptsDropTarget() { + return DEFAULT_SCRIPTS_DROP_TARGET; + } + + // ********** DatabaseProductName ********** + public String getDatabaseProductName() { + return null; + } + + public void setDatabaseProductName(String newDatabaseProductName) { + throw new UnsupportedOperationException(); + } + + public String getDefaultDatabaseProductName() { + return DEFAULT_DATABASE_PRODUCT_NAME; + } + + // ********** DatabaseMajorVersion ********** + public String getDatabaseMajorVersion() { + return null; + } + + public void setDatabaseMajorVersion(String newDatabaseMajorVersion) { + throw new UnsupportedOperationException(); + } + + public String getDefaultDatabaseMajorVersion() { + return DEFAULT_DATABASE_MAJOR_VERSION; + } + + // ********** DatabaseMinorVersion ********** + public String getDatabaseMinorVersion() { + return null; + } + + public void setDatabaseMinorVersion(String newDatabaseMinorVersion) { + throw new UnsupportedOperationException(); + } + + public String getDefaultDatabaseMinorVersion() { + return DEFAULT_DATABASE_MINOR_VERSION; + } + + // ********** CreateScriptSource ********** + public String getCreateScriptSource() { + return null; + } + + public void setCreateScriptSource(String newCreateScriptSource) { + throw new UnsupportedOperationException(); + } + + public String getDefaultCreateScriptSource() { + return DEFAULT_CREATE_SCRIPT_SOURCE; + } + + // ********** DropScriptSource ********** + public String getDropScriptSource() { + return null; + } + + public void setDropScriptSource(String newDropScriptSource) { + throw new UnsupportedOperationException(); + } + + public String getDefaultDropScriptSource() { + return DEFAULT_DROP_SCRIPT_SOURCE; + } + + // ********** Connection ********** + public String getConnection() { + return null; + } + + public void setConnection(String newConnection) { + throw new UnsupportedOperationException(); + } + + public String getDefaultConnection() { + return DEFAULT_CONNECTION; + } + + // ********** SqlLoadScriptSource ********** + public String getSqlLoadScriptSource() { + return null; + } + + public void setSqlLoadScriptSource(String newSqlLoadScriptSource) { + throw new UnsupportedOperationException(); + } + + public String getDefaultSqlLoadScriptSource() { + return DEFAULT_SQL_LOAD_SCRIPT_SOURCE; + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/PersistenceUnit2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/PersistenceUnit2_1.java new file mode 100644 index 0000000000..c9efd8b02c --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/PersistenceUnit2_1.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; + +/** + * JPA 2.1 <code>persistence-unit</code> + * <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 PersistenceUnit2_1 extends PersistenceUnit2_0 +{ + + + // ********** properties ********** + + PersistenceUnitProperties getSchemaGeneration(); + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationAction.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationAction.java new file mode 100644 index 0000000000..33a9c0a9f9 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationAction.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlEnumValue; + +/** + * SchemaGenerationAction + */ +public enum SchemaGenerationAction implements PersistenceXmlEnumValue { + none("none"), //$NON-NLS-1$ + create("create"), //$NON-NLS-1$ + drop_and_create("drop-and-create"), //$NON-NLS-1$ + drop("drop"); //$NON-NLS-1$ + + private final String propertyValue; + + SchemaGenerationAction(String propertyValue) { + this.propertyValue = propertyValue; + } + + /** + * The string used as the property value in the persistence.xml + */ + public String getPropertyValue() { + return this.propertyValue; + } +}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationTarget.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationTarget.java new file mode 100644 index 0000000000..488bd75d84 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/SchemaGenerationTarget.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlEnumValue; + +/** + * SchemaGenerationSource + */ +public enum SchemaGenerationTarget implements PersistenceXmlEnumValue { + metadata("metadata"), //$NON-NLS-1$ + script("script"), //$NON-NLS-1$ + metadata_then_script("metadata-then-script"), //$NON-NLS-1$ + script_then_metadata("script-then-metadata"); //$NON-NLS-1$ + + private final String propertyValue; + + SchemaGenerationTarget(String propertyValue) { + this.propertyValue = propertyValue; + } + + /** + * The string used as the property value in the persistence.xml + */ + public String getPropertyValue() { + return this.propertyValue; + } +}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/schemagen/JpaSchemaGeneration2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/schemagen/JpaSchemaGeneration2_1.java new file mode 100644 index 0000000000..da0e757c68 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2_1/context/persistence/schemagen/JpaSchemaGeneration2_1.java @@ -0,0 +1,135 @@ +/******************************************************************************* + * Copyright (c) 2013 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.jpa2_1.context.persistence.schemagen; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget; + +/** + * JpaSchemaGeneration2_1 + */ +public interface JpaSchemaGeneration2_1 extends PersistenceUnitProperties +{ + // Schema Generation + SchemaGenerationAction getDefaultSchemaGenDatabaseAction(); + SchemaGenerationAction getSchemaGenDatabaseAction(); + void setSchemaGenDatabaseAction(SchemaGenerationAction newSchemaGenAction); + static final String SCHEMAGEN_DATABASE_ACTION_PROPERTY = "schemaGenDatabaseAction"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCHEMAGEN_DATABASE_ACTION = "javax.persistence.schema-generation.database.action"; //$NON-NLS-1$ + static final SchemaGenerationAction DEFAULT_SCHEMAGEN_DATABASE_ACTION = SchemaGenerationAction.none; + + SchemaGenerationAction getDefaultSchemaGenScriptsAction(); + SchemaGenerationAction getSchemaGenScriptsAction(); + void setSchemaGenScriptsAction(SchemaGenerationAction newSchemaGenAction); + static final String SCHEMAGEN_SCRIPTS_ACTION_PROPERTY = "schemaGenScriptsAction"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION = "javax.persistence.schema-generation.scripts.action"; //$NON-NLS-1$ + static final SchemaGenerationAction DEFAULT_SCHEMAGEN_SCRIPTS_ACTION = SchemaGenerationAction.none; + + SchemaGenerationTarget getDefaultSchemaGenCreateSource(); + SchemaGenerationTarget getSchemaGenCreateSource(); + void setSchemaGenCreateSource(SchemaGenerationTarget newSchemaGenSource); + static final String SCHEMAGEN_CREATE_SOURCE_PROPERTY = "schemaGenCreateSource"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCHEMAGEN_CREATE_SOURCE = "javax.persistence.schema-generation.create-source"; //$NON-NLS-1$ + static final SchemaGenerationTarget DEFAULT_SCHEMAGEN_CREATE_SOURCE = null; + + SchemaGenerationTarget getDefaultSchemaGenDropSource(); + SchemaGenerationTarget getSchemaGenDropSource(); + void setSchemaGenDropSource(SchemaGenerationTarget newSchemaGenSource); + static final String SCHEMAGEN_DROP_SOURCE_PROPERTY = "schemaGenDropSource"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCHEMAGEN_DROP_SOURCE = "javax.persistence.schema-generation.drop-source"; //$NON-NLS-1$ + static final SchemaGenerationTarget DEFAULT_SCHEMAGEN_DROP_SOURCE = null; + + Boolean getDefaultCreateDatabaseSchemas(); + Boolean getCreateDatabaseSchemas(); + void setCreateDatabaseSchemas(Boolean newCreateDatabaseSchemas); + static final String CREATE_DATABASE_SCHEMAS_PROPERTY = "createDatabaseSchemas"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_CREATE_DATABASE_SCHEMAS = "javax.persistence.schema-generation.create-database-schemas"; //$NON-NLS-1$ + static final Boolean DEFAULT_CREATE_DATABASE_SCHEMAS = Boolean.FALSE; + + String getDefaultScriptsCreateTarget(); + String getScriptsCreateTarget(); + void setScriptsCreateTarget(String newScriptsCreateTarget); + static final String SCRIPTS_CREATE_TARGET_PROPERTY = "scriptsCreateTarget"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCRIPTS_CREATE_TARGET = "javax.persistence.schema-generation.scripts.create-target"; //$NON-NLS-1$ + static final String DEFAULT_SCRIPTS_CREATE_TARGET = ""; //$NON-NLS-1$ + + String getDefaultScriptsDropTarget(); + String getScriptsDropTarget(); + void setScriptsDropTarget(String newScriptsDropTarget); + static final String SCRIPTS_DROP_TARGET_PROPERTY = "scriptsDropTarget"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_SCRIPTS_DROP_TARGET = "javax.persistence.schema-generation.scripts.drop-target"; //$NON-NLS-1$ + static final String DEFAULT_SCRIPTS_DROP_TARGET = ""; //$NON-NLS-1$ + + String getDefaultDatabaseProductName(); + String getDatabaseProductName(); + void setDatabaseProductName(String newDatabaseProductName); + static final String DATABASE_PRODUCT_NAME_PROPERTY = "databaseProductName"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_DATABASE_PRODUCT_NAME = "javax.persistence.database-product-name"; //$NON-NLS-1$ + static final String DEFAULT_DATABASE_PRODUCT_NAME = ""; //$NON-NLS-1$ + + String getDefaultDatabaseMajorVersion(); + String getDatabaseMajorVersion(); + void setDatabaseMajorVersion(String newDatabaseMajorVersion); + static final String DATABASE_MAJOR_VERSION_PROPERTY = "databaseMajorVersion"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_DATABASE_MAJOR_VERSION = "javax.persistence.database-major-version"; //$NON-NLS-1$ + static final String DEFAULT_DATABASE_MAJOR_VERSION = ""; //$NON-NLS-1$ + + String getDefaultDatabaseMinorVersion(); + String getDatabaseMinorVersion(); + void setDatabaseMinorVersion(String newDatabaseMinorVersion); + static final String DATABASE_MINOR_VERSION_PROPERTY = "databaseMinorVersion"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_DATABASE_MINOR_VERSION = "javax.persistence.database-minor-version"; //$NON-NLS-1$ + static final String DEFAULT_DATABASE_MINOR_VERSION = ""; //$NON-NLS-1$ + + String getDefaultCreateScriptSource(); + String getCreateScriptSource(); + void setCreateScriptSource(String newCreateScriptSource); + static final String CREATE_SCRIPT_SOURCE_PROPERTY = "createScriptSource"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_CREATE_SCRIPT_SOURCE = "javax.persistence.schema-generation.create-script-source"; //$NON-NLS-1$ + static final String DEFAULT_CREATE_SCRIPT_SOURCE = ""; //$NON-NLS-1$ + + String getDefaultDropScriptSource(); + String getDropScriptSource(); + void setDropScriptSource(String newDropScriptSource); + static final String DROP_SCRIPT_SOURCE_PROPERTY = "dropScriptSource"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_DROP_SCRIPT_SOURCE = "javax.persistence.schema-generation.drop-script-source"; //$NON-NLS-1$ + static final String DEFAULT_DROP_SCRIPT_SOURCE = ""; //$NON-NLS-1$ + + String getDefaultConnection(); + String getConnection(); + void setConnection(String newConnection); + static final String CONNECTION_PROPERTY = "connection"; //$NON-NLS-1$ + // Property key string + static final String PERSISTENCE_CONNECTION = "javax.persistence.schema-generation.connection"; //$NON-NLS-1$ + static final String DEFAULT_CONNECTION = ""; //$NON-NLS-1$ + + // Data Loading + String getDefaultSqlLoadScriptSource(); + String getSqlLoadScriptSource(); + void setSqlLoadScriptSource(String newSqlLoadScriptSource); + static final String SQL_LOAD_SCRIPT_SOURCE_PROPERTY = "sqlLoadScriptSource"; //$NON-NLS-1$ + // Property key + static final String PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE = "javax.persistence.sql-load-script-source"; //$NON-NLS-1$ + static final String DEFAULT_SQL_LOAD_SCRIPT_SOURCE = ""; //$NON-NLS-1$ + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java index 6d7dce5c2b..46c81c0190 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java @@ -115,7 +115,7 @@ public class EclipseLinkPersistenceUnit private Customization customization; private Caching caching; private Logging logging; - private SchemaGeneration schemaGeneration; + private SchemaGeneration eclipseLinkSchemaGeneration; /* global converter definitions, defined elsewhere in model */ protected final Vector<EclipseLinkConverter> converters = new Vector<EclipseLinkConverter>(); @@ -205,8 +205,8 @@ public class EclipseLinkPersistenceUnit return (Options) super.getOptions(); } - public SchemaGeneration getSchemaGeneration() { - return this.schemaGeneration; + public SchemaGeneration getEclipseLinkSchemaGeneration() { + return this.eclipseLinkSchemaGeneration; } protected GeneralProperties buildEclipseLinkGeneralProperties() { @@ -244,7 +244,7 @@ public class EclipseLinkPersistenceUnit this.customization = this.buildEclipseLinkCustomization(); this.caching = this.buildEclipseLinkCaching(); this.logging = this.buildEclipseLinkLogging(); - this.schemaGeneration = this.buildEclipseLinkSchemaGeneration(); + this.eclipseLinkSchemaGeneration = this.buildEclipseLinkSchemaGeneration(); } @Override @@ -254,7 +254,7 @@ public class EclipseLinkPersistenceUnit this.customization.propertyValueChanged(propertyName, newValue); this.caching.propertyValueChanged(propertyName, newValue); this.logging.propertyValueChanged(propertyName, newValue); - this.schemaGeneration.propertyValueChanged(propertyName, newValue); + this.eclipseLinkSchemaGeneration.propertyValueChanged(propertyName, newValue); } @Override @@ -264,7 +264,7 @@ public class EclipseLinkPersistenceUnit this.customization.propertyRemoved(propertyName); this.caching.propertyRemoved(propertyName); this.logging.propertyRemoved(propertyName); - this.schemaGeneration.propertyRemoved(propertyName); + this.eclipseLinkSchemaGeneration.propertyRemoved(propertyName); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_5ForJpa2_1PlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_5ForJpa2_1PlatformProvider.java index 6a6e6ac0f0..252d9ed825 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_5ForJpa2_1PlatformProvider.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_5ForJpa2_1PlatformProvider.java @@ -31,8 +31,8 @@ import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefini import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition; import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_1Definition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.java.JavaConverterTypeDefinition; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaArrayMappingDefinition2_3; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/AbstractEclipseLinkPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/AbstractEclipseLinkPersistenceXmlContextNodeFactory.java index 401c12ba91..33d095c726 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/AbstractEclipseLinkPersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/AbstractEclipseLinkPersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2012 Oracle. All rights reserved. +* Copyright (c) 2012, 2013 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. @@ -39,4 +39,5 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersi public abstract PersistenceUnitProperties buildLogging(PersistenceUnit parent); + public abstract PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java index cb1f0510b5..058eba74f4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2013 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. @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.NullGenericSchemaGeneration2_1; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; @@ -33,4 +34,9 @@ public class EclipseLink2_0PersistenceXmlContextNodeFactory public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { return new EclipseLinkLogging2_0((PersistenceUnit2_0) parent); } + + @Override + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new NullGenericSchemaGeneration2_1(parent); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlContextNodeFactory.java index 7b8f53b563..2cee38cb8c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2012 Oracle. All rights reserved. +* Copyright (c) 2012, 2013 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. @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.NullGenericSchemaGeneration2_1; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; @@ -33,4 +34,9 @@ public class EclipseLink2_4PersistenceXmlContextNodeFactory public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { return new EclipseLinkLogging2_4((PersistenceUnit2_0) parent); } + + @Override + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new NullGenericSchemaGeneration2_1(parent); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5ForJpa2_1PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5ForJpa2_1PersistenceXmlDefinition.java index e84d9145ec..4412eb5be1 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5ForJpa2_1PersistenceXmlDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5ForJpa2_1PersistenceXmlDefinition.java @@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_1Definition; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory; public class EclipseLink2_5ForJpa2_1PersistenceXmlDefinition diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5PersistenceXmlContextNodeFactory.java new file mode 100644 index 0000000000..ff480af851 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_5PersistenceXmlContextNodeFactory.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2013 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; + +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.GenericSchemaGeneration2_1; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; +import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; + +public class EclipseLink2_5PersistenceXmlContextNodeFactory + extends AbstractEclipseLinkPersistenceXmlContextNodeFactory { + + @Override + public JpaConnection2_0 buildConnection(PersistenceUnit parent) { + return new EclipseLinkConnection2_0((PersistenceUnit2_0) parent); + } + + @Override + public JpaOptions2_0 buildOptions(PersistenceUnit parent) { + return new EclipseLinkOptions2_0((PersistenceUnit2_0) parent); + } + + @Override + public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { + return new EclipseLinkLogging2_4((PersistenceUnit2_0) parent); + } + + @Override + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new GenericSchemaGeneration2_1(parent); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java index 68b83b1945..d9d7fb2351 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2013 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. @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.schemagen.NullGenericSchemaGeneration2_1; public class EclipseLinkPersistenceXmlContextNodeFactory @@ -30,4 +31,9 @@ public class EclipseLinkPersistenceXmlContextNodeFactory public PersistenceUnitProperties buildLogging(PersistenceUnit parent) { return new EclipseLinkLogging(parent); } + + @Override + public PersistenceUnitProperties buildSchemaGeneration(PersistenceUnit parent) { + return new NullGenericSchemaGeneration2_1(parent); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java index ed025b29f7..8530fe491d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkPersistenceUnitOptionsEditorPage.java @@ -205,7 +205,7 @@ public class EclipseLinkPersistenceUnitOptionsEditorPage return new TransformationPropertyValueModel<PersistenceUnit, SchemaGeneration>(getSubjectHolder()) { @Override protected SchemaGeneration transform_(PersistenceUnit value) { - return ((EclipseLinkPersistenceUnit) value).getSchemaGeneration(); + return ((EclipseLinkPersistenceUnit) value).getEclipseLinkSchemaGeneration(); } }; } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_5ForJpa2_1UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_5ForJpa2_1UiDefinition.java index e35472d94a..78cb754647 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_5ForJpa2_1UiDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_5ForJpa2_1UiDefinition.java @@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.v2_0.persistence; import java.util.List; import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_1Definition; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.connection.EclipseLinkPersistenceUnitConnectionEditorPageDefinition; import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.general.EclipseLinkPersistenceUnitGeneralEditorPageDefinition; import org.eclipse.jpt.jpa.ui.JavaManagedTypeUiDefinition; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java index f5faf7df4c..4b6e0f932b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java @@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2_1.persistence; import java.util.List; import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_1Definition; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.context.persistence.GenericPersistenceXml2_1Definition; import org.eclipse.jpt.jpa.ui.JavaManagedTypeUiDefinition; import org.eclipse.jpt.jpa.ui.PersistenceResourceUiDefinition; import org.eclipse.jpt.jpa.ui.editors.JpaEditorPageDefinition; diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JptJpaCoreContextModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JptJpaCoreContextModelTests.java index 1cfce1b990..0732e60532 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JptJpaCoreContextModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JptJpaCoreContextModelTests.java @@ -22,6 +22,7 @@ import org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.persistence.Generic2 import org.eclipse.jpt.jpa.core.tests.internal.jpa2_1.context.JpaProject2_1Tests; import org.eclipse.jpt.jpa.core.tests.internal.jpa2_1.context.java.Generic2_1JavaContextModelTests; import org.eclipse.jpt.jpa.core.tests.internal.jpa2_1.context.orm.Generic2_1OrmContextModelTests; +import org.eclipse.jpt.jpa.core.tests.internal.jpa2_1.context.persistence.Generic2_1PersistenceContextModelTests; import org.eclipse.jpt.jpa.core.tests.internal.jpa2_1.context.persistence.JptJpa2_1ContextPersistenceModelTests; /** @@ -47,6 +48,7 @@ public class JptJpaCoreContextModelTests suite.addTest(JptJpa2_1ContextPersistenceModelTests.suite()); suite.addTest(Generic2_1JavaContextModelTests.suite()); suite.addTest(Generic2_1OrmContextModelTests.suite()); + suite.addTest(Generic2_1PersistenceContextModelTests.suite()); } else { suite.addTest(TestSuite.warning(JptJpaCoreTests.buildMissingJarErrorMessage())); } diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1PersistenceContextModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1PersistenceContextModelTests.java new file mode 100644 index 0000000000..7188edfda8 --- /dev/null +++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1PersistenceContextModelTests.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2013 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.tests.internal.jpa2_1.context.persistence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Generic2_1PersistenceContextModelTests + */ +public class Generic2_1PersistenceContextModelTests extends TestCase +{ + + public static Test suite() { + TestSuite suite = new TestSuite(Generic2_1PersistenceContextModelTests.class.getPackage().getName()); + suite.addTestSuite(Generic2_1SchemaGenerationTests.class); + return suite; + } + +private Generic2_1PersistenceContextModelTests() { + super(); + throw new UnsupportedOperationException(); +} +} diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1SchemaGenerationTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1SchemaGenerationTests.java new file mode 100644 index 0000000000..3b7d171bb0 --- /dev/null +++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/Generic2_1SchemaGenerationTests.java @@ -0,0 +1,465 @@ +/******************************************************************************* + * Copyright (c) 2013 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.tests.internal.jpa2_1.context.persistence; + +import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; +import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.JpaSchemaGeneration2_1; + +/** + * Generic2_1SchemaGenerationTests + */ +public class Generic2_1SchemaGenerationTests extends PersistenceUnit2_1TestCase +{ + JpaSchemaGeneration2_1 schemaGeneration; + + public static final String SCHEMAGEN_DATABASE_ACTION_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCHEMAGEN_DATABASE_ACTION; + public static final SchemaGenerationAction SCHEMAGEN_DATABASE_ACTION_TEST_VALUE = SchemaGenerationAction.create; + public static final SchemaGenerationAction SCHEMAGEN_DATABASE_ACTION_TEST_VALUE_2 = SchemaGenerationAction.drop_and_create; + + public static final String SCHEMAGEN_SCRIPTS_ACTION_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCHEMAGEN_SCRIPTS_ACTION; + public static final SchemaGenerationAction SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE = SchemaGenerationAction.drop_and_create; + public static final SchemaGenerationAction SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE_2 = SchemaGenerationAction.drop; + + public static final String SCHEMAGEN_CREATE_SOURCE_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCHEMAGEN_CREATE_SOURCE; + public static final SchemaGenerationTarget SCHEMAGEN_CREATE_SOURCE_TEST_VALUE = SchemaGenerationTarget.metadata; + public static final SchemaGenerationTarget SCHEMAGEN_CREATE_SOURCE_TEST_VALUE_2 = SchemaGenerationTarget.metadata_then_script; + + public static final String SCHEMAGEN_DROP_SOURCE_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCHEMAGEN_DROP_SOURCE; + public static final SchemaGenerationTarget SCHEMAGEN_DROP_SOURCE_TEST_VALUE = SchemaGenerationTarget.script_then_metadata; + public static final SchemaGenerationTarget SCHEMAGEN_DROP_SOURCE_TEST_VALUE_2 = SchemaGenerationTarget.script; + + public static final String CREATE_DATABASE_SCHEMAS_KEY = JpaSchemaGeneration2_1.PERSISTENCE_CREATE_DATABASE_SCHEMAS; + public static final Boolean CREATE_DATABASE_SCHEMAS_TEST_VALUE = true; + public static final Boolean CREATE_DATABASE_SCHEMAS_TEST_VALUE_2 = ! CREATE_DATABASE_SCHEMAS_TEST_VALUE; + + public static final String SCRIPTS_CREATE_TARGET_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCRIPTS_CREATE_TARGET; + public static final String SCRIPTS_CREATE_TARGET_TEST_VALUE = "ScriptsCreateTarget"; + public static final String SCRIPTS_CREATE_TARGET_TEST_VALUE_2 = "ScriptsCreateTarget_2"; + + public static final String SCRIPTS_DROP_TARGET_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SCRIPTS_DROP_TARGET; + public static final String SCRIPTS_DROP_TARGET_TEST_VALUE = "ScriptsDropTarget"; + public static final String SCRIPTS_DROP_TARGET_TEST_VALUE_2 = "ScriptsDropTarget_2"; + + public static final String DATABASE_PRODUCT_NAME_KEY = JpaSchemaGeneration2_1.PERSISTENCE_DATABASE_PRODUCT_NAME; + public static final String DATABASE_PRODUCT_NAME_TEST_VALUE = "DatabaseProductName"; + public static final String DATABASE_PRODUCT_NAME_TEST_VALUE_2 = "DatabaseProductName_2"; + + public static final String DATABASE_MAJOR_VERSION_KEY = JpaSchemaGeneration2_1.PERSISTENCE_DATABASE_MAJOR_VERSION; + public static final String DATABASE_MAJOR_VERSION_TEST_VALUE = "DatabaseMajorVersion"; + public static final String DATABASE_MAJOR_VERSION_TEST_VALUE_2 = "DatabaseMajorVersion_2"; + + public static final String DATABASE_MINOR_VERSION_KEY = JpaSchemaGeneration2_1.PERSISTENCE_DATABASE_MINOR_VERSION; + public static final String DATABASE_MINOR_VERSION_TEST_VALUE = "DatabaseMinorVersion"; + public static final String DATABASE_MINOR_VERSION_TEST_VALUE_2 = "DatabaseMinorVersion_2"; + + public static final String CREATE_SCRIPT_SOURCE_KEY = JpaSchemaGeneration2_1.PERSISTENCE_CREATE_SCRIPT_SOURCE; + public static final String CREATE_SCRIPT_SOURCE_TEST_VALUE = "CreateScriptSource"; + public static final String CREATE_SCRIPT_SOURCE_TEST_VALUE_2 = "CreateScriptSource_2"; + + public static final String DROP_SCRIPT_SOURCE_KEY = JpaSchemaGeneration2_1.PERSISTENCE_DROP_SCRIPT_SOURCE; + public static final String DROP_SCRIPT_SOURCE_TEST_VALUE = "DropScriptSource"; + public static final String DROP_SCRIPT_SOURCE_TEST_VALUE_2 = "DropScriptSource_2"; + + public static final String CONNECTION_KEY = JpaSchemaGeneration2_1.PERSISTENCE_CONNECTION; + public static final String CONNECTION_TEST_VALUE = "Connection"; + public static final String CONNECTION_TEST_VALUE_2 = "Connection_2"; + + public static final String SQL_LOAD_SCRIPT_SOURCE_KEY = JpaSchemaGeneration2_1.PERSISTENCE_SQL_LOAD_SCRIPT_SOURCE; + public static final String SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE = "SqlLoadScriptSource"; + public static final String SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE_2 = "SqlLoadScriptSource_2"; + + + + // ********** constructors ********** + public Generic2_1SchemaGenerationTests(String name) { + super(name); + } + + // ********** behavior ********** + @Override + protected void setUp() throws Exception { + super.setUp(); + this.schemaGeneration = (JpaSchemaGeneration2_1) this.subject.getSchemaGeneration(); + PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener(); + + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCHEMAGEN_DATABASE_ACTION_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCHEMAGEN_SCRIPTS_ACTION_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCHEMAGEN_CREATE_SOURCE_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCHEMAGEN_DROP_SOURCE_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.CREATE_DATABASE_SCHEMAS_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCRIPTS_CREATE_TARGET_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SCRIPTS_DROP_TARGET_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.DATABASE_PRODUCT_NAME_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.DATABASE_MAJOR_VERSION_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.DATABASE_MINOR_VERSION_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.CREATE_SCRIPT_SOURCE_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.DROP_SCRIPT_SOURCE_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.CONNECTION_PROPERTY, propertyChangeListener); + this.schemaGeneration.addPropertyChangeListener(JpaSchemaGeneration2_1.SQL_LOAD_SCRIPT_SOURCE_PROPERTY, propertyChangeListener); + + this.clearEvent(); + } + + @Override + protected void populatePu() { + this.modelPropertiesSizeOriginal = 5; + this.propertiesTotal = this.modelPropertiesSizeOriginal; + this.modelPropertiesSize = this.modelPropertiesSizeOriginal; + + this.persistenceUnitSetProperty(SCHEMAGEN_DATABASE_ACTION_KEY, SCHEMAGEN_DATABASE_ACTION_TEST_VALUE); + this.persistenceUnitSetProperty(SCHEMAGEN_SCRIPTS_ACTION_KEY, SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE); + this.persistenceUnitSetProperty(SCHEMAGEN_CREATE_SOURCE_KEY, SCHEMAGEN_CREATE_SOURCE_TEST_VALUE); + this.persistenceUnitSetProperty(SCHEMAGEN_DROP_SOURCE_KEY, SCHEMAGEN_DROP_SOURCE_TEST_VALUE); + this.persistenceUnitSetProperty(CREATE_DATABASE_SCHEMAS_KEY, CREATE_DATABASE_SCHEMAS_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(SCRIPTS_CREATE_TARGET_KEY, SCRIPTS_CREATE_TARGET_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(SCRIPTS_DROP_TARGET_KEY, SCRIPTS_DROP_TARGET_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(DATABASE_PRODUCT_NAME_KEY, DATABASE_PRODUCT_NAME_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(DATABASE_MAJOR_VERSION_KEY, DATABASE_MAJOR_VERSION_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(DATABASE_MINOR_VERSION_KEY, DATABASE_MINOR_VERSION_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(CREATE_SCRIPT_SOURCE_KEY, CREATE_SCRIPT_SOURCE_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(DROP_SCRIPT_SOURCE_KEY, DROP_SCRIPT_SOURCE_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(CONNECTION_KEY, CONNECTION_TEST_VALUE.toString()); + this.persistenceUnitSetProperty(SQL_LOAD_SCRIPT_SOURCE_KEY, SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE.toString()); + } + + // ********** SchemaGenDatabaseAction tests ********** + public void testSetSchemaGenDatabaseAction() throws Exception { + this.verifyModelInitialized( + SCHEMAGEN_DATABASE_ACTION_KEY, + SCHEMAGEN_DATABASE_ACTION_TEST_VALUE); + this.verifySetProperty( + SCHEMAGEN_DATABASE_ACTION_KEY, + SCHEMAGEN_DATABASE_ACTION_TEST_VALUE, + SCHEMAGEN_DATABASE_ACTION_TEST_VALUE_2); + } + + public void testAddRemoveSchemaGenDatabaseAction() throws Exception { + this.verifyAddRemoveProperty( + SCHEMAGEN_DATABASE_ACTION_KEY, + SCHEMAGEN_DATABASE_ACTION_TEST_VALUE, + SCHEMAGEN_DATABASE_ACTION_TEST_VALUE_2); + } + + // ********** SchemaGenScriptsAction tests ********** + public void testSetSchemaGenScriptsAction() throws Exception { + this.verifyModelInitialized( + SCHEMAGEN_SCRIPTS_ACTION_KEY, + SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE); + this.verifySetProperty( + SCHEMAGEN_SCRIPTS_ACTION_KEY, + SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE, + SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE_2); + } + + public void testAddRemoveSchemaGenScriptsAction() throws Exception { + this.verifyAddRemoveProperty( + SCHEMAGEN_SCRIPTS_ACTION_KEY, + SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE, + SCHEMAGEN_SCRIPTS_ACTION_TEST_VALUE_2); + } + + // ********** SchemaGenCreateSource tests ********** + public void testSetSchemaGenCreateSource() throws Exception { + this.verifyModelInitialized( + SCHEMAGEN_CREATE_SOURCE_KEY, + SCHEMAGEN_CREATE_SOURCE_TEST_VALUE); + this.verifySetProperty( + SCHEMAGEN_CREATE_SOURCE_KEY, + SCHEMAGEN_CREATE_SOURCE_TEST_VALUE, + SCHEMAGEN_CREATE_SOURCE_TEST_VALUE_2); + } + + public void testAddRemoveSchemaGenCreateSource() throws Exception { + this.verifyAddRemoveProperty( + SCHEMAGEN_CREATE_SOURCE_KEY, + SCHEMAGEN_CREATE_SOURCE_TEST_VALUE, + SCHEMAGEN_CREATE_SOURCE_TEST_VALUE_2); + } + + // ********** SchemaGenDropSource tests ********** + public void testSetSchemaGenDropSource() throws Exception { + this.verifyModelInitialized( + SCHEMAGEN_DROP_SOURCE_KEY, + SCHEMAGEN_DROP_SOURCE_TEST_VALUE); + this.verifySetProperty( + SCHEMAGEN_DROP_SOURCE_KEY, + SCHEMAGEN_DROP_SOURCE_TEST_VALUE, + SCHEMAGEN_DROP_SOURCE_TEST_VALUE_2); + } + + public void testAddRemoveSchemaGenDropSource() throws Exception { + this.verifyAddRemoveProperty( + SCHEMAGEN_DROP_SOURCE_KEY, + SCHEMAGEN_DROP_SOURCE_TEST_VALUE, + SCHEMAGEN_DROP_SOURCE_TEST_VALUE_2); + } + + + // ********** CreateDatabaseSchemas tests ********** + public void testSetCreateDatabaseSchemas() throws Exception { + this.verifyModelInitialized( + CREATE_DATABASE_SCHEMAS_KEY, + CREATE_DATABASE_SCHEMAS_TEST_VALUE); + this.verifySetProperty( + CREATE_DATABASE_SCHEMAS_KEY, + CREATE_DATABASE_SCHEMAS_TEST_VALUE, + CREATE_DATABASE_SCHEMAS_TEST_VALUE_2); + } + + public void testAddRemoveCreateDatabaseSchemas() throws Exception { + this.verifyAddRemoveProperty( + CREATE_DATABASE_SCHEMAS_KEY, + CREATE_DATABASE_SCHEMAS_TEST_VALUE, + CREATE_DATABASE_SCHEMAS_TEST_VALUE_2); + } + + // ********** ScriptsCreateTarget tests ********** + public void testSetScriptsCreateTarget() throws Exception { + this.verifyModelInitialized( + SCRIPTS_CREATE_TARGET_KEY, + SCRIPTS_CREATE_TARGET_TEST_VALUE); + this.verifySetProperty( + SCRIPTS_CREATE_TARGET_KEY, + SCRIPTS_CREATE_TARGET_TEST_VALUE, + SCRIPTS_CREATE_TARGET_TEST_VALUE_2); + } + + public void testAddRemoveScriptsCreateTarget() throws Exception { + this.verifyAddRemoveProperty( + SCRIPTS_CREATE_TARGET_KEY, + SCRIPTS_CREATE_TARGET_TEST_VALUE, + SCRIPTS_CREATE_TARGET_TEST_VALUE_2); + } + + // ********** ScriptsDropTarget tests ********** + public void testSetScriptsDropTarget() throws Exception { + this.verifyModelInitialized( + SCRIPTS_DROP_TARGET_KEY, + SCRIPTS_DROP_TARGET_TEST_VALUE); + this.verifySetProperty( + SCRIPTS_DROP_TARGET_KEY, + SCRIPTS_DROP_TARGET_TEST_VALUE, + SCRIPTS_DROP_TARGET_TEST_VALUE_2); + } + + public void testAddRemoveScriptsDropTarget() throws Exception { + this.verifyAddRemoveProperty( + SCRIPTS_DROP_TARGET_KEY, + SCRIPTS_DROP_TARGET_TEST_VALUE, + SCRIPTS_DROP_TARGET_TEST_VALUE_2); + } + + // ********** DatabaseProductName tests ********** + public void testSetDatabaseProductName() throws Exception { + this.verifyModelInitialized( + DATABASE_PRODUCT_NAME_KEY, + DATABASE_PRODUCT_NAME_TEST_VALUE); + this.verifySetProperty( + DATABASE_PRODUCT_NAME_KEY, + DATABASE_PRODUCT_NAME_TEST_VALUE, + DATABASE_PRODUCT_NAME_TEST_VALUE_2); + } + + public void testAddRemoveDatabaseProductName() throws Exception { + this.verifyAddRemoveProperty( + DATABASE_PRODUCT_NAME_KEY, + DATABASE_PRODUCT_NAME_TEST_VALUE, + DATABASE_PRODUCT_NAME_TEST_VALUE_2); + } + + // ********** DatabaseMajorVersion tests ********** + public void testSetDatabaseMajorVersion() throws Exception { + this.verifyModelInitialized( + DATABASE_MAJOR_VERSION_KEY, + DATABASE_MAJOR_VERSION_TEST_VALUE); + this.verifySetProperty( + DATABASE_MAJOR_VERSION_KEY, + DATABASE_MAJOR_VERSION_TEST_VALUE, + DATABASE_MAJOR_VERSION_TEST_VALUE_2); + } + + public void testAddRemoveDatabaseMajorVersion() throws Exception { + this.verifyAddRemoveProperty( + DATABASE_MAJOR_VERSION_KEY, + DATABASE_MAJOR_VERSION_TEST_VALUE, + DATABASE_MAJOR_VERSION_TEST_VALUE_2); + } + + // ********** DatabaseMinorVersion tests ********** + public void testSetDatabaseMinorVersion() throws Exception { + this.verifyModelInitialized( + DATABASE_MINOR_VERSION_KEY, + DATABASE_MINOR_VERSION_TEST_VALUE); + this.verifySetProperty( + DATABASE_MINOR_VERSION_KEY, + DATABASE_MINOR_VERSION_TEST_VALUE, + DATABASE_MINOR_VERSION_TEST_VALUE_2); + } + + public void testAddRemoveDatabaseMinorVersion() throws Exception { + this.verifyAddRemoveProperty( + DATABASE_MINOR_VERSION_KEY, + DATABASE_MINOR_VERSION_TEST_VALUE, + DATABASE_MINOR_VERSION_TEST_VALUE_2); + } + + // ********** CreateScriptSource tests ********** + public void testSetCreateScriptSource() throws Exception { + this.verifyModelInitialized( + CREATE_SCRIPT_SOURCE_KEY, + CREATE_SCRIPT_SOURCE_TEST_VALUE); + this.verifySetProperty( + CREATE_SCRIPT_SOURCE_KEY, + CREATE_SCRIPT_SOURCE_TEST_VALUE, + CREATE_SCRIPT_SOURCE_TEST_VALUE_2); + } + + public void testAddRemoveCreateScriptSource() throws Exception { + this.verifyAddRemoveProperty( + CREATE_SCRIPT_SOURCE_KEY, + CREATE_SCRIPT_SOURCE_TEST_VALUE, + CREATE_SCRIPT_SOURCE_TEST_VALUE_2); + } + + // ********** DropScriptSource tests ********** + public void testSetDropScriptSource() throws Exception { + this.verifyModelInitialized( + DROP_SCRIPT_SOURCE_KEY, + DROP_SCRIPT_SOURCE_TEST_VALUE); + this.verifySetProperty( + DROP_SCRIPT_SOURCE_KEY, + DROP_SCRIPT_SOURCE_TEST_VALUE, + DROP_SCRIPT_SOURCE_TEST_VALUE_2); + } + + public void testAddRemoveDropScriptSource() throws Exception { + this.verifyAddRemoveProperty( + DROP_SCRIPT_SOURCE_KEY, + DROP_SCRIPT_SOURCE_TEST_VALUE, + DROP_SCRIPT_SOURCE_TEST_VALUE_2); + } + + // ********** Connection tests ********** + public void testSetConnection() throws Exception { + this.verifyModelInitialized( + CONNECTION_KEY, + CONNECTION_TEST_VALUE); + this.verifySetProperty( + CONNECTION_KEY, + CONNECTION_TEST_VALUE, + CONNECTION_TEST_VALUE_2); + } + + public void testAddRemoveConnection() throws Exception { + this.verifyAddRemoveProperty( + CONNECTION_KEY, + CONNECTION_TEST_VALUE, + CONNECTION_TEST_VALUE_2); + } + + // ********** SqlLoadScriptSource tests ********** + public void testSetSqlLoadScriptSource() throws Exception { + this.verifyModelInitialized( + SQL_LOAD_SCRIPT_SOURCE_KEY, + SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE); + this.verifySetProperty( + SQL_LOAD_SCRIPT_SOURCE_KEY, + SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE, + SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE_2); + } + + public void testAddRemoveSqlLoadScriptSource() throws Exception { + this.verifyAddRemoveProperty( + SQL_LOAD_SCRIPT_SOURCE_KEY, + SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE, + SQL_LOAD_SCRIPT_SOURCE_TEST_VALUE_2); + } + + + // ********** get/set property ********** + @Override + protected void setProperty(String propertyName, Object newValue) throws Exception { + if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_DATABASE_ACTION_PROPERTY)) + this.schemaGeneration.setSchemaGenDatabaseAction((SchemaGenerationAction) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_SCRIPTS_ACTION_PROPERTY)) + this.schemaGeneration.setSchemaGenScriptsAction((SchemaGenerationAction) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_CREATE_SOURCE_PROPERTY)) + this.schemaGeneration.setSchemaGenCreateSource((SchemaGenerationTarget) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_DROP_SOURCE_PROPERTY)) + this.schemaGeneration.setSchemaGenDropSource((SchemaGenerationTarget) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.CREATE_DATABASE_SCHEMAS_PROPERTY)) + this.schemaGeneration.setCreateDatabaseSchemas((Boolean) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCRIPTS_CREATE_TARGET_PROPERTY)) + this.schemaGeneration.setScriptsCreateTarget((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCRIPTS_DROP_TARGET_PROPERTY)) + this.schemaGeneration.setScriptsDropTarget((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_PRODUCT_NAME_PROPERTY)) + this.schemaGeneration.setDatabaseProductName((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_MAJOR_VERSION_PROPERTY)) + this.schemaGeneration.setDatabaseMajorVersion((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_MINOR_VERSION_PROPERTY)) + this.schemaGeneration.setDatabaseMinorVersion((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.CREATE_SCRIPT_SOURCE_PROPERTY)) + this.schemaGeneration.setCreateScriptSource((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.DROP_SCRIPT_SOURCE_PROPERTY)) + this.schemaGeneration.setDropScriptSource((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.CONNECTION_PROPERTY)) + this.schemaGeneration.setConnection((String) newValue); + else if (propertyName.equals(JpaSchemaGeneration2_1.SQL_LOAD_SCRIPT_SOURCE_PROPERTY)) + this.schemaGeneration.setSqlLoadScriptSource((String) newValue); + else + this.throwMissingDefinition("setProperty", propertyName); + + } + + @Override + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; + if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_DATABASE_ACTION_PROPERTY)) + modelValue = this.schemaGeneration.getSchemaGenDatabaseAction(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_SCRIPTS_ACTION_PROPERTY)) + modelValue = this.schemaGeneration.getSchemaGenScriptsAction(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_CREATE_SOURCE_PROPERTY)) + modelValue = this.schemaGeneration.getSchemaGenCreateSource(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCHEMAGEN_DROP_SOURCE_PROPERTY)) + modelValue = this.schemaGeneration.getSchemaGenDropSource(); + else if (propertyName.equals(JpaSchemaGeneration2_1.CREATE_DATABASE_SCHEMAS_PROPERTY)) + modelValue = this.schemaGeneration.getCreateDatabaseSchemas(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCRIPTS_CREATE_TARGET_PROPERTY)) + modelValue = this.schemaGeneration.getScriptsCreateTarget(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SCRIPTS_DROP_TARGET_PROPERTY)) + modelValue = this.schemaGeneration.getScriptsDropTarget(); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_PRODUCT_NAME_PROPERTY)) + modelValue = this.schemaGeneration.getDatabaseProductName(); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_MAJOR_VERSION_PROPERTY)) + modelValue = this.schemaGeneration.getDatabaseMajorVersion(); + else if (propertyName.equals(JpaSchemaGeneration2_1.DATABASE_MINOR_VERSION_PROPERTY)) + modelValue = this.schemaGeneration.getDatabaseMinorVersion(); + else if (propertyName.equals(JpaSchemaGeneration2_1.CREATE_SCRIPT_SOURCE_PROPERTY)) + modelValue = this.schemaGeneration.getCreateScriptSource(); + else if (propertyName.equals(JpaSchemaGeneration2_1.DROP_SCRIPT_SOURCE_PROPERTY)) + modelValue = this.schemaGeneration.getDropScriptSource(); + else if (propertyName.equals(JpaSchemaGeneration2_1.CONNECTION_PROPERTY)) + modelValue = this.schemaGeneration.getConnection(); + else if (propertyName.equals(JpaSchemaGeneration2_1.SQL_LOAD_SCRIPT_SOURCE_PROPERTY)) + modelValue = this.schemaGeneration.getSqlLoadScriptSource(); + else + this.throwMissingDefinition("getProperty", propertyName); + return modelValue; + } + + @Override + protected PersistenceUnitProperties getModel() { + return this.schemaGeneration; + } +} diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/PersistenceUnit2_1TestCase.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/PersistenceUnit2_1TestCase.java new file mode 100644 index 0000000000..efbe25a0ae --- /dev/null +++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2_1/context/persistence/PersistenceUnit2_1TestCase.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2013 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.tests.internal.jpa2_1.context.persistence; + +import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.jpa.core.internal.jpa2_1.Generic2_1JpaPlatformFactory; +import org.eclipse.jpt.jpa.core.jpa2_1.JpaProject2_1; +import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.PersistenceUnit2_1; +import org.eclipse.jpt.jpa.core.tests.internal.context.persistence.PersistenceUnitTestCase; + +/** + * PersistenceUnit2_1TestCase + */ +public abstract class PersistenceUnit2_1TestCase + extends PersistenceUnitTestCase +{ + protected PersistenceUnit2_1 subject; + + protected PropertyValueModel<PersistenceUnit2_1> subjectHolder; + + // ********** constructors ********** + protected PersistenceUnit2_1TestCase(String name) { + super(name); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + this.subject = this.getPersistenceUnit(); + this.subjectHolder = new SimplePropertyValueModel<PersistenceUnit2_1>(this.subject); + this.populatePu(); + } + + @Override + protected String getJpaFacetVersionString() { + return JpaProject2_1.FACET_VERSION_STRING; + } + + @Override + protected String getJpaPlatformID() { + return Generic2_1JpaPlatformFactory.ID; + } + + @Override + protected PersistenceUnit2_1 getPersistenceUnit() { + return (PersistenceUnit2_1) super.getPersistenceUnit(); + } +} diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationAdapterTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationAdapterTests.java index 6a666ce545..9e46076d96 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationAdapterTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2013 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. @@ -52,7 +52,7 @@ public class SchemaGenerationAdapterTests extends EclipseLinkPersistenceUnitTest @Override protected void setUp() throws Exception { super.setUp(); - this.schemaGeneration = this.subject.getSchemaGeneration(); + this.schemaGeneration = this.subject.getEclipseLinkSchemaGeneration(); PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener(); this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.OUTPUT_MODE_PROPERTY, propertyChangeListener); diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationBasicAdapterTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationBasicAdapterTests.java index d1cc621642..b9a4fa9892 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationBasicAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationBasicAdapterTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. + * Copyright (c) 2008, 2013 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. @@ -48,7 +48,7 @@ public class SchemaGenerationBasicAdapterTests extends EclipseLinkPersistenceUni protected void setUp() throws Exception { super.setUp(); - this.schemaGeneration = this.subject.getSchemaGeneration(); + this.schemaGeneration = this.subject.getEclipseLinkSchemaGeneration(); PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener(); this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.OUTPUT_MODE_PROPERTY, propertyChangeListener); this.schemaGeneration.addPropertyChangeListener(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY, propertyChangeListener); diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java index 2673eaf563..5324f3d1fe 100644 --- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/SchemaGenerationValueModelTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Oracle. All rights reserved. + * Copyright (c) 2008, 2013 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. @@ -48,7 +48,7 @@ public class SchemaGenerationValueModelTests extends EclipseLinkPersistenceUnitT @Override protected void setUp() throws Exception { super.setUp(); - this.schemaGen = this.subject.getSchemaGeneration(); // Subject + this.schemaGen = this.subject.getEclipseLinkSchemaGeneration(); // Subject this.schemaGenHolder = new SimplePropertyValueModel<SchemaGeneration>(this.schemaGen); this.ddlGenerationTypeHolder = this.buildDdlGenerationTypeAA(this.schemaGenHolder); |