Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 216202 Details for
Bug 380150
Need tolerance for EclipseLink NoSQL support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
changes to support UuidGenerator
380150context.txt (text/plain), 62.22 KB, created by
Karen Butzke
on 2012-05-24 11:52:53 EDT
(
hide
)
Description:
changes to support UuidGenerator
Filename:
MIME Type:
Creator:
Karen Butzke
Created:
2012-05-24 11:52:53 EDT
Size:
62.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.jpa.eclipselink.core >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkGeneratorContainer.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkGeneratorContainer.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkGeneratorContainer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkGeneratorContainer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.context; >+ >+import org.eclipse.jpt.jpa.core.context.GeneratorContainer; >+ >+/** >+ * Container for a table generator and/or sequence generator and/or uuid generator. >+ * Used by entities and ID mappings. >+ * <p> >+ * <strong>NB:</strong> The <code>eclipselink-orm.xml</code> entity mappings element can >+ * hold more than a single uuid generator, so it does not use this >+ * container. >+ * <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. >+ */ >+public interface EclipseLinkGeneratorContainer >+ extends GeneratorContainer >+{ >+ >+ // ********** uuid generator ********** >+ >+ String UUID_GENERATOR_PROPERTY = "uuidGenerator"; //$NON-NLS-1$ >+ >+ UuidGenerator getUuidGenerator(); >+ >+ UuidGenerator addUuidGenerator(); >+ >+ void removeUuidGenerator(); >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/UuidGenerator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/context/UuidGenerator.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/context/UuidGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/UuidGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.context; >+ >+import org.eclipse.jpt.jpa.core.context.Generator; >+ >+/** >+ * uuid generator - corresponds to org.eclipse.persistence.annotations.UuidGenerator >+ * <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. >+ * >+ */ >+//TODO extend JpaNamedContextNode instead, UuidGenerator does not support initialValue and allocationSize >+public interface UuidGenerator >+ extends Generator >+{ >+ >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaUuidGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.context.java; >+ >+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; >+import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+/** >+ * EclipseLink 2.4 Java Uuid generator >+ * <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. >+ */ >+public interface JavaUuidGenerator >+ extends UuidGenerator, JavaJpaContextNode >+{ >+ EclipseLinkUuidGeneratorAnnotation2_4 getGeneratorAnnotation(); >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkEntityMappings.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkEntityMappings.java,v >retrieving revision 1.6 >diff -u -r1.6 EclipseLinkEntityMappings.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkEntityMappings.java 20 Jan 2012 19:34:34 -0000 1.6 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkEntityMappings.java 24 May 2012 15:44:48 -0000 >@@ -101,4 +101,15 @@ > * Return the number of default tenant discriminator columns. > */ > int getDefaultTenantDiscriminatorColumnsSize(); >+ >+ >+ ListIterable<OrmUuidGenerator> getUuidGenerators(); >+ int getUuidGeneratorsSize(); >+ OrmUuidGenerator addUuidGenerator(); >+ OrmUuidGenerator addUuidGenerator(int index); >+ void removeUuidGenerator(int index); >+ void removeUuidGenerator(OrmUuidGenerator uuidGenerator); >+ void moveUuidGenerator(int targetIndex, int sourceIndex); >+ String UUID_GENERATORS_LIST = "uuidGenerators"; //$NON-NLS-1$ >+ > } >Index: src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmUuidGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.context.orm; >+ >+import org.eclipse.jpt.jpa.core.context.XmlContextNode; >+import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2_4; >+ >+/** >+ * <code>eclipselink-orm.xml</code> 2.4 uuid generator >+ * <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. >+ */ >+public interface OrmUuidGenerator >+ extends UuidGenerator, XmlContextNode >+{ >+ XmlUuidGenerator_2_4 getXmlGenerator(); >+ >+ //********* metadata conversion ********* >+ >+ /** >+ * Build up a mapping file generator from the given Java generator. >+ */ >+ void convertFrom(JavaUuidGenerator javaGenerator); >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaAnnotationDefinitionProvider.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaAnnotationDefinitionProvider.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaAnnotationDefinitionProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaAnnotationDefinitionProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,119 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal; >+ >+import java.util.ArrayList; >+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; >+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; >+import org.eclipse.jpt.common.utility.internal.CollectionTools; >+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; >+import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkArray2_3AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicCollectionAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkBasicMapAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCacheAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkChangeTrackingAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkClassExtractor2_1AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConvertAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverterAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkConverters2_2AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkCustomizerAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkExistenceCheckingAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkJoinFetchAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMultitenant2_3AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkMutableAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverterAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkObjectTypeConverters2_2AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrimaryKeyAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkPrivateOwnedAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadOnlyAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkReadTransformerAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverterAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructConverters2_2AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkStructure2_3AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTransformationAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverterAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkTypeConverters2_2AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkUuidGenerator2_4AnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkVariableOneToOneAnnotationDefinition; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.EclipseLinkWriteTransformerAnnotationDefinition; >+ >+/** >+ * Provides annotations for 2.4 EclipseLink platform >+ */ >+public class EclipseLink2_4JpaAnnotationDefinitionProvider >+ extends AbstractJpaAnnotationDefinitionProvider >+{ >+ // singleton >+ private static final JpaAnnotationDefinitionProvider INSTANCE = new EclipseLink2_4JpaAnnotationDefinitionProvider(); >+ >+ /** >+ * Return the singleton >+ */ >+ public static JpaAnnotationDefinitionProvider instance() { >+ return INSTANCE; >+ } >+ >+ /** >+ * Enforce singleton usage >+ */ >+ private EclipseLink2_4JpaAnnotationDefinitionProvider() { >+ super(); >+ } >+ >+ @Override >+ protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) { >+ CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS); >+ } >+ >+ protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { >+ EclipseLinkArray2_3AnnotationDefinition.instance(), >+ EclipseLinkBasicCollectionAnnotationDefinition.instance(), >+ EclipseLinkBasicMapAnnotationDefinition.instance(), >+ EclipseLinkCacheAnnotationDefinition.instance(), >+ EclipseLinkChangeTrackingAnnotationDefinition.instance(), >+ EclipseLinkClassExtractor2_1AnnotationDefinition.instance(), >+ EclipseLinkConvertAnnotationDefinition.instance(), >+ EclipseLinkConverters2_2AnnotationDefinition.instance(), >+ EclipseLinkCustomizerAnnotationDefinition.instance(), >+ EclipseLinkExistenceCheckingAnnotationDefinition.instance(), >+ EclipseLinkJoinFetchAnnotationDefinition.instance(), >+ EclipseLinkMultitenant2_3AnnotationDefinition.instance(), >+ EclipseLinkMutableAnnotationDefinition.instance(), >+ EclipseLinkObjectTypeConverters2_2AnnotationDefinition.instance(), >+ EclipseLinkPrimaryKeyAnnotationDefinition.instance(), >+ EclipseLinkPrivateOwnedAnnotationDefinition.instance(), >+ EclipseLinkReadOnlyAnnotationDefinition.instance(), >+ EclipseLinkReadTransformerAnnotationDefinition.instance(), >+ EclipseLinkStructConverters2_2AnnotationDefinition.instance(), >+ EclipseLinkStructure2_3AnnotationDefinition.instance(), >+ EclipseLinkTenantDiscriminatorColumns2_3AnnotationDefinition.instance(), >+ EclipseLinkTransformationAnnotationDefinition.instance(), >+ EclipseLinkTypeConverters2_2AnnotationDefinition.instance(), >+ EclipseLinkUuidGenerator2_4AnnotationDefinition.instance(), >+ EclipseLinkVariableOneToOneAnnotationDefinition.instance(), >+ EclipseLinkWriteTransformerAnnotationDefinition.instance() >+ }; >+ >+ @Override >+ protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) { >+ CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS); >+ } >+ >+ protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] { >+ EclipseLinkConverterAnnotationDefinition.instance(), >+ EclipseLinkObjectTypeConverterAnnotationDefinition.instance(), >+ EclipseLinkStructConverterAnnotationDefinition.instance(), >+ EclipseLinkTenantDiscriminatorColumn2_3AnnotationDefinition.instance(), >+ EclipseLinkTypeConverterAnnotationDefinition.instance(), >+ }; >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaFactory.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaFactory.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal; >+ >+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; >+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer.ParentAdapter; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkGeneratorContainer; >+ >+/** >+ * EclipseLink 2.4 factory >+ */ >+public class EclipseLink2_4JpaFactory >+ extends EclipseLink2_0JpaFactory >+{ >+ public EclipseLink2_4JpaFactory() { >+ super(); >+ } >+ >+ @Override >+ public JavaGeneratorContainer buildJavaGeneratorContainer(ParentAdapter parentAdapter) { >+ return new JavaEclipseLinkGeneratorContainer(parentAdapter); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java,v >retrieving revision 1.4 >diff -u -r1.4 EclipseLink2_4JpaPlatformFactory.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java 27 Jan 2012 21:54:31 -0000 1.4 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java 24 May 2012 15:44:49 -0000 >@@ -38,7 +38,7 @@ > return new GenericJpaPlatform( > id, > buildJpaVersion(), >- new EclipseLink2_0JpaFactory(), >+ new EclipseLink2_4JpaFactory(), > buildAnnotationProvider(), > EclipseLink2_4JpaPlatformProvider.instance(), > buildJpaVariation(), >@@ -56,7 +56,7 @@ > protected AnnotationProvider buildAnnotationProvider() { > return new JpaAnnotationProvider( > Generic2_0JpaAnnotationDefinitionProvider.instance(), >- EclipseLink2_3JpaAnnotationDefinitionProvider.instance()); >+ EclipseLink2_4JpaAnnotationDefinitionProvider.instance()); > } > > @Override >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkGeneratorContainer.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkGeneratorContainer.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkGeneratorContainer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkGeneratorContainer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,140 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; >+ >+import org.eclipse.jdt.core.dom.CompilationUnit; >+import org.eclipse.jpt.common.utility.Filter; >+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; >+import org.eclipse.jpt.jpa.core.context.Generator; >+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratorContainer; >+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkGeneratorContainer; >+import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+public class JavaEclipseLinkGeneratorContainer >+ extends GenericJavaGeneratorContainer >+ implements EclipseLinkGeneratorContainer >+{ >+ protected JavaUuidGenerator uuidGenerator; >+ >+ >+ public JavaEclipseLinkGeneratorContainer(ParentAdapter parentAdapter) { >+ super(parentAdapter); >+ this.uuidGenerator = this.buildUuidGenerator(); >+ } >+ >+ >+ // ********** synchronize/update ********** >+ >+ @Override >+ public void synchronizeWithResourceModel() { >+ super.synchronizeWithResourceModel(); >+ this.syncUuidGenerator(); >+ } >+ >+ @Override >+ public void update() { >+ super.update(); >+ if (this.uuidGenerator != null) { >+ this.uuidGenerator.update(); >+ } >+ } >+ >+ >+ // ********** Uuid generator ********** >+ >+ public JavaUuidGenerator getUuidGenerator() { >+ return this.uuidGenerator; >+ } >+ >+ public JavaUuidGenerator addUuidGenerator() { >+ if (this.uuidGenerator != null) { >+ throw new IllegalStateException("UUID generator already exists: " + this.uuidGenerator); //$NON-NLS-1$ >+ } >+ EclipseLinkUuidGeneratorAnnotation2_4 annotation = this.buildUuidGeneratorAnnotation(); >+ JavaUuidGenerator generator = this.buildUuidGenerator(annotation); >+ this.setUuidGenerator(generator); >+ return generator; >+ } >+ >+ protected EclipseLinkUuidGeneratorAnnotation2_4 buildUuidGeneratorAnnotation() { >+ return (EclipseLinkUuidGeneratorAnnotation2_4) this.parentAdapter.getResourceAnnotatedElement().addAnnotation(EclipseLinkUuidGeneratorAnnotation2_4.ANNOTATION_NAME); >+ } >+ >+ public void removeUuidGenerator() { >+ if (this.uuidGenerator == null) { >+ throw new IllegalStateException("UUID generator does not exist"); //$NON-NLS-1$ >+ } >+ this.parentAdapter.getResourceAnnotatedElement().removeAnnotation(EclipseLinkUuidGeneratorAnnotation2_4.ANNOTATION_NAME); >+ this.setUuidGenerator(null); >+ } >+ >+ protected JavaUuidGenerator buildUuidGenerator() { >+ EclipseLinkUuidGeneratorAnnotation2_4 annotation = this.getUuidGeneratorAnnotation(); >+ return (annotation == null) ? null : this.buildUuidGenerator(annotation); >+ } >+ >+ protected EclipseLinkUuidGeneratorAnnotation2_4 getUuidGeneratorAnnotation() { >+ return (EclipseLinkUuidGeneratorAnnotation2_4) this.parentAdapter.getResourceAnnotatedElement().getAnnotation(EclipseLinkUuidGeneratorAnnotation2_4.ANNOTATION_NAME); >+ } >+ >+ protected JavaUuidGenerator buildUuidGenerator(EclipseLinkUuidGeneratorAnnotation2_4 uuidGeneratorAnnotation) { >+ return this.parentAdapter.parentSupportsGenerators() ? >+ new JavaEclipseLinkUuidGenerator(this, uuidGeneratorAnnotation) : >+ null; >+ } >+ >+ protected void syncUuidGenerator() { >+ EclipseLinkUuidGeneratorAnnotation2_4 annotation = this.getUuidGeneratorAnnotation(); >+ if (annotation == null) { >+ if (this.uuidGenerator != null) { >+ this.setUuidGenerator(null); >+ } >+ } else { >+ if ((this.uuidGenerator != null) && (this.uuidGenerator.getGeneratorAnnotation() == annotation)) { >+ this.uuidGenerator.synchronizeWithResourceModel(); >+ } else { >+ this.setUuidGenerator(this.buildUuidGenerator(annotation)); >+ } >+ } >+ } >+ >+ protected void setUuidGenerator(JavaUuidGenerator uuidGenerator) { >+ JavaUuidGenerator old = this.uuidGenerator; >+ this.uuidGenerator = uuidGenerator; >+ this.firePropertyChanged(UUID_GENERATOR_PROPERTY, old, uuidGenerator); >+ } >+ >+ >+ // ********** code completion ********** >+ >+ @Override >+ public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { >+ Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot); >+ if (result != null) { >+ return result; >+ } >+ if (this.uuidGenerator != null) { >+ result = this.uuidGenerator.getJavaCompletionProposals(pos, filter, astRoot); >+ if (result != null) { >+ return result; >+ } >+ } >+ return null; >+ } >+ >+ >+ // ********** misc ********** >+ >+ @Override >+ protected Iterable<Generator> getGenerators_() { >+ return new ArrayIterable<Generator>(this.sequenceGenerator, this.tableGenerator, this.uuidGenerator); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkUuidGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; >+ >+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; >+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; >+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+/** >+ * Java UUID generator >+ */ >+public class JavaEclipseLinkUuidGenerator >+ extends AbstractJavaGenerator<EclipseLinkUuidGeneratorAnnotation2_4> >+ implements JavaUuidGenerator >+{ >+ >+ >+ public JavaEclipseLinkUuidGenerator(JavaGeneratorContainer parent, EclipseLinkUuidGeneratorAnnotation2_4 generatorAnnotation) { >+ super(parent, generatorAnnotation); >+ } >+ >+ >+ // ********** initial value ********** >+ >+ @Override >+ protected int buildDefaultInitialValue() { >+ return 0; >+ } >+ >+ >+ // ********** misc ********** >+ >+ public Class<UuidGenerator> getType() { >+ return UuidGenerator.class; >+ } >+ >+ @Override >+ public JavaEclipseLinkGeneratorContainer getParent() { >+ return (JavaEclipseLinkGeneratorContainer) super.getParent(); >+ } >+ >+ // ********** metadata conversion ********** >+ >+ public void convertTo(EntityMappings entityMappings) { >+ ((EclipseLinkEntityMappings) entityMappings).addUuidGenerator().convertFrom(this); >+ } >+ >+ public void delete() { >+ this.getParent().removeUuidGenerator(); >+ } >+ >+ @Override >+ protected String getSchema() { >+ throw new UnsupportedOperationException(); >+ } >+ >+ @Override >+ protected String getCatalog() { >+ throw new UnsupportedOperationException(); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 EclipseLinkEntityMappingsImpl.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java 2 Feb 2012 16:33:53 -0000 1.9 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java 24 May 2012 15:44:51 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper; > import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; > import org.eclipse.jpt.jpa.core.context.DiscriminatorType; >+import org.eclipse.jpt.jpa.core.context.Generator; > import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; > import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; > import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; >@@ -38,13 +39,16 @@ > import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer; > import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmReadOnlyTenantDiscriminatorColumn2_3; > import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmTenantDiscriminatorColumn2_3; >+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmUuidGenerator; > import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscriminatorColumn2_3; > import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; > import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; > import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods; > import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings; > import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlUuidGenerator; > import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2_4; > import org.eclipse.text.edits.ReplaceEdit; > import org.eclipse.wst.validation.internal.provisional.core.IMessage; > import org.eclipse.wst.validation.internal.provisional.core.IReporter; >@@ -69,6 +73,7 @@ > protected String specifiedSetMethod; > protected String defaultSetMethod; > >+ protected final ContextListContainer<OrmUuidGenerator, XmlUuidGenerator_2_4> uuidGeneratorContainer; > > public EclipseLinkEntityMappingsImpl(OrmXml parent, XmlEntityMappings resource) { > super(parent, resource); >@@ -78,6 +83,7 @@ > this.defaultTenantDiscriminatorColumnContainer = this.buildDefaultTenantDiscriminatorColumnContainer(); > this.specifiedGetMethod = this.buildSpecifiedGetMethod(); > this.specifiedSetMethod = this.buildSpecifiedSetMethod(); >+ this.uuidGeneratorContainer = this.buildUuidGeneratorContainer(); > } > > >@@ -90,6 +96,7 @@ > this.syncSpecifiedTenantDiscriminatorColumns(); > this.setSpecifiedGetMethod_(this.buildSpecifiedGetMethod()); > this.setSpecifiedSetMethod_(this.buildSpecifiedSetMethod()); >+ this.syncUuidGenerators(); > } > > @Override >@@ -100,6 +107,7 @@ > this.updateDefaultTenantDiscriminatorColumns(); > this.setDefaultGetMethod(this.buildDefaultGetMethod()); > this.setDefaultSetMethod(this.buildDefaultSetMethod()); >+ this.updateNodes(this.getUuidGenerators()); > } > > @Override >@@ -547,6 +555,97 @@ > } > > >+ // ********** uuid generators ********** >+ >+ public ListIterable<OrmUuidGenerator> getUuidGenerators() { >+ return this.uuidGeneratorContainer.getContextElements(); >+ } >+ >+ public int getUuidGeneratorsSize() { >+ return this.uuidGeneratorContainer.getContextElementsSize(); >+ } >+ >+ public OrmUuidGenerator addUuidGenerator() { >+ return this.addUuidGenerator(this.getUuidGeneratorsSize()); >+ } >+ >+ public OrmUuidGenerator addUuidGenerator(int index) { >+ XmlUuidGenerator xmlGenerator = this.buildXmlUuidGenerator(); >+ OrmUuidGenerator uuidGenerator = this.uuidGeneratorContainer.addContextElement(index, xmlGenerator); >+ this.getXmlEntityMappings().getUuidGenerators().add(index, xmlGenerator); >+ return uuidGenerator; >+ } >+ >+ protected XmlUuidGenerator buildXmlUuidGenerator() { >+ return EclipseLinkOrmFactory.eINSTANCE.createXmlUuidGenerator(); >+ } >+ >+ protected OrmUuidGenerator buildUuidGenerator(XmlUuidGenerator_2_4 xmlUuidGenerator) { >+ return new OrmEclipseLinkUuidGenerator(this, xmlUuidGenerator); >+ } >+ >+ public void removeUuidGenerator(OrmUuidGenerator uuidGenerator) { >+ this.removeUuidGenerator(this.uuidGeneratorContainer.indexOfContextElement(uuidGenerator)); >+ } >+ >+ public void removeUuidGenerator(int index) { >+ this.uuidGeneratorContainer.removeContextElement(index); >+ this.getXmlEntityMappings().getUuidGenerators().remove(index); >+ } >+ >+ public void moveUuidGenerator(int targetIndex, int sourceIndex) { >+ this.sequenceGeneratorContainer.moveContextElement(targetIndex, sourceIndex); >+ this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex); >+ } >+ >+ protected void syncUuidGenerators() { >+ this.uuidGeneratorContainer.synchronizeWithResourceModel(); >+ } >+ >+ protected ListIterable<XmlUuidGenerator_2_4> getXmlUuidGenerators() { >+ // clone to reduce chance of concurrency problems >+ return new LiveCloneListIterable<XmlUuidGenerator_2_4>(this.getXmlEntityMappings().getUuidGenerators()); >+ } >+ >+ protected ContextListContainer<OrmUuidGenerator, XmlUuidGenerator_2_4> buildUuidGeneratorContainer() { >+ UuidGeneratorContainer container = new UuidGeneratorContainer(); >+ container.initialize(); >+ return container; >+ } >+ >+ /** >+ * sequence generator container >+ */ >+ protected class UuidGeneratorContainer >+ extends ContextListContainer<OrmUuidGenerator, XmlUuidGenerator_2_4> >+ { >+ @Override >+ protected String getContextElementsPropertyName() { >+ return UUID_GENERATORS_LIST; >+ } >+ @Override >+ protected OrmUuidGenerator buildContextElement(XmlUuidGenerator_2_4 resourceElement) { >+ return EclipseLinkEntityMappingsImpl.this.buildUuidGenerator(resourceElement); >+ } >+ @Override >+ protected ListIterable<XmlUuidGenerator_2_4> getResourceElements() { >+ return EclipseLinkEntityMappingsImpl.this.getXmlUuidGenerators(); >+ } >+ @Override >+ protected XmlUuidGenerator_2_4 getResourceElement(OrmUuidGenerator contextElement) { >+ return contextElement.getXmlGenerator(); >+ } >+ } >+ >+ @Override >+ @SuppressWarnings("unchecked") >+ public Iterable<Generator> getMappingFileGenerators() { >+ return new CompositeIterable<Generator>( >+ super.getMappingFileGenerators(), >+ this.getUuidGenerators() >+ ); >+ } >+ > // ********** misc ********** > > @Override >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4ContextNodeFactory.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4ContextNodeFactory.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4ContextNodeFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4ContextNodeFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; >+ >+import org.eclipse.jpt.jpa.core.context.XmlContextNode; >+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; >+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlGeneratorContainer2_4; >+ >+public class EclipseLinkOrmXml2_4ContextNodeFactory >+ extends EclipseLinkOrmXml2_3ContextNodeFactory >+{ >+ >+ @Override >+ public OrmGeneratorContainer buildOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer) { >+ return new OrmEclipseLinkGeneratorContainer(parent, (XmlGeneratorContainer2_4) resourceGeneratorContainer); >+ } >+ >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java,v >retrieving revision 1.2 >diff -u -r1.2 EclipseLinkOrmXml2_4Definition.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java 15 Dec 2011 19:37:43 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java 24 May 2012 15:44:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2011 Oracle. All rights reserved. >+ * Copyright (c) 2011, 2012 Oracle. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0, which accompanies this distribution > * and is available at http://www.eclipse.org/legal/epl-v10.html >@@ -47,7 +47,7 @@ > > @Override > protected OrmXmlContextNodeFactory buildContextNodeFactory() { >- return EclipseLinkOrmXml2_3Definition.instance().getContextNodeFactory(); >+ return new EclipseLinkOrmXml2_4ContextNodeFactory(); > } > > @Override >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkGeneratorContainer.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkGeneratorContainer.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkGeneratorContainer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkGeneratorContainer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,145 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; >+ >+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; >+import org.eclipse.jpt.jpa.core.context.Generator; >+import org.eclipse.jpt.jpa.core.context.XmlContextNode; >+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer; >+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkGeneratorContainer; >+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlGeneratorContainer2_4; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2_4; >+ >+public class OrmEclipseLinkGeneratorContainer >+ extends GenericOrmGeneratorContainer >+ implements EclipseLinkGeneratorContainer >+{ >+ >+ protected OrmUuidGenerator uuidGenerator; >+ >+ >+ public OrmEclipseLinkGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer2_4 xmlGeneratorContainer) { >+ super(parent, xmlGeneratorContainer); >+ this.uuidGenerator = this.buildUuidGenerator(); >+ } >+ >+ protected XmlGeneratorContainer2_4 getXmlGeneratorContainer() { >+ return (XmlGeneratorContainer2_4) this.xmlGeneratorContainer; >+ } >+ >+ >+ // ********** synchronize/update ********** >+ >+ @Override >+ public void synchronizeWithResourceModel() { >+ super.synchronizeWithResourceModel(); >+ this.syncUuidGenerator(); >+ } >+ >+ @Override >+ public void update() { >+ super.update(); >+ if (this.uuidGenerator != null) { >+ this.uuidGenerator.update(); >+ } >+ } >+ >+ >+ // ********** uuid generator ********** >+ >+ public OrmUuidGenerator getUuidGenerator() { >+ return this.uuidGenerator; >+ } >+ >+ public OrmUuidGenerator addUuidGenerator() { >+ if (this.uuidGenerator != null) { >+ throw new IllegalStateException("uuid generator already exists: " + this.uuidGenerator); //$NON-NLS-1$ >+ } >+ XmlUuidGenerator xmlGenerator = this.buildXmlUuidGenerator(); >+ OrmUuidGenerator generator = this.buildUuidGenerator(xmlGenerator); >+ this.setUuidGenerator_(generator); >+ this.getXmlGeneratorContainer().setUuidGenerator(xmlGenerator); >+ return generator; >+ } >+ >+ protected XmlUuidGenerator buildXmlUuidGenerator() { >+ return EclipseLinkOrmFactory.eINSTANCE.createXmlUuidGenerator(); >+ } >+ >+ public void removeUuidGenerator() { >+ if (this.uuidGenerator == null) { >+ throw new IllegalStateException("uuid generator does not exist"); //$NON-NLS-1$ >+ } >+ this.setUuidGenerator_(null); >+ this.getXmlGeneratorContainer().setUuidGenerator(null); >+ } >+ >+ protected OrmUuidGenerator buildUuidGenerator() { >+ XmlUuidGenerator_2_4 xmlGenerator = this.getXmlUuidGenerator(); >+ return (xmlGenerator == null) ? null : this.buildUuidGenerator(xmlGenerator); >+ } >+ >+ protected XmlUuidGenerator_2_4 getXmlUuidGenerator() { >+ return this.getXmlGeneratorContainer().getUuidGenerator(); >+ } >+ >+ protected OrmUuidGenerator buildUuidGenerator(XmlUuidGenerator_2_4 xmlUuidGenerator) { >+ return new OrmEclipseLinkUuidGenerator(this, xmlUuidGenerator); >+ } >+ >+ protected void syncUuidGenerator() { >+ XmlUuidGenerator_2_4 xmlGenerator = this.getXmlUuidGenerator(); >+ if (xmlGenerator == null) { >+ if (this.uuidGenerator != null) { >+ this.setUuidGenerator_(null); >+ } >+ } else { >+ if ((this.uuidGenerator != null) && (this.uuidGenerator.getXmlGenerator() == xmlGenerator)) { >+ this.uuidGenerator.synchronizeWithResourceModel(); >+ } else { >+ this.setUuidGenerator_(this.buildUuidGenerator(xmlGenerator)); >+ } >+ } >+ } >+ >+ protected void setUuidGenerator_(OrmUuidGenerator uuidGenerator) { >+ OrmUuidGenerator old = this.uuidGenerator; >+ this.uuidGenerator = uuidGenerator; >+ this.firePropertyChanged(UUID_GENERATOR_PROPERTY, old, uuidGenerator); >+ } >+ >+ >+ // ********** completion proposals ********** >+ >+ @Override >+ public Iterable<String> getXmlCompletionProposals(int pos) { >+ Iterable<String> result = super.getXmlCompletionProposals(pos); >+ if (result != null) { >+ return result; >+ } >+ if (this.uuidGenerator != null) { >+ result = this.uuidGenerator.getXmlCompletionProposals(pos); >+ if (result != null) { >+ return result; >+ } >+ } >+ return null; >+ } >+ >+ // ********** misc ********** >+ >+ @Override >+ protected Iterable<Generator> getGenerators_() { >+ return new ArrayIterable<Generator>(this.sequenceGenerator, this.tableGenerator, this.uuidGenerator); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkUuidGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; >+ >+import org.eclipse.jpt.jpa.core.context.XmlContextNode; >+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.UuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmUuidGenerator; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.XmlUuidGenerator_2_4; >+ >+/** >+ * <code>eclipselink-orm.xml</code> uuid generator >+ */ >+public class OrmEclipseLinkUuidGenerator >+ extends AbstractOrmGenerator<XmlUuidGenerator_2_4> >+ implements OrmUuidGenerator >+{ >+ >+ >+ public OrmEclipseLinkUuidGenerator(XmlContextNode parent, XmlUuidGenerator_2_4 xmlSequenceGenerator) { >+ super(parent, xmlSequenceGenerator); >+ } >+ >+ // ********** metadata conversion ********** >+ >+ public void convertFrom(JavaUuidGenerator javaGenerator) { >+ this.setName(javaGenerator.getName()); >+ } >+ >+ // ********** misc ********** >+ >+ public Class<UuidGenerator> getType() { >+ return UuidGenerator.class; >+ } >+ >+ //TODO remove these methods after refactoring UuidGenerator to extend JpaNamedContextNode >+ @Override >+ protected int buildDefaultInitialValue() { >+ return 0; >+ } >+ @Override >+ protected String getSchema() { >+ return null; >+ } >+ @Override >+ protected String getCatalog() { >+ return null; >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkUuidGenerator2_4AnnotationDefinition.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkUuidGenerator2_4AnnotationDefinition.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkUuidGenerator2_4AnnotationDefinition.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkUuidGenerator2_4AnnotationDefinition.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. >+ * All rights reserved. This program and the accompanying materials are >+ * made available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java; >+ >+import org.eclipse.jdt.core.IAnnotation; >+import org.eclipse.jpt.common.core.resource.java.Annotation; >+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; >+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; >+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary.BinaryEclipseLinkUuidGeneratorAnnotation2_4; >+import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source.SourceEclipseLinkUuidGeneratorAnnotation2_4; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+public class EclipseLinkUuidGenerator2_4AnnotationDefinition >+ implements AnnotationDefinition >+{ >+ // singleton >+ private static final AnnotationDefinition INSTANCE = new EclipseLinkUuidGenerator2_4AnnotationDefinition(); >+ >+ /** >+ * Return the singleton. >+ */ >+ public static AnnotationDefinition instance() { >+ return INSTANCE; >+ } >+ >+ /** >+ * Ensure single instance. >+ */ >+ protected EclipseLinkUuidGenerator2_4AnnotationDefinition() { >+ super(); >+ } >+ >+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { >+ return new SourceEclipseLinkUuidGeneratorAnnotation2_4(parent, annotatedElement); >+ } >+ >+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { >+ throw new UnsupportedOperationException(); >+ } >+ >+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { >+ return new BinaryEclipseLinkUuidGeneratorAnnotation2_4(parent, jdtAnnotation); >+ } >+ >+ public String getAnnotationName() { >+ return EclipseLinkUuidGeneratorAnnotation2_4.ANNOTATION_NAME; >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkUuidGeneratorAnnotation2_4.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. >+ * All rights reserved. This program and the accompanying materials are >+ * made available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary; >+ >+import org.eclipse.jdt.core.IAnnotation; >+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; >+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; >+import org.eclipse.jpt.common.core.utility.TextRange; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+/** >+ * org.eclipse.persistence.annotations.Multitenant >+ */ >+public class BinaryEclipseLinkUuidGeneratorAnnotation2_4 >+ extends BinaryAnnotation >+ implements EclipseLinkUuidGeneratorAnnotation2_4 >+{ >+ private String name; >+ >+ >+ public BinaryEclipseLinkUuidGeneratorAnnotation2_4(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { >+ super(parent, jdtAnnotation); >+ this.name = this.buildName(); >+ } >+ >+ public String getAnnotationName() { >+ return ANNOTATION_NAME; >+ } >+ >+ @Override >+ public void update() { >+ super.update(); >+ this.setName_(this.buildName()); >+ } >+ >+ >+ // ********** EclipseLinkMultitenantAnnotation implementation ********** >+ >+ // ***** name >+ public String getName() { >+ return this.name; >+ } >+ >+ public void setName(String name) { >+ throw new UnsupportedOperationException(); >+ } >+ >+ private void setName_(String name) { >+ String old = this.name; >+ this.name = name; >+ this.firePropertyChanged(NAME_PROPERTY, old, name); >+ } >+ >+ private String buildName() { >+ return (String) this.getJdtMemberValue(EclipseLink.UUID_GENERATOR__NAME); >+ } >+ >+ public TextRange getNameTextRange() { >+ throw new UnsupportedOperationException(); >+ } >+ >+ >+ public Integer getInitialValue() { >+ return null; >+ } >+ public void setInitialValue(Integer initialValue) { >+ throw new UnsupportedOperationException(); >+ } >+ public TextRange getInitialValueTextRange() { >+ throw new UnsupportedOperationException(); >+ } >+ public Integer getAllocationSize() { >+ return null; >+ } >+ public void setAllocationSize(Integer allocationSize) { >+ throw new UnsupportedOperationException(); >+ } >+ public TextRange getAllocationSizeTextRange() { >+ throw new UnsupportedOperationException(); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkUuidGeneratorAnnotation2_4.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,136 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. >+ * All rights reserved. This program and the accompanying materials are >+ * made available under the terms of the Eclipse Public License v1.0 which >+ * accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source; >+ >+import org.eclipse.jdt.core.dom.CompilationUnit; >+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; >+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; >+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; >+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; >+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; >+import org.eclipse.jpt.common.core.utility.TextRange; >+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; >+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; >+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; >+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; >+import org.eclipse.jpt.jpa.core.resource.java.JPA; >+import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkUuidGeneratorAnnotation2_4; >+ >+/** >+ * org.eclipse.persistence.annotations.UuidGenerator >+ */ >+public class SourceEclipseLinkUuidGeneratorAnnotation2_4 >+ extends SourceAnnotation >+ implements EclipseLinkUuidGeneratorAnnotation2_4 >+{ >+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER >+ = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); >+ >+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__NAME); >+ final AnnotationElementAdapter<String> nameAdapter; >+ String name; >+ TextRange nameTextRange; >+ >+ public SourceEclipseLinkUuidGeneratorAnnotation2_4(JavaResourceAnnotatedElement parent, AnnotatedElement element) { >+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER); >+ this.nameAdapter = this.buildAdapter(NAME_ADAPTER); >+ } >+ >+ protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) { >+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); >+ } >+ >+ public String getAnnotationName() { >+ return ANNOTATION_NAME; >+ } >+ >+ public void initialize(CompilationUnit astRoot) { >+ this.name = this.buildName(astRoot); >+ this.nameTextRange = this.buildNameTextRange(astRoot); >+ } >+ >+ public void synchronizeWith(CompilationUnit astRoot) { >+ this.syncName(this.buildName(astRoot)); >+ this.nameTextRange = this.buildNameTextRange(astRoot); >+ } >+ >+ @Override >+ public boolean isUnset() { >+ return super.isUnset() && >+ (this.name == null); >+ } >+ >+ @Override >+ public void toString(StringBuilder sb) { >+ sb.append(this.name); >+ } >+ >+ // ***** name >+ public String getName() { >+ return this.name; >+ } >+ >+ public void setName(String name) { >+ if (this.attributeValueHasChanged(this.name, name)) { >+ this.name = name; >+ this.nameAdapter.setValue(name); >+ } >+ } >+ >+ private void syncName(String astName) { >+ String old = this.name; >+ this.name = astName; >+ this.firePropertyChanged(NAME_PROPERTY, old, astName); >+ } >+ >+ private String buildName(CompilationUnit astRoot) { >+ return this.nameAdapter.getValue(astRoot); >+ } >+ >+ public TextRange getNameTextRange() { >+ return this.nameTextRange; >+ } >+ >+ private TextRange buildNameTextRange(CompilationUnit astRoot) { >+ return this.getElementTextRange(NAME_ADAPTER, astRoot); >+ } >+ >+ >+ // ********** static methods ********** >+ >+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) { >+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName); >+ } >+ >+ static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { >+ return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName); >+ } >+ >+ >+ public Integer getInitialValue() { >+ return null; >+ } >+ public void setInitialValue(Integer initialValue) { >+ throw new UnsupportedOperationException(); >+ } >+ public TextRange getInitialValueTextRange() { >+ throw new UnsupportedOperationException(); >+ } >+ public Integer getAllocationSize() { >+ return null; >+ } >+ public void setAllocationSize(Integer allocationSize) { >+ throw new UnsupportedOperationException(); >+ } >+ public TextRange getAllocationSizeTextRange() { >+ throw new UnsupportedOperationException(); >+ } >+} >Index: src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLink.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLink.java,v >retrieving revision 1.4 >diff -u -r1.4 EclipseLink.java >--- src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLink.java 15 Dec 2011 19:37:43 -0000 1.4 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLink.java 24 May 2012 15:44:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2011 Oracle. All rights reserved. >+ * Copyright (c) 2008, 2012 Oracle. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0, which accompanies this distribution > * and is available at http://www.eclipse.org/legal/epl-v10.html. >@@ -193,5 +193,6 @@ > > // EclispeLink 2.4 annotations > String MULTITENANT__INCLUDE_CRITERIA = "includeCriteria"; >- >+ String UUID_GENERATOR = PACKAGE_ + "UuidGenerator"; >+ String UUID_GENERATOR__NAME = "name"; > } >Index: src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkUuidGeneratorAnnotation2_4.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkUuidGeneratorAnnotation2_4.java >diff -N src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkUuidGeneratorAnnotation2_4.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkUuidGeneratorAnnotation2_4.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0, which accompanies this distribution >+ * and is available at http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jpt.jpa.eclipselink.core.resource.java; >+ >+import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation; >+ >+/** >+ * Corresponds to the EclipseLink annotation >+ * <code>org.eclipse.persistence.annotations.UuidGenerator</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. >+ */ >+public interface EclipseLinkUuidGeneratorAnnotation2_4 >+ extends GeneratorAnnotation //TODO don't extend GeneratorAnnotation >+{ >+ String ANNOTATION_NAME = EclipseLink.UUID_GENERATOR; >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 380150
:
216171
|
216196
|
216199
|
216200
| 216202 |
216208