diff options
author | kmoore | 2011-09-14 19:39:22 +0000 |
---|---|---|
committer | kmoore | 2011-09-14 19:39:22 +0000 |
commit | c6bc026796fdec03e6aad46ff9a5a020221c57fe (patch) | |
tree | 94db61f4687056cff98573c56711c26d817c1330 /jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core | |
parent | 5a615b3a7837e1d722325c4824c3688eb567fdc3 (diff) | |
download | webtools.dali-c6bc026796fdec03e6aad46ff9a5a020221c57fe.tar.gz webtools.dali-c6bc026796fdec03e6aad46ff9a5a020221c57fe.tar.xz webtools.dali-c6bc026796fdec03e6aad46ff9a5a020221c57fe.zip |
354013 - partial single-table multitenancy support - supporting specified multitenancy and tenant discriminator columns, no virtuals yet
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core')
41 files changed, 2705 insertions, 217 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java index 46ad68cb7c..ff3826bfb6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java @@ -17,6 +17,8 @@ import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.content.IContentType; import org.eclipse.jpt.common.core.JptResourceType; +import org.eclipse.jpt.jpa.core.JpaNode; +import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLink; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2; @@ -133,7 +135,14 @@ public class JptJpaEclipseLinkCorePlugin extends Plugin public static JptJpaEclipseLinkCorePlugin instance() { return INSTANCE; } - + + + // ********** public static methods ********** + + public static boolean nodeIsEclipseLink2_3Compatible(JpaNode jpaNode) { + return ((EclipseLinkVersion) jpaNode.getJpaProject().getJpaPlatform().getJpaVersion()).isCompatibleWithVersion(ECLIPSELINK_PLATFORM_VERSION_2_3); + } + /** * Log the specified message. */ diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkNonEmbeddableTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkNonEmbeddableTypeMapping.java index b489b3c166..b3f8a6270a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkNonEmbeddableTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkNonEmbeddableTypeMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -9,6 +9,8 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.context; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenancy; + /** * EclipseLink non-embeddable type mapping * <p> @@ -24,4 +26,6 @@ public interface EclipseLinkNonEmbeddableTypeMapping EclipseLinkCaching getCaching(); EclipseLinkReadOnly getReadOnly(); + + EclipseLinkMultitenancy getMultitenancy(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkNonEmbeddableTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkNonEmbeddableTypeMapping.java index a88d3c6dac..c26087bcba 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkNonEmbeddableTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkNonEmbeddableTypeMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -10,6 +10,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.context.java; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; /** * EclipseLink Java non-embeddable type mapping @@ -24,4 +25,6 @@ public interface JavaEclipseLinkNonEmbeddableTypeMapping extends EclipseLinkNonEmbeddableTypeMapping, EclipseLinkJavaTypeMapping { JavaEclipseLinkCaching getCaching(); + + JavaEclipseLinkMultitenancy getMultitenancy(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkNonEmbeddableTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkNonEmbeddableTypeMapping.java index e46aeb15e8..d9217485b4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkNonEmbeddableTypeMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkNonEmbeddableTypeMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.context.orm; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkNonEmbeddableTypeMapping; import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmEclipseLinkMultitenancy; /** * EclipseLink <code>orm.xml</code> non-embeddable type mapping @@ -29,4 +30,6 @@ public interface OrmEclipseLinkNonEmbeddableTypeMapping JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMapping(); JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMappingForDefaults(); + + OrmEclipseLinkMultitenancy getMultitenancy(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java index 18c80ec350..5b510eebc0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java @@ -9,6 +9,7 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.internal; +import java.util.Comparator; import org.eclipse.jpt.common.core.AnnotationProvider; import org.eclipse.jpt.jpa.core.JpaFacet; import org.eclipse.jpt.jpa.core.JpaPlatform; @@ -19,6 +20,7 @@ import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider; import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion; import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; +import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator; /** * All the state in the JPA platform should be "static" (i.e. unchanging once @@ -70,6 +72,8 @@ public class EclipseLinkJpaPlatformFactory public static class EclipseLinkVersion extends SimpleVersion { + public static final Comparator<String> VERSION_COMPARATOR = new DefaultVersionComparator(); + protected final String eclipseLinkVersion; public EclipseLinkVersion(String eclipseLinkVersion, String jpaVersion) { @@ -81,6 +85,20 @@ public class EclipseLinkJpaPlatformFactory public String getVersion() { return this.eclipseLinkVersion; } + + /** + * Return whether the platform is compatible with the specified EclipseLink version. + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_0 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_1 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_2 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_0 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_1 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_2 + * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_3 + */ + public boolean isCompatibleWithVersion(String version) { + return VERSION_COMPARATOR.compare(this.eclipseLinkVersion, version) >= 0; + } @Override public String toString() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java index 772a11b2d2..76553b3f08 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java @@ -86,4 +86,9 @@ public interface EclipseLinkJpaValidationMessages { public static final String TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC = "TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC"; + public static final String TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME"; + public static final String TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID = "TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID"; + public static final String MULTIENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS = "MULTIENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS"; + public static final String MULTIENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY = "MULTIENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY"; + } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java index 2a9e0d4a04..e072c38335 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.utility.Filter; import org.eclipse.jpt.common.utility.internal.NotNullFilter; import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; @@ -22,6 +23,7 @@ import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; @@ -31,8 +33,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverte import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java.JavaEclipseLinkMultitenancyImpl; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java.NullJavaEclipseLinkMultitenancy; import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; import org.eclipse.jpt.jpa.eclipselink.core.v2_1.resource.java.EclipseLinkClassExtractorAnnotation2_1; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -54,6 +59,7 @@ public class JavaEclipseLinkEntityImpl protected final JavaEclipseLinkCustomizer customizer; + protected final JavaEclipseLinkMultitenancy multitenancy; public JavaEclipseLinkEntityImpl(JavaPersistentType parent, EntityAnnotation mappingAnnotation) { super(parent, mappingAnnotation); @@ -62,6 +68,7 @@ public class JavaEclipseLinkEntityImpl this.converterContainer = this.buildConverterContainer(); this.changeTracking = this.buildChangeTracking(); this.customizer = this.buildCustomizer(); + this.multitenancy = this.buildMultitenancy(); } @@ -75,6 +82,7 @@ public class JavaEclipseLinkEntityImpl this.converterContainer.synchronizeWithResourceModel(); this.changeTracking.synchronizeWithResourceModel(); this.customizer.synchronizeWithResourceModel(); + this.multitenancy.synchronizeWithResourceModel(); } @Override @@ -85,6 +93,7 @@ public class JavaEclipseLinkEntityImpl this.converterContainer.update(); this.changeTracking.update(); this.customizer.update(); + this.multitenancy.update(); } @@ -159,6 +168,23 @@ public class JavaEclipseLinkEntityImpl } + // ********** multitenancy ********** + + public JavaEclipseLinkMultitenancy getMultitenancy() { + return this.multitenancy; + } + + protected JavaEclipseLinkMultitenancy buildMultitenancy() { + return this.isEclipseLink2_3Compatible() ? + new JavaEclipseLinkMultitenancyImpl(this) : + new NullJavaEclipseLinkMultitenancy(this); + } + + protected boolean isEclipseLink2_3Compatible() { + return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); + } + + // ********** discriminator column ********** @Override @@ -190,6 +216,22 @@ public class JavaEclipseLinkEntityImpl } + // ********** Java completion proposals ********** + + @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; + } + result = this.multitenancy.getJavaCompletionProposals(pos, filter, astRoot); + if (result != null) { + return result; + } + return null; + } + + // ********** validation ********** @Override @@ -200,6 +242,7 @@ public class JavaEclipseLinkEntityImpl this.converterContainer.validate(messages, reporter, astRoot); this.changeTracking.validate(messages, reporter, astRoot); this.customizer.validate(messages, reporter, astRoot); + this.multitenancy.validate(messages, reporter, astRoot); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java index 28d6f3d5d9..ab85cdbbb5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java @@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.utility.Filter; import org.eclipse.jpt.common.utility.internal.NotNullFilter; import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; @@ -23,6 +24,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; +import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; @@ -32,7 +34,10 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverte import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java.JavaEclipseLinkMultitenancyImpl; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java.NullJavaEclipseLinkMultitenancy; import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -54,6 +59,7 @@ public class JavaEclipseLinkMappedSuperclassImpl protected final JavaEclipseLinkCustomizer customizer; + protected final JavaEclipseLinkMultitenancy multitenancy; public JavaEclipseLinkMappedSuperclassImpl(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) { super(parent, mappingAnnotation); @@ -62,6 +68,7 @@ public class JavaEclipseLinkMappedSuperclassImpl this.converterContainer = this.buildConverterContainer(); this.changeTracking = this.buildChangeTracking(); this.customizer = this.buildCustomizer(); + this.multitenancy = this.buildMultitenancy(); } @@ -75,6 +82,7 @@ public class JavaEclipseLinkMappedSuperclassImpl this.converterContainer.synchronizeWithResourceModel(); this.changeTracking.synchronizeWithResourceModel(); this.customizer.synchronizeWithResourceModel(); + this.multitenancy.synchronizeWithResourceModel(); } @Override @@ -85,6 +93,7 @@ public class JavaEclipseLinkMappedSuperclassImpl this.converterContainer.update(); this.changeTracking.update(); this.customizer.update(); + this.multitenancy.update(); } @@ -159,6 +168,24 @@ public class JavaEclipseLinkMappedSuperclassImpl } + // ********** multitenancy ********** + + public JavaEclipseLinkMultitenancy getMultitenancy() { + return this.multitenancy; + } + + + protected JavaEclipseLinkMultitenancy buildMultitenancy() { + return this.isEclipseLink2_3Compatible() ? + new JavaEclipseLinkMultitenancyImpl(this) : + new NullJavaEclipseLinkMultitenancy(this); + } + + protected boolean isEclipseLink2_3Compatible() { + return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); + } + + // ********** misc ********** public boolean usesPrimaryKeyColumns() { @@ -174,6 +201,21 @@ public class JavaEclipseLinkMappedSuperclassImpl } + // ********** Java completion proposals ********** + + @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; + } + result = this.multitenancy.getJavaCompletionProposals(pos, filter, astRoot); + if (result != null) { + return result; + } + return null; + } + // ********** validation ********** @Override @@ -184,6 +226,7 @@ public class JavaEclipseLinkMappedSuperclassImpl this.converterContainer.validate(messages, reporter, astRoot); this.changeTracking.validate(messages, reporter, astRoot); this.customizer.validate(messages, reporter, astRoot); + this.multitenancy.validate(messages, reporter, astRoot); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java index 1da8146ede..e08fa1a24c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java @@ -28,6 +28,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; +import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; @@ -37,8 +38,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterC import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEntity; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm.NullOrmEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm.OrmEclipseLinkMultitenancyImpl; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntity; import org.eclipse.jpt.jpa.eclipselink.core.v2_1.resource.java.EclipseLinkClassExtractorAnnotation2_1; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmEclipseLinkMultitenancy; import org.eclipse.text.edits.ReplaceEdit; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -61,6 +65,8 @@ public class OrmEclipseLinkEntityImpl protected final OrmEclipseLinkConverterContainer converterContainer; + protected final OrmEclipseLinkMultitenancy multitenancy; + public OrmEclipseLinkEntityImpl(OrmPersistentType parent, XmlEntity xmlEntity) { super(parent, xmlEntity); @@ -69,6 +75,7 @@ public class OrmEclipseLinkEntityImpl this.converterContainer = this.buildConverterContainer(); this.changeTracking = this.buildChangeTracking(); this.customizer = this.buildCustomizer(); + this.multitenancy = this.buildMultitenancy(); } @@ -82,6 +89,7 @@ public class OrmEclipseLinkEntityImpl this.converterContainer.synchronizeWithResourceModel(); this.changeTracking.synchronizeWithResourceModel(); this.customizer.synchronizeWithResourceModel(); + this.multitenancy.synchronizeWithResourceModel(); } @Override @@ -92,6 +100,7 @@ public class OrmEclipseLinkEntityImpl this.converterContainer.update(); this.changeTracking.update(); this.customizer.update(); + this.multitenancy.update(); } @@ -166,6 +175,23 @@ public class OrmEclipseLinkEntityImpl } + // ********** multitenancy ********** + + public OrmEclipseLinkMultitenancy getMultitenancy() { + return this.multitenancy; + } + + protected OrmEclipseLinkMultitenancy buildMultitenancy() { + return this.isEclipseLink2_3Compatible() ? + new OrmEclipseLinkMultitenancyImpl(this) : + new NullOrmEclipseLinkMultitenancy(this); + } + + protected boolean isEclipseLink2_3Compatible() { + return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); + } + + // ********** misc ********** @Override @@ -338,6 +364,7 @@ public class OrmEclipseLinkEntityImpl this.converterContainer.validate(messages, reporter); this.changeTracking.validate(messages, reporter); this.customizer.validate(messages, reporter); + this.multitenancy.validate(messages, reporter); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java index cb24dbe591..ae52d44158 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java @@ -23,6 +23,7 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; +import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter; import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer; @@ -32,7 +33,10 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterC import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMappedSuperclass; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator; import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm.NullOrmEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm.OrmEclipseLinkMultitenancyImpl; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMappedSuperclass; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmEclipseLinkMultitenancy; import org.eclipse.text.edits.ReplaceEdit; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.wst.validation.internal.provisional.core.IReporter; @@ -55,6 +59,8 @@ public class OrmEclipseLinkMappedSuperclassImpl protected final OrmEclipseLinkConverterContainer converterContainer; + protected final OrmEclipseLinkMultitenancy multitenancy; + public OrmEclipseLinkMappedSuperclassImpl(OrmPersistentType parent, XmlMappedSuperclass xmlMappedSuperclass) { super(parent, xmlMappedSuperclass); @@ -63,6 +69,7 @@ public class OrmEclipseLinkMappedSuperclassImpl this.converterContainer = this.buildConverterContainer(); this.changeTracking = this.buildChangeTracking(); this.customizer = this.buildCustomizer(); + this.multitenancy = this.buildMultitenancy(); } @@ -76,6 +83,7 @@ public class OrmEclipseLinkMappedSuperclassImpl this.converterContainer.synchronizeWithResourceModel(); this.changeTracking.synchronizeWithResourceModel(); this.customizer.synchronizeWithResourceModel(); + this.multitenancy.synchronizeWithResourceModel(); } @Override @@ -86,6 +94,7 @@ public class OrmEclipseLinkMappedSuperclassImpl this.converterContainer.update(); this.changeTracking.update(); this.customizer.update(); + this.multitenancy.update(); } @@ -160,6 +169,24 @@ public class OrmEclipseLinkMappedSuperclassImpl } + // ********** multitenancy ********** + + public OrmEclipseLinkMultitenancy getMultitenancy() { + return this.multitenancy; + } + + + protected OrmEclipseLinkMultitenancy buildMultitenancy() { + return this.isEclipseLink2_3Compatible() ? + new OrmEclipseLinkMultitenancyImpl(this) : + new NullOrmEclipseLinkMultitenancy(this); + } + + protected boolean isEclipseLink2_3Compatible() { + return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this); + } + + // ********** misc ********** @Override @@ -267,6 +294,7 @@ public class OrmEclipseLinkMappedSuperclassImpl this.converterContainer.validate(messages, reporter); this.changeTracking.validate(messages, reporter); this.customizer.validate(messages, reporter); + this.multitenancy.validate(messages, reporter); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/TenantDiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/TenantDiscriminatorColumnValidator.java new file mode 100644 index 0000000000..561aff9eb5 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/TenantDiscriminatorColumnValidator.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context; + +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; +import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; +import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; + +public class TenantDiscriminatorColumnValidator + extends AbstractNamedColumnValidator<ReadOnlyNamedColumn, NamedColumnTextRangeResolver> +{ + public TenantDiscriminatorColumnValidator( + ReadOnlyNamedColumn namedColumn, + NamedColumnTextRangeResolver textRangeResolver) { + super(namedColumn, textRangeResolver, new EntityTableDescriptionProvider()); + } + + @Override + protected JptValidator buildTableValidator() { + return new TableValidator(); + } + + @Override + protected IMessage buildUnresolvedNameMessage(String message) { + return DefaultEclipseLinkJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + message, + new String[] { + this.column.getName(), + this.column.getDbTable().getName() + }, + this.column, + this.textRangeResolver.getNameTextRange() + ); + } + + @Override + protected String getUnresolvedNameMessage() { + return EclipseLinkJpaValidationMessages.TENANT_DISCRIMINATOR_COLUMN_UNRESOLVED_NAME; + } + + @Override + protected String getVirtualAttributeUnresolvedNameMessage() { + throw new UnsupportedOperationException(); + } + + + // ********** table validator ********** + + protected class TableValidator + extends BaseColumnTableValidator + { + protected TableValidator() { + super(); + } + + @Override + protected IMessage buildTableNotValidMessage_() { + return DefaultEclipseLinkJpaValidationMessages.buildMessage( + IMessage.HIGH_SEVERITY, + this.getColumnTableNotValidMessage(), + new String[] { + this.getColumn().getTable(), + this.getColumn().getName(), + this.getColumnTableDescriptionMessage() + }, + this.getColumn(), + this.getTextRangeResolver().getTableTextRange() + ); + } + + @Override + protected String getColumnTableNotValidMessage() { + return EclipseLinkJpaValidationMessages.TENANT_DISCRIMINATOR_COLUMN_TABLE_NOT_VALID; + } + + @Override + protected String getVirtualAttributeColumnTableNotValidMessage() { + throw new UnsupportedOperationException(); + } + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/EclipseLinkJavaTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/EclipseLinkJavaTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..273db2634e --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/EclipseLinkJavaTenantDiscriminatorColumn.java @@ -0,0 +1,281 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0, which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java; + +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.core.resource.java.JavaResourceType; +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.utility.Filter; +import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; +import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; +import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; +import org.eclipse.jpt.jpa.core.internal.context.java.JavaTableColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.AbstractJavaNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation; + +/** + * Java tenant discriminator column + */ +public class EclipseLinkJavaTenantDiscriminatorColumn + extends AbstractJavaNamedDiscriminatorColumn<EclipseLinkTenantDiscriminatorColumnAnnotation, JavaReadOnlyTenantDiscriminatorColumn.Owner> + implements JavaTenantDiscriminatorColumn +{ + /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */ + protected /* final */ EclipseLinkTenantDiscriminatorColumnAnnotation columnAnnotation; // never null + + protected String specifiedTable; + protected String defaultTable; + + protected String specifiedContextProperty; + protected String defaultContextProperty; + + protected Boolean specifiedPrimaryKey; + protected boolean defaultPrimaryKey; + + public EclipseLinkJavaTenantDiscriminatorColumn(JavaEclipseLinkMultitenancyImpl parent, JavaReadOnlyTenantDiscriminatorColumn.Owner owner, EclipseLinkTenantDiscriminatorColumnAnnotation columnAnnotation) { + super(parent, owner, columnAnnotation); + this.specifiedTable = this.buildSpecifiedTable(); + this.specifiedContextProperty = this.buildSpecifiedContextProperty(); + this.specifiedPrimaryKey = this.buildSpecifiedPrimaryKey(); + } + + + // ********** synchronize/update ********** + + @Override + public void synchronizeWithResourceModel() { + super.synchronizeWithResourceModel(); + this.setSpecifiedTable_(this.buildSpecifiedTable()); + this.setSpecifiedContextProperty_(this.buildSpecifiedContextProperty()); + this.setSpecifiedPrimaryKey_(this.buildSpecifiedPrimaryKey()); + } + + @Override + public void update() { + super.update(); + this.setDefaultTable(this.buildDefaultTable()); + this.setDefaultContextProperty(this.buildDefaultContextProperty()); + this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); + } + + // ********** column annotation ********** + + @Override + public EclipseLinkTenantDiscriminatorColumnAnnotation getColumnAnnotation() { + return this.columnAnnotation; + } + + @Override + protected void setColumnAnnotation(EclipseLinkTenantDiscriminatorColumnAnnotation columnAnnotation) { + this.columnAnnotation = columnAnnotation; + } + + @Override + protected void removeColumnAnnotation() { + // we don't remove a tenant discriminator column annotation when it is empty + } + + + // ********** table ********** + + @Override + public String getTable() { + return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; + } + + public String getSpecifiedTable() { + return this.specifiedTable; + } + + public void setSpecifiedTable(String table) { + if (this.valuesAreDifferent(this.specifiedTable, table)) { + this.getColumnAnnotation().setTable(table); + this.removeColumnAnnotationIfUnset(); + this.setSpecifiedTable_(table); + } + } + + protected void setSpecifiedTable_(String table) { + String old = this.specifiedTable; + this.specifiedTable = table; + this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); + } + + protected String buildSpecifiedTable() { + return this.getColumnAnnotation().getTable(); + } + + public String getDefaultTable() { + return this.defaultTable; + } + + protected void setDefaultTable(String table) { + String old = this.defaultTable; + this.defaultTable = table; + this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); + } + + protected String buildDefaultTable() { + return this.owner.getDefaultTableName(); + } + + public TextRange getTableTextRange(CompilationUnit astRoot) { + return this.getValidationTextRange(this.getColumnAnnotation().getTableTextRange(astRoot), astRoot); + } + + + // ********** contextProperty ********** + + public String getContextProperty() { + return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; + } + + public String getSpecifiedContextProperty() { + return this.specifiedContextProperty; + } + + public void setSpecifiedContextProperty(String contextProperty) { + if (this.valuesAreDifferent(this.specifiedContextProperty, contextProperty)) { + this.getColumnAnnotation().setContextProperty(contextProperty); + this.removeColumnAnnotationIfUnset(); + this.setSpecifiedContextProperty_(contextProperty); + } + } + + protected void setSpecifiedContextProperty_(String contextProperty) { + String old = this.specifiedContextProperty; + this.specifiedContextProperty = contextProperty; + this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); + } + + protected String buildSpecifiedContextProperty() { + return this.getColumnAnnotation().getContextProperty(); + } + + public String getDefaultContextProperty() { + return this.defaultContextProperty; + } + + protected void setDefaultContextProperty(String contextProperty) { + String old = this.defaultContextProperty; + this.defaultContextProperty = contextProperty; + this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); + } + + protected String buildDefaultContextProperty() { + return this.owner.getDefaultContextPropertyName(); + } + + public TextRange getContextPropertyTextRange(CompilationUnit astRoot) { + return this.getValidationTextRange(this.getColumnAnnotation().getContextPropertyTextRange(astRoot), astRoot); + } + + + // ********** primaryKey ********** + + public boolean isPrimaryKey() { + return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.isDefaultPrimaryKey(); + } + + public Boolean getSpecifiedPrimaryKey() { + return this.specifiedPrimaryKey; + } + + public void setSpecifiedPrimaryKey(Boolean primaryKey) { + if (this.valuesAreDifferent(this.specifiedPrimaryKey, primaryKey)) { + this.getColumnAnnotation().setPrimaryKey(primaryKey); + this.removeColumnAnnotationIfUnset(); + this.setSpecifiedPrimaryKey_(primaryKey); + } + } + + protected void setSpecifiedPrimaryKey_(Boolean primaryKey) { + Boolean old = this.specifiedPrimaryKey; + this.specifiedPrimaryKey = primaryKey; + this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); + } + + protected Boolean buildSpecifiedPrimaryKey() { + return this.getColumnAnnotation().getPrimaryKey(); + } + + public boolean isDefaultPrimaryKey() { + return this.defaultPrimaryKey; + } + + protected void setDefaultPrimaryKey(boolean primaryKey) { + boolean old = this.defaultPrimaryKey; + this.defaultPrimaryKey = primaryKey; + this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, primaryKey); + } + + protected boolean buildDefaultPrimaryKey() { + return DEFAULT_PRIMARY_KEY; + } + + + // ********** misc ********** + + @Override + public JavaEclipseLinkMultitenancyImpl getParent() { + return (JavaEclipseLinkMultitenancyImpl) super.getParent(); + } + + protected JavaResourceType getJavaResourceType() { + return this.getParent().getJavaResourceType(); + } + + + // ********** Java completion proposals ********** + + @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.tableTouches(pos, astRoot)) { + return this.getJavaCandidateTableNames(filter); + } + return null; + } + + protected boolean tableTouches(int pos, CompilationUnit astRoot) { + return this.getColumnAnnotation().tableTouches(pos, astRoot); + } + + protected Iterable<String> getJavaCandidateTableNames(Filter<String> filter) { + return StringTools.convertToJavaStringLiterals(this.getCandidateTableNames(filter)); + } + + protected Iterable<String> getCandidateTableNames(Filter<String> filter) { + return new FilteringIterable<String>(this.getCandidateTableNames(), filter); + } + + public Iterable<String> getCandidateTableNames() { + return this.owner.getCandidateTableNames(); + } + + + // ********** validation ********** + + public boolean tableNameIsInvalid() { + return this.owner.tableNameIsInvalid(this.getTable()); + } + + @Override + protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { + return new JavaTableColumnTextRangeResolver(this, astRoot); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/JavaEclipseLinkMultitenancyImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/JavaEclipseLinkMultitenancyImpl.java new file mode 100644 index 0000000000..b6a8d88182 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/JavaEclipseLinkMultitenancyImpl.java @@ -0,0 +1,410 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java; + +import java.util.List; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.core.resource.java.JavaResourceType; +import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.utility.Filter; +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper; +import org.eclipse.jpt.jpa.core.context.DiscriminatorType; +import org.eclipse.jpt.jpa.core.context.InheritanceType; +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; +import org.eclipse.jpt.jpa.db.Table; +import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; +import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.TenantDiscriminatorColumnValidator; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenantType; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.ReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.EclipseLinkMultitenantAnnotation; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; +import org.eclipse.wst.validation.internal.provisional.core.IReporter; + +public class JavaEclipseLinkMultitenancyImpl + extends AbstractJavaJpaContextNode + implements JavaEclipseLinkMultitenancy +{ + protected EclipseLinkMultitenantType specifiedType; + protected EclipseLinkMultitenantType defaultType; + + protected Boolean specifiedIncludeCriteria; + + protected final JavaReadOnlyTenantDiscriminatorColumn.Owner tenantDiscriminatorColumnOwner; + protected final ContextListContainer<JavaTenantDiscriminatorColumn, EclipseLinkTenantDiscriminatorColumnAnnotation> specifiedTenantDiscriminatorColumnContainer; + + public JavaEclipseLinkMultitenancyImpl(JavaEclipseLinkNonEmbeddableTypeMapping parent) { + super(parent); + + EclipseLinkMultitenantAnnotation multitenantAnnotation = this.getMultitenantAnnotation(); + this.specifiedType = EclipseLinkMultitenantType.fromJavaResourceModel(multitenantAnnotation.getValue()); + this.specifiedIncludeCriteria = multitenantAnnotation.getIncludeCriteria(); + this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); + this.specifiedTenantDiscriminatorColumnContainer = this.buildSpecifiedTenantDiscriminatorColumnContainer(); + } + + + // ********** synchronize/update ********** + + @Override + public void synchronizeWithResourceModel() { + super.synchronizeWithResourceModel(); + + EclipseLinkMultitenantAnnotation multitenantAnnotation = this.getMultitenantAnnotation(); + this.setSpecifiedType_(EclipseLinkMultitenantType.fromJavaResourceModel(multitenantAnnotation.getValue())); + this.setSpecifiedIncludeCriteria_(multitenantAnnotation.getIncludeCriteria()); + this.syncSpecifiedTenantDiscriminatorColumns(); + } + + @Override + public void update() { + super.update(); + this.updateNodes(this.getSpecifiedTenantDiscriminatorColumns()); + this.setDefaultType(isMultitenant() ? DEFAULT_TYPE : null); + } + + + // ********** type ********** + + public EclipseLinkMultitenantType getType() { + return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); + } + + public EclipseLinkMultitenantType getSpecifiedType() { + return this.specifiedType; + } + + public void setSpecifiedType(EclipseLinkMultitenantType type) { + this.getMultitenantAnnotation().setValue(EclipseLinkMultitenantType.toJavaResourceModel(type)); + this.setSpecifiedType_(type); + } + + protected void setSpecifiedType_(EclipseLinkMultitenantType type) { + EclipseLinkMultitenantType old = this.specifiedType; + this.specifiedType = type; + this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); + } + + public EclipseLinkMultitenantType getDefaultType() { + return this.defaultType; + } + + protected void setDefaultType(EclipseLinkMultitenantType type) { + EclipseLinkMultitenantType old = this.defaultType; + this.defaultType = type; + this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); + } + + + // ********** include criteria ********** + + public boolean isIncludeCriteria() { + return (this.specifiedIncludeCriteria != null) ? this.specifiedIncludeCriteria.booleanValue() : this.isDefaultIncludeCriteria(); + } + + public Boolean getSpecifiedIncludeCriteria() { + return this.specifiedIncludeCriteria; + } + + public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { + this.getMultitenantAnnotation().setIncludeCriteria(includeCriteria); + this.setSpecifiedIncludeCriteria_(includeCriteria); + } + + protected void setSpecifiedIncludeCriteria_(Boolean includeCriteria) { + Boolean old = this.specifiedIncludeCriteria; + this.specifiedIncludeCriteria = includeCriteria; + this.firePropertyChanged(SPECIFIED_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); + } + + public boolean isDefaultIncludeCriteria() { + return DEFAULT_INCLUDE_CRITERIA; + } + + + // ********** tenant discriminator columns ********** + + public ListIterable<JavaTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns() { + return this.specifiedTenantDiscriminatorColumnContainer.getContextElements(); + } + + public int getSpecifiedTenantDiscriminatorColumnsSize() { + return this.specifiedTenantDiscriminatorColumnContainer.getContextElementsSize(); + } + + public JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn() { + return this.addSpecifiedTenantDiscriminatorColumn(this.getSpecifiedTenantDiscriminatorColumnsSize()); + } + + public JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index) { + EclipseLinkTenantDiscriminatorColumnAnnotation annotation = this.addTenantDiscriminatorColumnAnnotation(index); + return this.specifiedTenantDiscriminatorColumnContainer.addContextElement(index, annotation); + } + + public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn tenantDiscriminatorColumn) { + this.removeSpecifiedTenantDiscriminatorColumn(this.specifiedTenantDiscriminatorColumnContainer.indexOfContextElement((JavaTenantDiscriminatorColumn) tenantDiscriminatorColumn)); + } + + public void removeSpecifiedTenantDiscriminatorColumn(int index) { + this.removeTenantDiscriminatorColumnAnnotation(index); + this.specifiedTenantDiscriminatorColumnContainer.removeContextElement(index); + } + + public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { + this.moveTenantDiscriminatorColumnAnnotation(targetIndex, sourceIndex); + this.specifiedTenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); + } + + protected JavaTenantDiscriminatorColumn buildTenantDiscriminatorColumn(EclipseLinkTenantDiscriminatorColumnAnnotation discriminatorColumnAnnotation) { + return new EclipseLinkJavaTenantDiscriminatorColumn(this, this.tenantDiscriminatorColumnOwner, discriminatorColumnAnnotation); + } + + protected void syncSpecifiedTenantDiscriminatorColumns() { + this.specifiedTenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); + } + + protected ContextListContainer<JavaTenantDiscriminatorColumn, EclipseLinkTenantDiscriminatorColumnAnnotation> buildSpecifiedTenantDiscriminatorColumnContainer() { + return new SpecifiedTenantDiscriminatorColumnContainer(); + } + + protected JavaReadOnlyTenantDiscriminatorColumn.Owner buildTenantDiscriminatorColumnOwner() { + return new TenantDiscriminatorColumnOwner(); + } + + /** + * specified tenant discriminator column container + */ + protected class SpecifiedTenantDiscriminatorColumnContainer + extends ContextListContainer<JavaTenantDiscriminatorColumn, EclipseLinkTenantDiscriminatorColumnAnnotation> + { + @Override + protected String getContextElementsPropertyName() { + return SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST; + } + @Override + protected JavaTenantDiscriminatorColumn buildContextElement(EclipseLinkTenantDiscriminatorColumnAnnotation resourceElement) { + return JavaEclipseLinkMultitenancyImpl.this.buildTenantDiscriminatorColumn(resourceElement); + } + @Override + protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation> getResourceElements() { + return JavaEclipseLinkMultitenancyImpl.this.getTenantDiscriminatorColumnAnnotations(); + } + @Override + protected EclipseLinkTenantDiscriminatorColumnAnnotation getResourceElement(JavaTenantDiscriminatorColumn contextElement) { + return contextElement.getColumnAnnotation(); + } + } + + + // ********** JavaReadOnlyTenantDiscriminatorColumn.Owner implementation ********** + + protected class TenantDiscriminatorColumnOwner + implements JavaReadOnlyTenantDiscriminatorColumn.Owner + { + + public String getDefaultContextPropertyName() { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_CONTEXT_PROPERTY; + } + + public boolean getDefaultPrimaryKey() { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_PRIMARY_KEY; + } + + public int getDefaultLength() { + return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; + } + + public DiscriminatorType getDefaultDiscriminatorType() { + return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; + } + + public String getDefaultTableName() { + return getTypeMapping().getPrimaryTableName(); + } + + public String getDefaultColumnName(ReadOnlyNamedColumn column) { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_NAME; + } + + public Table resolveDbTable(String tableName) { + return getTypeMapping().resolveDbTable(tableName); + } + + public Iterable<String> getCandidateTableNames() { + return getTypeMapping().getAllAssociatedTableNames(); + } + + public boolean tableNameIsInvalid(String tableName) { + return getTypeMapping().tableNameIsInvalid(tableName); + } + + public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { + return new TenantDiscriminatorColumnValidator(column, textRangeResolver); + } + + public TextRange getValidationTextRange(CompilationUnit astRoot) { + return JavaEclipseLinkMultitenancyImpl.this.getValidationTextRange(astRoot); + } + } + + + // ********** multitenant annotation ********** + + protected EclipseLinkMultitenantAnnotation getMultitenantAnnotation() { + return (EclipseLinkMultitenantAnnotation) this.getJavaResourceType().getNonNullAnnotation(this.getMultitenantAnnotationName()); + } + + protected TextRange getMultitenantAnnotationTextRange(CompilationUnit astRoot) { + return getMultitenantAnnotation().getTextRange(astRoot); + } + + public boolean isMultitenantAnnotationSpecified() { + return this.getMultitenantAnnotation().isSpecified(); + } + + protected String getMultitenantAnnotationName() { + return EclipseLinkMultitenantAnnotation.ANNOTATION_NAME; + } + + public boolean isMultitenant() { + return isMultitenantAnnotationSpecified(); + } + + + // ********** tenant discriminator column annotations ********** + + protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation> getTenantDiscriminatorColumnAnnotations() { + return this.getTenantDiscriminatorColumnAnnotations_(); + } + + protected ListIterable<EclipseLinkTenantDiscriminatorColumnAnnotation> getTenantDiscriminatorColumnAnnotations_() { + return new SubListIterableWrapper<NestableAnnotation, EclipseLinkTenantDiscriminatorColumnAnnotation>(this.getNestableTenantDiscriminatorColumnAnnotations_()); + } + + protected ListIterable<NestableAnnotation> getNestableTenantDiscriminatorColumnAnnotations_() { + return this.getJavaResourceType().getAnnotations(EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME); + } + + protected EclipseLinkTenantDiscriminatorColumnAnnotation addTenantDiscriminatorColumnAnnotation(int index) { + return (EclipseLinkTenantDiscriminatorColumnAnnotation) this.getJavaResourceType().addAnnotation(index, EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME); + } + + protected void removeTenantDiscriminatorColumnAnnotation(int index) { + this.getJavaResourceType().removeAnnotation(index, EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME); + } + + protected void moveTenantDiscriminatorColumnAnnotation(int targetIndex, int sourceIndex) { + this.getJavaResourceType().moveAnnotation(targetIndex, sourceIndex, EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME); + } + + + // ********** misc ********** + + @Override + public JavaEclipseLinkNonEmbeddableTypeMapping getParent() { + return (JavaEclipseLinkNonEmbeddableTypeMapping) super.getParent(); + } + + protected JavaEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { + return this.getParent(); + } + + protected JavaPersistentType getPersistentType() { + return this.getTypeMapping().getPersistentType(); + } + + public JavaResourceType getJavaResourceType() { + return this.getTypeMapping().getJavaResourceType(); + } + + protected boolean isParentInheritanceStrategySingleTableOrJoined() { + InheritanceType inheritanceStrategy = getParent().getInheritanceStrategy(); + return inheritanceStrategy == InheritanceType.SINGLE_TABLE || inheritanceStrategy == InheritanceType.JOINED; + } + + protected boolean isParentRootEntity() { + return getParent().isRootEntity(); + } + + + // ********** Java completion proposals ********** + + @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; + } + for (JavaTenantDiscriminatorColumn tenantDiscriminatorColumn : this.getSpecifiedTenantDiscriminatorColumns()) { + result = tenantDiscriminatorColumn.getJavaCompletionProposals(pos, filter, astRoot); + if (result != null) { + return result; + } + } + + return null; + } + + + // ********** validation ********** + + @Override + public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { + //TODO validate 2.3 eclipselink does not use TABLE_PER_CLASS (and the new PROTECTED?? this wouldn't be in the 2.3 source) + super.validate(messages, reporter, astRoot); + if (getSpecifiedTenantDiscriminatorColumnsSize() > 0) { + if (this.isParentInheritanceStrategySingleTableOrJoined() && !isParentRootEntity()) { + messages.add( + DefaultEclipseLinkJpaValidationMessages.buildMessage( + IMessage.NORMAL_SEVERITY, + EclipseLinkJpaValidationMessages.MULTIENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY, + EMPTY_STRING_ARRAY, + this, + this.getJavaResourceType().getTextRange(EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME, astRoot) + ) + ); + } + else if (isMultitenantAnnotationSpecified()) { + for (JavaTenantDiscriminatorColumn column : this.getSpecifiedTenantDiscriminatorColumns()) { + column.validate(messages, reporter, astRoot); + } + } + else { + messages.add( + DefaultEclipseLinkJpaValidationMessages.buildMessage( + IMessage.NORMAL_SEVERITY, + EclipseLinkJpaValidationMessages.MULTIENANT_NOT_SPECIFIED_WITH_TENANT_DISCRIMINATOR_COLUMNS, + EMPTY_STRING_ARRAY, + this, + this.getJavaResourceType().getTextRange(EclipseLinkTenantDiscriminatorColumnAnnotation.ANNOTATION_NAME, astRoot) + ) + ); + } + } + } + + public TextRange getValidationTextRange(CompilationUnit astRoot) { + TextRange textRange = this.getMultitenantAnnotation().getTextRange(astRoot); + return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/NullJavaEclipseLinkMultitenancy.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/NullJavaEclipseLinkMultitenancy.java new file mode 100644 index 0000000000..761f69ae5c --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/java/NullJavaEclipseLinkMultitenancy.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.java; + +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; +import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenantType; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaTenantDiscriminatorColumn; + +public class NullJavaEclipseLinkMultitenancy + extends AbstractJavaJpaContextNode + implements JavaEclipseLinkMultitenancy +{ + + public NullJavaEclipseLinkMultitenancy(JavaEclipseLinkNonEmbeddableTypeMapping parent) { + super(parent); + } + + public EclipseLinkMultitenantType getType() { + return null; + } + + public EclipseLinkMultitenantType getSpecifiedType() { + return null; + } + + public void setSpecifiedType(EclipseLinkMultitenantType type) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public EclipseLinkMultitenantType getDefaultType() { + return null; + } + + public boolean isIncludeCriteria() { + return false; + } + + public Boolean getSpecifiedIncludeCriteria() { + return null; + } + + public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public boolean isDefaultIncludeCriteria() { + return false; + } + + public ListIterable<JavaTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns() { + return EmptyListIterable.instance(); + } + + public int getSpecifiedTenantDiscriminatorColumnsSize() { + return 0; + } + + public JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn() { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn tenantDiscriminatorColumn) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void removeSpecifiedTenantDiscriminatorColumn(int index) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public TextRange getValidationTextRange(CompilationUnit astRoot) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/EclipseLinkOrmTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/EclipseLinkOrmTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..0108843483 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/EclipseLinkOrmTenantDiscriminatorColumn.java @@ -0,0 +1,252 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0, which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm; + +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.jpa.core.context.XmlContextNode; +import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTableColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmTenantDiscriminatorColumn; + +/** + * <code>orm.xml</code> tenant discriminator column + */ +public class EclipseLinkOrmTenantDiscriminatorColumn + extends AbstractOrmNamedDiscriminatorColumn<XmlTenantDiscriminatorColumn_2_3, OrmReadOnlyTenantDiscriminatorColumn.Owner> + implements OrmTenantDiscriminatorColumn +{ + protected XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn; + + protected String specifiedTable; + protected String defaultTable; + + protected String specifiedContextProperty; + protected String defaultContextProperty; + + protected Boolean specifiedPrimaryKey; + protected boolean defaultPrimaryKey; + + public EclipseLinkOrmTenantDiscriminatorColumn(XmlContextNode parent, OrmReadOnlyTenantDiscriminatorColumn.Owner owner, XmlTenantDiscriminatorColumn_2_3 column) { + super(parent, owner, column); + this.specifiedTable = this.buildSpecifiedTable(); + this.specifiedContextProperty = this.buildSpecifiedContextProperty(); + this.specifiedPrimaryKey = this.buildSpecifiedPrimaryKey(); + } + + + // ********** synchronize/update ********** + + @Override + public void synchronizeWithResourceModel() { + super.synchronizeWithResourceModel(); + this.setSpecifiedTable_(this.buildSpecifiedTable()); + this.setSpecifiedContextProperty_(this.buildSpecifiedContextProperty()); + this.setSpecifiedPrimaryKey_(this.buildSpecifiedPrimaryKey()); + } + + @Override + public void update() { + super.update(); + this.setDefaultTable(this.buildDefaultTable()); + this.setDefaultContextProperty(this.buildDefaultContextProperty()); + this.setDefaultPrimaryKey(this.buildDefaultPrimaryKey()); + } + + + + // ********** XML column ********** + + @Override + public XmlTenantDiscriminatorColumn_2_3 getXmlColumn() { + return this.xmlTenantDiscriminatorColumn; + } + + @Override + protected void setXmlColumn(XmlTenantDiscriminatorColumn_2_3 xmlColumn) { + this.xmlTenantDiscriminatorColumn = xmlColumn; + } + + /** + * tenant discriminator columns are part of a collection; + * the 'tenant-discriminator-column' element will be removed/added + * when the XML tenant discriminator column is removed from/added to + * the owner's collection + */ + @Override + protected XmlTenantDiscriminatorColumn buildXmlColumn() { + throw new IllegalStateException("XML tenant discriminator column is missing"); //$NON-NLS-1$ + } + + /** + * @see #buildXmlColumn() + */ + @Override + protected void removeXmlColumn() { + // do nothing + } + + + // ********** table ********** + + @Override + public String getTable() { + return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; + } + + public String getSpecifiedTable() { + return this.specifiedTable; + } + + public void setSpecifiedTable(String table) { + if (this.valuesAreDifferent(this.specifiedTable, table)) { + this.setSpecifiedTable_(table); + this.xmlTenantDiscriminatorColumn.setTable(table); + } + } + + protected void setSpecifiedTable_(String table) { + String old = this.specifiedTable; + this.specifiedTable = table; + this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); + } + + protected String buildSpecifiedTable() { + return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getTable(); + } + + public String getDefaultTable() { + return this.defaultTable; + } + + protected void setDefaultTable(String table) { + String old = this.defaultTable; + this.defaultTable = table; + this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); + } + + protected String buildDefaultTable() { + return this.owner.getDefaultTableName(); + } + + // ********** contextProperty ********** + + public String getContextProperty() { + return (this.specifiedContextProperty != null) ? this.specifiedContextProperty : this.defaultContextProperty; + } + + public String getSpecifiedContextProperty() { + return this.specifiedContextProperty; + } + + public void setSpecifiedContextProperty(String contextProperty) { + if (this.valuesAreDifferent(this.specifiedContextProperty, contextProperty)) { + this.setSpecifiedContextProperty_(contextProperty); + this.xmlTenantDiscriminatorColumn.setContextProperty(contextProperty); + } + } + + protected void setSpecifiedContextProperty_(String contextProperty) { + String old = this.specifiedContextProperty; + this.specifiedContextProperty = contextProperty; + this.firePropertyChanged(SPECIFIED_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); + } + + protected String buildSpecifiedContextProperty() { + return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getContextProperty(); + } + + public String getDefaultContextProperty() { + return this.defaultContextProperty; + } + + protected void setDefaultContextProperty(String contextProperty) { + String old = this.defaultContextProperty; + this.defaultContextProperty = contextProperty; + this.firePropertyChanged(DEFAULT_CONTEXT_PROPERTY_PROPERTY, old, contextProperty); + } + + protected String buildDefaultContextProperty() { + return this.owner.getDefaultContextPropertyName(); + } + + + // ********** primaryKey ********** + + public boolean isPrimaryKey() { + return (this.specifiedPrimaryKey != null) ? this.specifiedPrimaryKey.booleanValue() : this.isDefaultPrimaryKey(); + } + + public Boolean getSpecifiedPrimaryKey() { + return this.specifiedPrimaryKey; + } + + public void setSpecifiedPrimaryKey(Boolean primaryKey) { + if (this.valuesAreDifferent(this.specifiedPrimaryKey, primaryKey)) { + this.setSpecifiedPrimaryKey_(primaryKey); + this.xmlTenantDiscriminatorColumn.setPrimaryKey(primaryKey); + } + } + + protected void setSpecifiedPrimaryKey_(Boolean primaryKey) { + Boolean old = this.specifiedPrimaryKey; + this.specifiedPrimaryKey = primaryKey; + this.firePropertyChanged(SPECIFIED_PRIMARY_KEY_PROPERTY, old, primaryKey); + } + + protected Boolean buildSpecifiedPrimaryKey() { + return (this.xmlTenantDiscriminatorColumn == null) ? null : this.xmlTenantDiscriminatorColumn.getPrimaryKey(); + } + + public boolean isDefaultPrimaryKey() { + return this.defaultPrimaryKey; + } + + protected void setDefaultPrimaryKey(boolean defaultPrimaryKey) { + boolean old = this.defaultPrimaryKey; + this.defaultPrimaryKey = defaultPrimaryKey; + this.firePropertyChanged(DEFAULT_PRIMARY_KEY_PROPERTY, old, defaultPrimaryKey); + } + + protected boolean buildDefaultPrimaryKey() { + return this.owner.getDefaultPrimaryKey(); + } + + + // ********** misc ********** + + public Iterable<String> getCandidateTableNames() { + return this.owner.getCandidateTableNames(); + } + + + // ********** validation ********** + + public boolean tableNameIsInvalid() { + return this.owner.tableNameIsInvalid(this.getTable()); + } + + public TextRange getTableTextRange() { + return this.getValidationTextRange(this.getXmlColumnTableTextRange()); + } + + protected TextRange getXmlColumnTableTextRange() { + XmlTenantDiscriminatorColumn_2_3 xmlColumn = this.getXmlColumn(); + return (xmlColumn == null) ? null : xmlColumn.getTableTextRange(); + } + + @Override + protected NamedColumnTextRangeResolver buildTextRangeResolver() { + return new OrmTableColumnTextRangeResolver(this); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/NullOrmEclipseLinkMultitenancy.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/NullOrmEclipseLinkMultitenancy.java new file mode 100644 index 0000000000..f80e61c410 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/NullOrmEclipseLinkMultitenancy.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm; + +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; +import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenantType; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmTenantDiscriminatorColumn; + +public class NullOrmEclipseLinkMultitenancy + extends AbstractOrmXmlContextNode + implements OrmEclipseLinkMultitenancy +{ + + public NullOrmEclipseLinkMultitenancy(OrmEclipseLinkNonEmbeddableTypeMapping parent) { + super(parent); + } + + // ********** type ********** + + public EclipseLinkMultitenantType getType() { + return null; + } + + public EclipseLinkMultitenantType getSpecifiedType() { + return null; + } + + public void setSpecifiedType(EclipseLinkMultitenantType type) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public EclipseLinkMultitenantType getDefaultType() { + return null; + } + + + // ********** include criteria ********** + + public boolean isIncludeCriteria() { + return false; + } + + public Boolean getSpecifiedIncludeCriteria() { + return null; + } + + public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public boolean isDefaultIncludeCriteria() { + return false; + } + + + + // ********** tenant discriminator columns ********** + + public ListIterable<OrmTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns() { + return EmptyListIterable.instance(); + } + + public int getSpecifiedTenantDiscriminatorColumnsSize() { + return 0; + } + + public OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn() { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn tenantDiscriminatorColumn) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void removeSpecifiedTenantDiscriminatorColumn(int index) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } + + public TextRange getValidationTextRange() { + throw new UnsupportedOperationException("Multitenancy is only supported in EclipseLink version 2.3 and higher"); //$NON-NLS-1$ + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/OrmEclipseLinkMultitenancyImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/OrmEclipseLinkMultitenancyImpl.java new file mode 100644 index 0000000000..5fecdc3f9d --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/context/orm/OrmEclipseLinkMultitenancyImpl.java @@ -0,0 +1,418 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.orm; + +import java.util.List; +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; +import org.eclipse.jpt.jpa.core.context.DiscriminatorType; +import org.eclipse.jpt.jpa.core.context.InheritanceType; +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.internal.context.JptValidator; +import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; +import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; +import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; +import org.eclipse.jpt.jpa.db.Table; +import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping; +import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; +import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages; +import org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.context.TenantDiscriminatorColumnValidator; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenant; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTenantDiscriminatorColumn; +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.XmlMultitenant_2_4; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenantType; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.ReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java.JavaEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmEclipseLinkMultitenancy; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm.OrmTenantDiscriminatorColumn; +import org.eclipse.wst.validation.internal.provisional.core.IMessage; +import org.eclipse.wst.validation.internal.provisional.core.IReporter; + +public class OrmEclipseLinkMultitenancyImpl + extends AbstractOrmXmlContextNode + implements OrmEclipseLinkMultitenancy +{ + protected EclipseLinkMultitenantType specifiedType; + protected EclipseLinkMultitenantType defaultType; + + protected Boolean specifiedIncludeCriteria; + protected boolean defaultIncludeCriteria; + + protected final ContextListContainer<OrmTenantDiscriminatorColumn, XmlTenantDiscriminatorColumn_2_3> specifiedTenantDiscriminatorColumnContainer; + protected final OrmReadOnlyTenantDiscriminatorColumn.Owner tenantDiscriminatorColumnOwner; + + public OrmEclipseLinkMultitenancyImpl(OrmEclipseLinkNonEmbeddableTypeMapping parent) { + super(parent); + + this.tenantDiscriminatorColumnOwner = this.buildTenantDiscriminatorColumnOwner(); + this.specifiedTenantDiscriminatorColumnContainer = new SpecifiedTenantDiscriminatorColumnContainer(); + this.specifiedType = this.buildSpecifiedType(); + this.specifiedIncludeCriteria = this.buildSpecifiedIncludeCriteria(); + } + + + // ********** synchronize/update ********** + + @Override + public void synchronizeWithResourceModel() { + super.synchronizeWithResourceModel(); + this.syncTenantDiscriminatorColumns(); + this.setSpecifiedType_(this.buildSpecifiedType()); + this.setSpecifiedIncludeCriteria_(this.buildSpecifiedIncludeCriteria()); + } + + @Override + public void update() { + super.update(); + this.updateNodes(this.getSpecifiedTenantDiscriminatorColumns()); + + boolean xmlMultitenantNotSpecified = (this.getXmlMultitenant() == null); + JavaEclipseLinkMultitenancy javaMultitenantPolicy = this.getJavaMultitenancyPolicyForDefaults(); + boolean javaMultitenantPolicySpecified = (javaMultitenantPolicy != null); + boolean useJavaValue = (xmlMultitenantNotSpecified && javaMultitenantPolicySpecified); + + this.setDefaultType(useJavaValue ? javaMultitenantPolicy.getType() : (isMultitenant() ? DEFAULT_TYPE : null)); + this.setDefaultIncludeCriteria(useJavaValue ? javaMultitenantPolicy.isIncludeCriteria() : DEFAULT_INCLUDE_CRITERIA); + + } + + // ********** type ********** + + public EclipseLinkMultitenantType getType() { + return (this.specifiedType != null) ? this.specifiedType : this.getDefaultType(); + } + + public EclipseLinkMultitenantType getSpecifiedType() { + return this.specifiedType; + } + + public void setSpecifiedType(EclipseLinkMultitenantType type) { + if (this.valuesAreDifferent(this.specifiedType, type)) { + XmlMultitenant xmlMultitenant = this.getXmlMultitenantForUpdate(); + this.setSpecifiedType_(type); + xmlMultitenant.setType(EclipseLinkMultitenantType.toOrmResourceModel(type)); + } + } + + protected void setSpecifiedType_(EclipseLinkMultitenantType type) { + EclipseLinkMultitenantType old = this.specifiedType; + this.specifiedType = type; + this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); + } + + protected EclipseLinkMultitenantType buildSpecifiedType() { + XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); + return (xmlMultitenant == null) ? null : EclipseLinkMultitenantType.fromOrmResourceModel(xmlMultitenant.getType()); + } + + public EclipseLinkMultitenantType getDefaultType() { + return this.defaultType; + } + + protected void setDefaultType(EclipseLinkMultitenantType type) { + EclipseLinkMultitenantType old = this.defaultType; + this.defaultType = type; + this.firePropertyChanged(DEFAULT_TYPE_PROPERTY, old, type); + } + + + // ********** include criteria ********** + + public boolean isIncludeCriteria() { + return (this.specifiedIncludeCriteria != null) ? this.specifiedIncludeCriteria.booleanValue() : this.defaultIncludeCriteria; + } + + public Boolean getSpecifiedIncludeCriteria() { + return this.specifiedIncludeCriteria; + } + + public void setSpecifiedIncludeCriteria(Boolean includeCriteria) { + if (this.valuesAreDifferent(this.specifiedIncludeCriteria, includeCriteria)) { + XmlMultitenant xmlMultitenant = this.getXmlMultitenantForUpdate(); + this.setSpecifiedIncludeCriteria_(includeCriteria); + xmlMultitenant.setIncludeCriteria(includeCriteria); + } + } + + protected void setSpecifiedIncludeCriteria_(Boolean includeCriteria) { + Boolean old = this.specifiedIncludeCriteria; + this.specifiedIncludeCriteria = includeCriteria; + this.firePropertyChanged(SPECIFIED_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); + } + + protected Boolean buildSpecifiedIncludeCriteria() { + XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); + return (xmlMultitenant == null) ? null : xmlMultitenant.getIncludeCriteria(); + } + + + public boolean isDefaultIncludeCriteria() { + return this.defaultIncludeCriteria; + } + + protected void setDefaultIncludeCriteria(boolean includeCriteria) { + boolean old = this.defaultIncludeCriteria; + this.defaultIncludeCriteria = includeCriteria; + this.firePropertyChanged(DEFAULT_INCLUDE_CRITERIA_PROPERTY, old, includeCriteria); + } + + + // ********** tenant discriminator columns ********** + + public ListIterable<OrmTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns() { + return this.specifiedTenantDiscriminatorColumnContainer.getContextElements(); + } + + public int getSpecifiedTenantDiscriminatorColumnsSize() { + return this.specifiedTenantDiscriminatorColumnContainer.getContextElementsSize(); + } + + public OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn() { + return this.addSpecifiedTenantDiscriminatorColumn(this.getSpecifiedTenantDiscriminatorColumnsSize()); + } + + public OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index) { + XmlTenantDiscriminatorColumn xmlJoinColumn = this.buildXmlTenantDiscriminatorColumn(); + OrmTenantDiscriminatorColumn joinColumn = this.specifiedTenantDiscriminatorColumnContainer.addContextElement(index, xmlJoinColumn); + this.getXmlMultitenantForUpdate().getTenantDiscriminatorColumns().add(index, xmlJoinColumn); + return joinColumn; + } + + protected XmlTenantDiscriminatorColumn buildXmlTenantDiscriminatorColumn() { + return EclipseLinkOrmFactory.eINSTANCE.createXmlTenantDiscriminatorColumn(); + } + + public void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn tenantDiscriminatorColumn) { + this.removeSpecifiedTenantDiscriminatorColumn(this.specifiedTenantDiscriminatorColumnContainer.indexOfContextElement((OrmTenantDiscriminatorColumn) tenantDiscriminatorColumn)); + } + + public void removeSpecifiedTenantDiscriminatorColumn(int index) { + this.specifiedTenantDiscriminatorColumnContainer.removeContextElement(index); + this.getXmlMultitenant().getTenantDiscriminatorColumns().remove(index); + } + + public void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex) { + this.specifiedTenantDiscriminatorColumnContainer.moveContextElement(targetIndex, sourceIndex); + this.getXmlMultitenant().getTenantDiscriminatorColumns().move(targetIndex, sourceIndex); + } + + + protected void syncTenantDiscriminatorColumns() { + this.specifiedTenantDiscriminatorColumnContainer.synchronizeWithResourceModel(); + } + + protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getXmlTenantDiscriminatorColumns() { + if (getXmlMultitenant() == null) { + return EmptyListIterable.instance(); + } + // clone to reduce chance of concurrency problems + return new LiveCloneListIterable<XmlTenantDiscriminatorColumn_2_3>(this.getXmlMultitenant().getTenantDiscriminatorColumns()); + } + + /** + * specified tenant discriminator column container + */ + protected class SpecifiedTenantDiscriminatorColumnContainer + extends ContextListContainer<OrmTenantDiscriminatorColumn, XmlTenantDiscriminatorColumn_2_3> + { + @Override + protected String getContextElementsPropertyName() { + return SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST; + } + @Override + protected OrmTenantDiscriminatorColumn buildContextElement(XmlTenantDiscriminatorColumn_2_3 resourceElement) { + return OrmEclipseLinkMultitenancyImpl.this.buildTenantDiscriminatorColumn(resourceElement); + } + @Override + protected ListIterable<XmlTenantDiscriminatorColumn_2_3> getResourceElements() { + return OrmEclipseLinkMultitenancyImpl.this.getXmlTenantDiscriminatorColumns(); + } + @Override + protected XmlTenantDiscriminatorColumn_2_3 getResourceElement(OrmTenantDiscriminatorColumn contextElement) { + return contextElement.getXmlColumn(); + } + } + + protected OrmReadOnlyTenantDiscriminatorColumn.Owner buildTenantDiscriminatorColumnOwner() { + return new TenantDiscriminatorColumnOwner(); + } + + protected OrmTenantDiscriminatorColumn buildTenantDiscriminatorColumn(XmlTenantDiscriminatorColumn_2_3 xmlTenantDiscriminatorColumn) { + return new EclipseLinkOrmTenantDiscriminatorColumn(this, this.tenantDiscriminatorColumnOwner, xmlTenantDiscriminatorColumn); + } + + + // ********** OrmReadOnlyTenantDiscriminatorColumn.Owner implementation ********** + + protected class TenantDiscriminatorColumnOwner + implements OrmReadOnlyTenantDiscriminatorColumn.Owner + { + + public String getDefaultContextPropertyName() { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_CONTEXT_PROPERTY; + } + + public boolean getDefaultPrimaryKey() { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_PRIMARY_KEY; + } + + public int getDefaultLength() { + return ReadOnlyNamedDiscriminatorColumn.DEFAULT_LENGTH; + } + + public DiscriminatorType getDefaultDiscriminatorType() { + return ReadOnlyNamedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; + } + + public String getDefaultTableName() { + return getTypeMapping().getPrimaryTableName(); + } + + public String getDefaultColumnName(ReadOnlyNamedColumn column) { + return ReadOnlyTenantDiscriminatorColumn.DEFAULT_NAME; + } + + public Table resolveDbTable(String tableName) { + return getTypeMapping().resolveDbTable(tableName); + } + + public Iterable<String> getCandidateTableNames() { + return getTypeMapping().getAllAssociatedTableNames(); + } + + public boolean tableNameIsInvalid(String tableName) { + return getTypeMapping().tableNameIsInvalid(tableName); + } + + public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { + return new TenantDiscriminatorColumnValidator(column, textRangeResolver); + } + + public TextRange getValidationTextRange() { + return OrmEclipseLinkMultitenancyImpl.this.getValidationTextRange(); + } + } + + // ********** XML multitenant ********** + + /** + * Return null if the XML multitenant does not exists. + */ + protected XmlMultitenant getXmlMultitenant() { + return getXmlMultitenantHolder().getMultitenant(); + } + + protected XmlMultitenantHolder getXmlMultitenantHolder() { + return (XmlMultitenantHolder) this.getXmlTypeMapping(); + } + + /** + * Build the XML multitenant if it does not exist. + */ + protected XmlMultitenant getXmlMultitenantForUpdate() { + XmlMultitenant xmlMultitenant = this.getXmlMultitenant(); + return (xmlMultitenant != null) ? xmlMultitenant : this.buildXmlMultitenant(); + } + + protected XmlMultitenant buildXmlMultitenant() { + XmlMultitenant xmlMultitenant = EclipseLinkOrmFactory.eINSTANCE.createXmlMultitenant(); + this.getXmlMultitenantHolder().setMultitenant(xmlMultitenant); + return xmlMultitenant; + } + + public boolean isMultitenantElementSpecified() { + return this.getXmlMultitenant() != null; + } + + public boolean isMultitenant() { + return isMultitenantElementSpecified(); + } + + + // ********** misc ********** + + @Override + public OrmEclipseLinkNonEmbeddableTypeMapping getParent() { + return (OrmEclipseLinkNonEmbeddableTypeMapping) super.getParent(); + } + + protected OrmEclipseLinkNonEmbeddableTypeMapping getTypeMapping() { + return this.getParent(); + } + + protected XmlTypeMapping getXmlTypeMapping() { + return this.getTypeMapping().getXmlTypeMapping(); + } + + protected JavaEclipseLinkNonEmbeddableTypeMapping getJavaTypeMappingForDefaults() { + return this.getTypeMapping().getJavaTypeMappingForDefaults(); + } + + protected JavaEclipseLinkMultitenancy getJavaMultitenancyPolicyForDefaults() { + JavaEclipseLinkNonEmbeddableTypeMapping javaTypeMapping = this.getJavaTypeMappingForDefaults(); + return (javaTypeMapping == null) ? null : javaTypeMapping.getMultitenancy(); + } + + protected boolean isParentInheritanceStrategySingleTableOrJoined() { + InheritanceType inheritanceStrategy = getParent().getInheritanceStrategy(); + return inheritanceStrategy == InheritanceType.SINGLE_TABLE || inheritanceStrategy == InheritanceType.JOINED; + } + + protected boolean isParentRootEntity() { + return getParent().isRootEntity(); + } + + + // ********** validation ********** + + @Override + public void validate(List<IMessage> messages, IReporter reporter) { + super.validate(messages, reporter); + if (getSpecifiedTenantDiscriminatorColumnsSize() > 0) { + if (this.isParentInheritanceStrategySingleTableOrJoined() && !isParentRootEntity()) { + //TODO need to validate this if the multitenant annotation exists, + //but not the multitenant xml element , I think it is defaulted in + messages.add( + DefaultEclipseLinkJpaValidationMessages.buildMessage( + IMessage.NORMAL_SEVERITY, + EclipseLinkJpaValidationMessages.MULTIENANT_METADATA_CANNOT_BE_SPECIFIED_ON_NON_ROOT_ENTITY, + EMPTY_STRING_ARRAY, + this, + this.getXmlMultitenant().getValidationTextRange() + ) + ); + } + else { + for (OrmTenantDiscriminatorColumn column : this.getSpecifiedTenantDiscriminatorColumns()) { + column.validate(messages, reporter); + } + } + } + } + + public TextRange getValidationTextRange() { + TextRange textRange = this.getXmlValidationTextRange(); + return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(); + } + + protected TextRange getXmlValidationTextRange() { + XmlMultitenant_2_4 xmlMultitenant = this.getXmlMultitenant(); + return (xmlMultitenant == null) ? null : xmlMultitenant.getValidationTextRange(); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/EclipseLinkMultitenantAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/EclipseLinkMultitenantAnnotationDefinition.java index 08d5e924ff..3463d80bbd 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/EclipseLinkMultitenantAnnotationDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/EclipseLinkMultitenantAnnotationDefinition.java @@ -48,7 +48,7 @@ public class EclipseLinkMultitenantAnnotationDefinition } public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); + return new NullEclipseLinkMultitenantAnnotation(parent); } public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/NullEclipseLinkMultitenantAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/NullEclipseLinkMultitenantAnnotation.java new file mode 100644 index 0000000000..bbb16638ba --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/NullEclipseLinkMultitenantAnnotation.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.internal.v2_3.resource.java; + +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation; +import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; +import org.eclipse.jpt.common.core.utility.TextRange; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.EclipseLinkMultitenantAnnotation; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.MultitenantType; + +/** + * <code>org.eclipse.persistence.annotations.Multitenant</code> + */ +public final class NullEclipseLinkMultitenantAnnotation + extends NullAnnotation<EclipseLinkMultitenantAnnotation> + implements EclipseLinkMultitenantAnnotation +{ + protected NullEclipseLinkMultitenantAnnotation(JavaResourceAnnotatedElement parent) { + super(parent); + } + + public String getAnnotationName() { + return ANNOTATION_NAME; + } + + public boolean isSpecified() { + return false; + } + + // ***** type + public MultitenantType getValue() { + return null; + } + + public void setValue(MultitenantType value) { + if (value != null) { + this.addAnnotation().setValue(value); + } + } + + public TextRange getValueTextRange(CompilationUnit astRoot) { + return null; + } + + // ***** include criteria + public Boolean getIncludeCriteria() { + return null; + } + + public void setIncludeCriteria(Boolean includeCriteria) { + if (includeCriteria != null) { + this.addAnnotation().setIncludeCriteria(includeCriteria); + } + } + + public TextRange getIncludeCriteriaTextRange(CompilationUnit astRoot) { + return null; + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation.java index 609d7fbaff..47a83b6e23 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/binary/BinaryEclipseLinkMultitenantAnnotation.java @@ -51,6 +51,10 @@ public class BinaryEclipseLinkMultitenantAnnotation // ********** EclipseLinkMultitenantAnnotation implementation ********** + public boolean isSpecified() { + return true; + } + // ***** value public MultitenantType getValue() { return this.value; diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/source/SourceEclipseLinkMultitenantAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/source/SourceEclipseLinkMultitenantAnnotation.java index 55273b34c3..335212119f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/source/SourceEclipseLinkMultitenantAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_3/resource/java/source/SourceEclipseLinkMultitenantAnnotation.java @@ -79,7 +79,11 @@ public class SourceEclipseLinkMultitenantAnnotation sb.append(this.value); } - // ********** MultitenantAnnotation implementation ********** + // ********** EclipseLinkMultitenantAnnotation implementation ********** + + public boolean isSpecified() { + return true; + } // ***** value public MultitenantType getValue() { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java index 3ff7a45877..33099ab624 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java @@ -1131,7 +1131,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNamedConverter() * @generated */ - public static final int XML_NAMED_CONVERTER = 45; + public static final int XML_NAMED_CONVERTER = 46; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -3243,7 +3243,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMutable() * @generated */ - public static final int XML_MUTABLE = 44; + public static final int XML_MUTABLE = 45; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedStoredProcedureQuery <em>Xml Named Stored Procedure Query</em>}' class. * <!-- begin-user-doc --> @@ -3252,7 +3252,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNamedStoredProcedureQuery() * @generated */ - public static final int XML_NAMED_STORED_PROCEDURE_QUERY = 49; + public static final int XML_NAMED_STORED_PROCEDURE_QUERY = 50; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlObjectTypeConverter <em>Xml Object Type Converter</em>}' class. * <!-- begin-user-doc --> @@ -3261,7 +3261,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlObjectTypeConverter() * @generated */ - public static final int XML_OBJECT_TYPE_CONVERTER = 50; + public static final int XML_OBJECT_TYPE_CONVERTER = 51; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToMany <em>Xml One To Many</em>}' class. * <!-- begin-user-doc --> @@ -3270,7 +3270,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlOneToMany() * @generated */ - public static final int XML_ONE_TO_MANY = 51; + public static final int XML_ONE_TO_MANY = 52; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToOne <em>Xml One To One</em>}' class. * <!-- begin-user-doc --> @@ -3279,7 +3279,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlOneToOne() * @generated */ - public static final int XML_ONE_TO_ONE = 52; + public static final int XML_ONE_TO_ONE = 53; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOptimisticLocking <em>Xml Optimistic Locking</em>}' class. * <!-- begin-user-doc --> @@ -3288,7 +3288,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlOptimisticLocking() * @generated */ - public static final int XML_OPTIMISTIC_LOCKING = 53; + public static final int XML_OPTIMISTIC_LOCKING = 54; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOrderColumn <em>Xml Order Column</em>}' class. * <!-- begin-user-doc --> @@ -3297,7 +3297,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlOrderColumn() * @generated */ - public static final int XML_ORDER_COLUMN = 54; + public static final int XML_ORDER_COLUMN = 55; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitDefaults <em>Xml Persistence Unit Defaults</em>}' class. * <!-- begin-user-doc --> @@ -3306,7 +3306,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPersistenceUnitDefaults() * @generated */ - public static final int XML_PERSISTENCE_UNIT_DEFAULTS = 56; + public static final int XML_PERSISTENCE_UNIT_DEFAULTS = 57; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitMetadata <em>Xml Persistence Unit Metadata</em>}' class. * <!-- begin-user-doc --> @@ -3315,7 +3315,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPersistenceUnitMetadata() * @generated */ - public static final int XML_PERSISTENCE_UNIT_METADATA = 57; + public static final int XML_PERSISTENCE_UNIT_METADATA = 58; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPrimaryKey <em>Xml Primary Key</em>}' class. * <!-- begin-user-doc --> @@ -3324,7 +3324,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPrimaryKey() * @generated */ - public static final int XML_PRIMARY_KEY = 61; + public static final int XML_PRIMARY_KEY = 62; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPrivateOwned <em>Xml Private Owned</em>}' class. * <!-- begin-user-doc --> @@ -3333,7 +3333,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPrivateOwned() * @generated */ - public static final int XML_PRIVATE_OWNED = 62; + public static final int XML_PRIVATE_OWNED = 63; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlProperty <em>Xml Property</em>}' class. * <!-- begin-user-doc --> @@ -3342,7 +3342,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlProperty() * @generated */ - public static final int XML_PROPERTY = 63; + public static final int XML_PROPERTY = 64; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPropertyContainer <em>Xml Property Container</em>}' class. * <!-- begin-user-doc --> @@ -3351,7 +3351,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPropertyContainer() * @generated */ - public static final int XML_PROPERTY_CONTAINER = 64; + public static final int XML_PROPERTY_CONTAINER = 65; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlQueryContainer <em>Xml Query Container</em>}' class. * <!-- begin-user-doc --> @@ -3360,7 +3360,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlQueryContainer() * @generated */ - public static final int XML_QUERY_CONTAINER = 65; + public static final int XML_QUERY_CONTAINER = 66; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlQueryRedirectors <em>Xml Query Redirectors</em>}' class. * <!-- begin-user-doc --> @@ -3369,7 +3369,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlQueryRedirectors() * @generated */ - public static final int XML_QUERY_REDIRECTORS = 66; + public static final int XML_QUERY_REDIRECTORS = 67; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlReadOnly <em>Xml Read Only</em>}' class. * <!-- begin-user-doc --> @@ -3378,7 +3378,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlReadOnly() * @generated */ - public static final int XML_READ_ONLY = 68; + public static final int XML_READ_ONLY = 69; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlReturnInsert <em>Xml Return Insert</em>}' class. * <!-- begin-user-doc --> @@ -3387,7 +3387,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlReturnInsert() * @generated */ - public static final int XML_RETURN_INSERT = 70; + public static final int XML_RETURN_INSERT = 71; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}' class. * <!-- begin-user-doc --> @@ -3396,7 +3396,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlSecondaryTable() * @generated */ - public static final int XML_SECONDARY_TABLE = 72; + public static final int XML_SECONDARY_TABLE = 73; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStoredProcedureParameter <em>Xml Stored Procedure Parameter</em>}' class. * <!-- begin-user-doc --> @@ -3405,7 +3405,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlStoredProcedureParameter() * @generated */ - public static final int XML_STORED_PROCEDURE_PARAMETER = 73; + public static final int XML_STORED_PROCEDURE_PARAMETER = 74; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructConverter <em>Xml Struct Converter</em>}' class. * <!-- begin-user-doc --> @@ -3414,7 +3414,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlStructConverter() * @generated */ - public static final int XML_STRUCT_CONVERTER = 75; + public static final int XML_STRUCT_CONVERTER = 76; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTable <em>Xml Table</em>}' class. * <!-- begin-user-doc --> @@ -3423,7 +3423,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTable() * @generated */ - public static final int XML_TABLE = 77; + public static final int XML_TABLE = 78; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTableGenerator <em>Xml Table Generator</em>}' class. * <!-- begin-user-doc --> @@ -3432,7 +3432,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTableGenerator() * @generated */ - public static final int XML_TABLE_GENERATOR = 78; + public static final int XML_TABLE_GENERATOR = 79; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTimeOfDay <em>Xml Time Of Day</em>}' class. * <!-- begin-user-doc --> @@ -3441,7 +3441,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTimeOfDay() * @generated */ - public static final int XML_TIME_OF_DAY = 80; + public static final int XML_TIME_OF_DAY = 81; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransformation <em>Xml Transformation</em>}' class. * <!-- begin-user-doc --> @@ -3450,7 +3450,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTransformation() * @generated */ - public static final int XML_TRANSFORMATION = 81; + public static final int XML_TRANSFORMATION = 82; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransient <em>Xml Transient</em>}' class. * <!-- begin-user-doc --> @@ -3459,7 +3459,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTransient() * @generated */ - public static final int XML_TRANSIENT = 82; + public static final int XML_TRANSIENT = 83; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeConverter <em>Xml Type Converter</em>}' class. * <!-- begin-user-doc --> @@ -3468,7 +3468,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTypeConverter() * @generated */ - public static final int XML_TYPE_CONVERTER = 83; + public static final int XML_TYPE_CONVERTER = 84; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVariableOneToOne <em>Xml Variable One To One</em>}' class. * <!-- begin-user-doc --> @@ -3477,7 +3477,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlVariableOneToOne() * @generated */ - public static final int XML_VARIABLE_ONE_TO_ONE = 86; + public static final int XML_VARIABLE_ONE_TO_ONE = 87; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlVersion <em>Xml Version</em>}' class. * <!-- begin-user-doc --> @@ -3486,7 +3486,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlVersion() * @generated */ - public static final int XML_VERSION = 87; + public static final int XML_VERSION = 88; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlHashPartitioning <em>Xml Hash Partitioning</em>}' class. * <!-- begin-user-doc --> @@ -4834,6 +4834,31 @@ public class EclipseLinkOrmPackage extends EPackageImpl */ public static final int XML_MULTITENANT_FEATURE_COUNT = EclipseLinkOrmV2_3Package.XML_MULTITENANT_23_FEATURE_COUNT + 1; /** + * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder <em>Xml Multitenant Holder</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder() + * @generated + */ + public static final int XML_MULTITENANT_HOLDER = 44; + /** + * The feature id for the '<em><b>Multitenant</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MULTITENANT_HOLDER__MULTITENANT = 0; + /** + * The number of structural features of the '<em>Xml Multitenant Holder</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + public static final int XML_MULTITENANT_HOLDER_FEATURE_COUNT = 1; + /** * The feature id for the '<em><b>Mutable</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -4857,7 +4882,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNamedPlsqlStoredFunctionQuery() * @generated */ - public static final int XML_NAMED_PLSQL_STORED_FUNCTION_QUERY = 46; + public static final int XML_NAMED_PLSQL_STORED_FUNCTION_QUERY = 47; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -4882,7 +4907,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNamedPlsqlStoredProcedureQuery() * @generated */ - public static final int XML_NAMED_PLSQL_STORED_PROCEDURE_QUERY = 47; + public static final int XML_NAMED_PLSQL_STORED_PROCEDURE_QUERY = 48; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -4907,7 +4932,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlNamedStoredFunctionQuery() * @generated */ - public static final int XML_NAMED_STORED_FUNCTION_QUERY = 48; + public static final int XML_NAMED_STORED_FUNCTION_QUERY = 49; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -5716,7 +5741,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPartitioning() * @generated */ - public static final int XML_PARTITIONING = 55; + public static final int XML_PARTITIONING = 56; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -5861,7 +5886,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPinnedPartitioning() * @generated */ - public static final int XML_PINNED_PARTITIONING = 58; + public static final int XML_PINNED_PARTITIONING = 59; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -5886,7 +5911,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPlsqlRecord() * @generated */ - public static final int XML_PLSQL_RECORD = 59; + public static final int XML_PLSQL_RECORD = 60; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -5911,7 +5936,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlPlsqlTable() * @generated */ - public static final int XML_PLSQL_TABLE = 60; + public static final int XML_PLSQL_TABLE = 61; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6112,7 +6137,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlRangePartitioning() * @generated */ - public static final int XML_RANGE_PARTITIONING = 67; + public static final int XML_RANGE_PARTITIONING = 68; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6153,7 +6178,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlReplicationPartitioning() * @generated */ - public static final int XML_REPLICATION_PARTITIONING = 69; + public static final int XML_REPLICATION_PARTITIONING = 70; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6194,7 +6219,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlRoundRobinPartitioning() * @generated */ - public static final int XML_ROUND_ROBIN_PARTITIONING = 71; + public static final int XML_ROUND_ROBIN_PARTITIONING = 72; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6331,7 +6356,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlStruct() * @generated */ - public static final int XML_STRUCT = 74; + public static final int XML_STRUCT = 75; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6380,7 +6405,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlStructure() * @generated */ - public static final int XML_STRUCTURE = 76; + public static final int XML_STRUCTURE = 77; /** * The feature id for the '<em><b>Access</b></em>' attribute. * <!-- begin-user-doc --> @@ -6581,7 +6606,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlTenantDiscriminatorColumn() * @generated */ - public static final int XML_TENANT_DISCRIMINATOR_COLUMN = 79; + public static final int XML_TENANT_DISCRIMINATOR_COLUMN = 80; /** * The feature id for the '<em><b>Column Definition</b></em>' attribute. * <!-- begin-user-doc --> @@ -6814,7 +6839,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlUnionPartitioning() * @generated */ - public static final int XML_UNION_PARTITIONING = 84; + public static final int XML_UNION_PARTITIONING = 85; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -6839,7 +6864,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlValuePartitioning() * @generated */ - public static final int XML_VALUE_PARTITIONING = 85; + public static final int XML_VALUE_PARTITIONING = 86; /** * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> @@ -7120,7 +7145,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getCacheCoordinationType() * @generated */ - public static final int CACHE_COORDINATION_TYPE = 88; + public static final int CACHE_COORDINATION_TYPE = 89; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.CacheType <em>Cache Type</em>}' enum. * <!-- begin-user-doc --> @@ -7129,7 +7154,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getCacheType() * @generated */ - public static final int CACHE_TYPE = 89; + public static final int CACHE_TYPE = 90; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlChangeTrackingType <em>Xml Change Tracking Type</em>}' enum. * <!-- begin-user-doc --> @@ -7138,7 +7163,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlChangeTrackingType() * @generated */ - public static final int XML_CHANGE_TRACKING_TYPE = 90; + public static final int XML_CHANGE_TRACKING_TYPE = 91; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlDirection <em>Xml Direction</em>}' enum. * <!-- begin-user-doc --> @@ -7147,7 +7172,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlDirection() * @generated */ - public static final int XML_DIRECTION = 91; + public static final int XML_DIRECTION = 92; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.ExistenceType <em>Existence Type</em>}' enum. * <!-- begin-user-doc --> @@ -7156,7 +7181,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getExistenceType() * @generated */ - public static final int EXISTENCE_TYPE = 92; + public static final int EXISTENCE_TYPE = 93; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlJoinFetchType <em>Xml Join Fetch Type</em>}' enum. * <!-- begin-user-doc --> @@ -7165,7 +7190,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlJoinFetchType() * @generated */ - public static final int XML_JOIN_FETCH_TYPE = 93; + public static final int XML_JOIN_FETCH_TYPE = 94; /** * The meta object id for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOptimisticLockingType <em>Xml Optimistic Locking Type</em>}' enum. * <!-- begin-user-doc --> @@ -7174,7 +7199,7 @@ public class EclipseLinkOrmPackage extends EPackageImpl * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlOptimisticLockingType() * @generated */ - public static final int XML_OPTIMISTIC_LOCKING_TYPE = 94; + public static final int XML_OPTIMISTIC_LOCKING_TYPE = 95; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -7438,6 +7463,12 @@ public class EclipseLinkOrmPackage extends EPackageImpl * <!-- end-user-doc --> * @generated */ + private EClass xmlMultitenantHolderEClass = null; + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ private EClass xmlMutableEClass = null; /** * <!-- begin-user-doc --> @@ -9136,6 +9167,33 @@ public class EclipseLinkOrmPackage extends EPackageImpl } /** + * Returns the meta object for class '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder <em>Xml Multitenant Holder</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Xml Multitenant Holder</em>'. + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder + * @generated + */ + public EClass getXmlMultitenantHolder() + { + return xmlMultitenantHolderEClass; + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder#getMultitenant <em>Multitenant</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Multitenant</em>'. + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder#getMultitenant() + * @see #getXmlMultitenantHolder() + * @generated + */ + public EReference getXmlMultitenantHolder_Multitenant() + { + return (EReference)xmlMultitenantHolderEClass.getEStructuralFeatures().get(0); + } + + /** * Returns the meta object for class '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMutable <em>Xml Mutable</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -10502,6 +10560,9 @@ public class EclipseLinkOrmPackage extends EPackageImpl xmlMultitenantEClass = createEClass(XML_MULTITENANT); + xmlMultitenantHolderEClass = createEClass(XML_MULTITENANT_HOLDER); + createEReference(xmlMultitenantHolderEClass, XML_MULTITENANT_HOLDER__MULTITENANT); + xmlMutableEClass = createEClass(XML_MUTABLE); createEAttribute(xmlMutableEClass, XML_MUTABLE__MUTABLE); @@ -11001,6 +11062,9 @@ public class EclipseLinkOrmPackage extends EPackageImpl initEClass(xmlMultitenantEClass, XmlMultitenant.class, "XmlMultitenant", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEClass(xmlMultitenantHolderEClass, XmlMultitenantHolder.class, "XmlMultitenantHolder", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getXmlMultitenantHolder_Multitenant(), this.getXmlMultitenant(), null, "multitenant", null, 0, 1, XmlMultitenantHolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(xmlMutableEClass, XmlMutable.class, "XmlMutable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getXmlMutable_Mutable(), theXMLTypePackage.getBooleanObject(), "mutable", null, 0, 1, XmlMutable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -12043,6 +12107,24 @@ public class EclipseLinkOrmPackage extends EPackageImpl public static final EClass XML_MULTITENANT = eINSTANCE.getXmlMultitenant(); /** + * The meta object literal for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder <em>Xml Multitenant Holder</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder() + * @generated + */ + public static final EClass XML_MULTITENANT_HOLDER = eINSTANCE.getXmlMultitenantHolder(); + + /** + * The meta object literal for the '<em><b>Multitenant</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final EReference XML_MULTITENANT_HOLDER__MULTITENANT = eINSTANCE.getXmlMultitenantHolder_Multitenant(); + + /** * The meta object literal for the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMutable <em>Xml Mutable</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java index 2f558050a6..0fe45daf5e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java @@ -53,7 +53,6 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.XmlUnionPartitioni import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.XmlValuePartitioning_2_2; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMultitenant_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedPlsqlStoredFunctionQuery_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedPlsqlStoredProcedureQuery_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedStoredFunctionQuery_2_3; @@ -327,7 +326,7 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i * @generated * @ordered */ - protected XmlMultitenant_2_3 multitenant; + protected XmlMultitenant multitenant; /** * The cached value of the '{@link #getNamedStoredFunctionQueries() <em>Named Stored Function Queries</em>}' containment reference list. @@ -2215,12 +2214,12 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i * </p> * <!-- end-user-doc --> * @return the value of the '<em>Multitenant</em>' containment reference. - * @see #setMultitenant(XmlMultitenant_2_3) - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlEntity_2_3_Multitenant() + * @see #setMultitenant(XmlMultitenant) + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder_Multitenant() * @model containment="true" * @generated */ - public XmlMultitenant_2_3 getMultitenant() + public XmlMultitenant getMultitenant() { return multitenant; } @@ -2230,9 +2229,9 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i * <!-- end-user-doc --> * @generated */ - public NotificationChain basicSetMultitenant(XmlMultitenant_2_3 newMultitenant, NotificationChain msgs) + public NotificationChain basicSetMultitenant(XmlMultitenant newMultitenant, NotificationChain msgs) { - XmlMultitenant_2_3 oldMultitenant = multitenant; + XmlMultitenant oldMultitenant = multitenant; multitenant = newMultitenant; if (eNotificationRequired()) { @@ -2250,7 +2249,7 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i * @see #getMultitenant() * @generated */ - public void setMultitenant(XmlMultitenant_2_3 newMultitenant) + public void setMultitenant(XmlMultitenant newMultitenant) { if (newMultitenant != multitenant) { @@ -2854,7 +2853,7 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i setIndex((XmlIndex_2_2)newValue); return; case EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT: - setMultitenant((XmlMultitenant_2_3)newValue); + setMultitenant((XmlMultitenant)newValue); return; case EclipseLinkOrmPackage.XML_ENTITY__NAMED_STORED_FUNCTION_QUERIES: getNamedStoredFunctionQueries().clear(); @@ -3008,7 +3007,7 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i setIndex((XmlIndex_2_2)null); return; case EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT: - setMultitenant((XmlMultitenant_2_3)null); + setMultitenant((XmlMultitenant)null); return; case EclipseLinkOrmPackage.XML_ENTITY__NAMED_STORED_FUNCTION_QUERIES: getNamedStoredFunctionQueries().clear(); @@ -3259,11 +3258,18 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i default: return -1; } } + if (baseClass == XmlMultitenantHolder.class) + { + switch (derivedFeatureID) + { + case EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT: return EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT; + default: return -1; + } + } if (baseClass == XmlEntity_2_3.class) { switch (derivedFeatureID) { - case EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT: return EclipseLinkOrmV2_3Package.XML_ENTITY_23__MULTITENANT; case EclipseLinkOrmPackage.XML_ENTITY__NAMED_STORED_FUNCTION_QUERIES: return EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_STORED_FUNCTION_QUERIES; case EclipseLinkOrmPackage.XML_ENTITY__NAMED_PLSQL_STORED_FUNCTION_QUERIES: return EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES; case EclipseLinkOrmPackage.XML_ENTITY__NAMED_PLSQL_STORED_PROCEDURE_QUERIES: return EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES; @@ -3420,11 +3426,18 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i default: return -1; } } + if (baseClass == XmlMultitenantHolder.class) + { + switch (baseFeatureID) + { + case EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT: return EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT; + default: return -1; + } + } if (baseClass == XmlEntity_2_3.class) { switch (baseFeatureID) { - case EclipseLinkOrmV2_3Package.XML_ENTITY_23__MULTITENANT: return EclipseLinkOrmPackage.XML_ENTITY__MULTITENANT; case EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_STORED_FUNCTION_QUERIES: return EclipseLinkOrmPackage.XML_ENTITY__NAMED_STORED_FUNCTION_QUERIES; case EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES: return EclipseLinkOrmPackage.XML_ENTITY__NAMED_PLSQL_STORED_FUNCTION_QUERIES; case EclipseLinkOrmV2_3Package.XML_ENTITY_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES: return EclipseLinkOrmPackage.XML_ENTITY__NAMED_PLSQL_STORED_PROCEDURE_QUERIES; @@ -3559,7 +3572,7 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i buildExcludeDefaultMappingsTranslator(), buildDescriptionTranslator(), buildAccessMethodsTranslator(), - XmlMultitenant.buildTranslator(EclipseLink2_3.MULTITENANT, EclipseLinkOrmV2_3Package.eINSTANCE.getXmlEntity_2_3_Multitenant()), + XmlMultitenant.buildTranslator(EclipseLink2_3.MULTITENANT, EclipseLinkOrmPackage.eINSTANCE.getXmlMultitenantHolder_Multitenant()), buildAdditionalCriteriaTranslator(), buildCustomizerTranslator(), buildChangeTrackingTranslator(), diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java index 3c4a6ef302..015a6801cd 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java @@ -63,7 +63,6 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.XmlUnionPartitioni import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.XmlValuePartitioning_2_2; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3; -import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMultitenant_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedPlsqlStoredFunctionQuery_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedPlsqlStoredProcedureQuery_2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedStoredFunctionQuery_2_3; @@ -396,7 +395,7 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X * @generated * @ordered */ - protected XmlMultitenant_2_3 multitenant; + protected XmlMultitenant multitenant; /** * The cached value of the '{@link #getNamedStoredFunctionQueries() <em>Named Stored Function Queries</em>}' containment reference list. @@ -2439,12 +2438,12 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X * </p> * <!-- end-user-doc --> * @return the value of the '<em>Multitenant</em>' containment reference. - * @see #setMultitenant(XmlMultitenant_2_3) - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMappedSuperclass_2_3_Multitenant() + * @see #setMultitenant(XmlMultitenant) + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder_Multitenant() * @model containment="true" * @generated */ - public XmlMultitenant_2_3 getMultitenant() + public XmlMultitenant getMultitenant() { return multitenant; } @@ -2454,9 +2453,9 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X * <!-- end-user-doc --> * @generated */ - public NotificationChain basicSetMultitenant(XmlMultitenant_2_3 newMultitenant, NotificationChain msgs) + public NotificationChain basicSetMultitenant(XmlMultitenant newMultitenant, NotificationChain msgs) { - XmlMultitenant_2_3 oldMultitenant = multitenant; + XmlMultitenant oldMultitenant = multitenant; multitenant = newMultitenant; if (eNotificationRequired()) { @@ -2474,7 +2473,7 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X * @see #getMultitenant() * @generated */ - public void setMultitenant(XmlMultitenant_2_3 newMultitenant) + public void setMultitenant(XmlMultitenant newMultitenant) { if (newMultitenant != multitenant) { @@ -2998,7 +2997,7 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X setAdditionalCriteria((XmlAdditionalCriteria_2_2)newValue); return; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT: - setMultitenant((XmlMultitenant_2_3)newValue); + setMultitenant((XmlMultitenant)newValue); return; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_STORED_FUNCTION_QUERIES: getNamedStoredFunctionQueries().clear(); @@ -3163,7 +3162,7 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X setAdditionalCriteria((XmlAdditionalCriteria_2_2)null); return; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT: - setMultitenant((XmlMultitenant_2_3)null); + setMultitenant((XmlMultitenant)null); return; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_STORED_FUNCTION_QUERIES: getNamedStoredFunctionQueries().clear(); @@ -3464,11 +3463,18 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X default: return -1; } } + if (baseClass == XmlMultitenantHolder.class) + { + switch (derivedFeatureID) + { + case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT: return EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT; + default: return -1; + } + } if (baseClass == XmlMappedSuperclass_2_3.class) { switch (derivedFeatureID) { - case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT: return EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__MULTITENANT; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_STORED_FUNCTION_QUERIES: return EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_STORED_FUNCTION_QUERIES; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_PLSQL_STORED_FUNCTION_QUERIES: return EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES; case EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_PLSQL_STORED_PROCEDURE_QUERIES: return EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES; @@ -3664,11 +3670,18 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X default: return -1; } } + if (baseClass == XmlMultitenantHolder.class) + { + switch (baseFeatureID) + { + case EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT: return EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT; + default: return -1; + } + } if (baseClass == XmlMappedSuperclass_2_3.class) { switch (baseFeatureID) { - case EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__MULTITENANT: return EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__MULTITENANT; case EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_STORED_FUNCTION_QUERIES: return EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_STORED_FUNCTION_QUERIES; case EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES: return EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_PLSQL_STORED_FUNCTION_QUERIES; case EclipseLinkOrmV2_3Package.XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES: return EclipseLinkOrmPackage.XML_MAPPED_SUPERCLASS__NAMED_PLSQL_STORED_PROCEDURE_QUERIES; @@ -3799,7 +3812,7 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X buildExcludeDefaultMappingsTranslator(), buildDescriptionTranslator(), buildAccessMethodsTranslator(), - XmlMultitenant.buildTranslator(EclipseLink2_3.MULTITENANT, EclipseLinkOrmV2_3Package.eINSTANCE.getXmlMappedSuperclass_2_3_Multitenant()), + XmlMultitenant.buildTranslator(EclipseLink2_3.MULTITENANT, EclipseLinkOrmPackage.eINSTANCE.getXmlMultitenantHolder_Multitenant()), buildAdditionalCriteriaTranslator(), buildCustomizerTranslator(), buildChangeTrackingTranslator(), diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMultitenantHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMultitenantHolder.java new file mode 100644 index 0000000000..02bcea382f --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMultitenantHolder.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.resource.orm; + +import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Xml Multitenant Holder</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder#getMultitenant <em>Multitenant</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder() + * @model kind="class" interface="true" abstract="true" + * @extends JpaEObject + * @generated + */ +public interface XmlMultitenantHolder extends JpaEObject +{ + /** + * Returns the value of the '<em><b>Multitenant</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Multitenant</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Multitenant</em>' containment reference. + * @see #setMultitenant(XmlMultitenant) + * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlMultitenantHolder_Multitenant() + * @model containment="true" + * @generated + */ + XmlMultitenant getMultitenant(); + + /** + * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder#getMultitenant <em>Multitenant</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Multitenant</em>' containment reference. + * @see #getMultitenant() + * @generated + */ + void setMultitenant(XmlMultitenant value); + +} // XmlMultitenantHolder diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTenantDiscriminatorColumn.java index 99ce6effba..394033db7a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTenantDiscriminatorColumn.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTenantDiscriminatorColumn.java @@ -14,6 +14,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; +import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlBaseDiscriminatorColumn; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLink2_3; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package; @@ -362,6 +363,10 @@ public class XmlTenantDiscriminatorColumn extends AbstractXmlBaseDiscriminatorCo return result.toString(); } + public TextRange getTableTextRange() { + return getAttributeTextRange(EclipseLink2_3.TENANT_DISCRIMINATOR_COLUMN__TABLE); + } + // ********** translators ********** public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/EclipseLinkOrmV2_3Package.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/EclipseLinkOrmV2_3Package.java index ea7bae5498..a8c36924e0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/EclipseLinkOrmV2_3Package.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/EclipseLinkOrmV2_3Package.java @@ -303,7 +303,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__MULTITENANT = 0; + public static final int XML_ENTITY_23__MULTITENANT = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT; /** * The feature id for the '<em><b>Named Stored Function Queries</b></em>' containment reference list. @@ -312,7 +312,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__NAMED_STORED_FUNCTION_QUERIES = 1; + public static final int XML_ENTITY_23__NAMED_STORED_FUNCTION_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Named Plsql Stored Function Queries</b></em>' containment reference list. @@ -321,7 +321,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES = 2; + public static final int XML_ENTITY_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Named Plsql Stored Procedure Queries</b></em>' containment reference list. @@ -330,7 +330,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES = 3; + public static final int XML_ENTITY_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Plsql Records</b></em>' containment reference list. @@ -339,7 +339,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__PLSQL_RECORDS = 4; + public static final int XML_ENTITY_23__PLSQL_RECORDS = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Plsql Tables</b></em>' containment reference list. @@ -348,7 +348,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__PLSQL_TABLES = 5; + public static final int XML_ENTITY_23__PLSQL_TABLES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Struct</b></em>' containment reference. @@ -357,7 +357,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23__STRUCT = 6; + public static final int XML_ENTITY_23__STRUCT = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 5; /** * The number of structural features of the '<em>Xml Entity 23</em>' class. @@ -366,7 +366,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_ENTITY_23_FEATURE_COUNT = 7; + public static final int XML_ENTITY_23_FEATURE_COUNT = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>Tenant Discriminator Columns</b></em>' containment reference list. @@ -438,7 +438,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__MULTITENANT = 0; + public static final int XML_MAPPED_SUPERCLASS_23__MULTITENANT = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER__MULTITENANT; /** * The feature id for the '<em><b>Named Stored Function Queries</b></em>' containment reference list. @@ -447,7 +447,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__NAMED_STORED_FUNCTION_QUERIES = 1; + public static final int XML_MAPPED_SUPERCLASS_23__NAMED_STORED_FUNCTION_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Named Plsql Stored Function Queries</b></em>' containment reference list. @@ -456,7 +456,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES = 2; + public static final int XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Named Plsql Stored Procedure Queries</b></em>' containment reference list. @@ -465,7 +465,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES = 3; + public static final int XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Plsql Records</b></em>' containment reference list. @@ -474,7 +474,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__PLSQL_RECORDS = 4; + public static final int XML_MAPPED_SUPERCLASS_23__PLSQL_RECORDS = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Plsql Tables</b></em>' containment reference list. @@ -483,7 +483,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23__PLSQL_TABLES = 5; + public static final int XML_MAPPED_SUPERCLASS_23__PLSQL_TABLES = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 4; /** * The number of structural features of the '<em>Xml Mapped Superclass 23</em>' class. @@ -492,7 +492,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl * @generated * @ordered */ - public static final int XML_MAPPED_SUPERCLASS_23_FEATURE_COUNT = 6; + public static final int XML_MAPPED_SUPERCLASS_23_FEATURE_COUNT = EclipseLinkOrmPackage.XML_MULTITENANT_HOLDER_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Type</b></em>' attribute. @@ -1194,20 +1194,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl } /** - * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getMultitenant <em>Multitenant</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Multitenant</em>'. - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getMultitenant() - * @see #getXmlEntity_2_3() - * @generated - */ - public EReference getXmlEntity_2_3_Multitenant() - { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(0); - } - - /** * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getNamedStoredFunctionQueries <em>Named Stored Function Queries</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1218,7 +1204,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_NamedStoredFunctionQueries() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(1); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(0); } @@ -1233,7 +1219,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_NamedPlsqlStoredFunctionQueries() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(2); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(1); } @@ -1248,7 +1234,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_NamedPlsqlStoredProcedureQueries() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(3); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(2); } @@ -1263,7 +1249,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_PlsqlRecords() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(4); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(3); } @@ -1278,7 +1264,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_PlsqlTables() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(5); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(4); } @@ -1293,7 +1279,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlEntity_2_3_Struct() { - return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(6); + return (EReference)xmlEntity_2_3EClass.getEStructuralFeatures().get(5); } @@ -1311,20 +1297,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl } /** - * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getMultitenant <em>Multitenant</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Multitenant</em>'. - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getMultitenant() - * @see #getXmlMappedSuperclass_2_3() - * @generated - */ - public EReference getXmlMappedSuperclass_2_3_Multitenant() - { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(0); - } - - /** * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getNamedStoredFunctionQueries <em>Named Stored Function Queries</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1335,7 +1307,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlMappedSuperclass_2_3_NamedStoredFunctionQueries() { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(1); + return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(0); } @@ -1350,7 +1322,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlMappedSuperclass_2_3_NamedPlsqlStoredFunctionQueries() { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(2); + return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(1); } @@ -1365,7 +1337,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlMappedSuperclass_2_3_NamedPlsqlStoredProcedureQueries() { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(3); + return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(2); } @@ -1380,7 +1352,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlMappedSuperclass_2_3_PlsqlRecords() { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(4); + return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(3); } @@ -1395,7 +1367,7 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl */ public EReference getXmlMappedSuperclass_2_3_PlsqlTables() { - return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(5); + return (EReference)xmlMappedSuperclass_2_3EClass.getEStructuralFeatures().get(4); } @@ -1837,7 +1809,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl createEReference(xmlEmbeddable_2_3EClass, XML_EMBEDDABLE_23__STRUCT); xmlEntity_2_3EClass = createEClass(XML_ENTITY_23); - createEReference(xmlEntity_2_3EClass, XML_ENTITY_23__MULTITENANT); createEReference(xmlEntity_2_3EClass, XML_ENTITY_23__NAMED_STORED_FUNCTION_QUERIES); createEReference(xmlEntity_2_3EClass, XML_ENTITY_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES); createEReference(xmlEntity_2_3EClass, XML_ENTITY_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES); @@ -1854,7 +1825,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl createEReference(xmlEntityMappings_2_3EClass, XML_ENTITY_MAPPINGS_23__PLSQL_TABLES); xmlMappedSuperclass_2_3EClass = createEClass(XML_MAPPED_SUPERCLASS_23); - createEReference(xmlMappedSuperclass_2_3EClass, XML_MAPPED_SUPERCLASS_23__MULTITENANT); createEReference(xmlMappedSuperclass_2_3EClass, XML_MAPPED_SUPERCLASS_23__NAMED_STORED_FUNCTION_QUERIES); createEReference(xmlMappedSuperclass_2_3EClass, XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_FUNCTION_QUERIES); createEReference(xmlMappedSuperclass_2_3EClass, XML_MAPPED_SUPERCLASS_23__NAMED_PLSQL_STORED_PROCEDURE_QUERIES); @@ -1934,6 +1904,8 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl // Set bounds for type parameters // Add supertypes to classes + xmlEntity_2_3EClass.getESuperTypes().add(theEclipseLinkOrmPackage.getXmlMultitenantHolder()); + xmlMappedSuperclass_2_3EClass.getESuperTypes().add(theEclipseLinkOrmPackage.getXmlMultitenantHolder()); xmlTenantDiscriminatorColumn_2_3EClass.getESuperTypes().add(theOrmPackage.getXmlBaseDiscriminatorColumn()); // Initialize classes and features; add operations and parameters @@ -1949,7 +1921,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl initEReference(getXmlEmbeddable_2_3_Struct(), this.getXmlStruct_2_3(), null, "struct", null, 0, 1, XmlEmbeddable_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(xmlEntity_2_3EClass, XmlEntity_2_3.class, "XmlEntity_2_3", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getXmlEntity_2_3_Multitenant(), this.getXmlMultitenant_2_3(), null, "multitenant", null, 0, 1, XmlEntity_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlEntity_2_3_NamedStoredFunctionQueries(), this.getXmlNamedStoredFunctionQuery_2_3(), null, "namedStoredFunctionQueries", null, 0, -1, XmlEntity_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlEntity_2_3_NamedPlsqlStoredFunctionQueries(), this.getXmlNamedPlsqlStoredFunctionQuery_2_3(), null, "namedPlsqlStoredFunctionQueries", null, 0, -1, XmlEntity_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlEntity_2_3_NamedPlsqlStoredProcedureQueries(), this.getXmlNamedPlsqlStoredProcedureQuery_2_3(), null, "namedPlsqlStoredProcedureQueries", null, 0, -1, XmlEntity_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -1966,7 +1937,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl initEReference(getXmlEntityMappings_2_3_PlsqlTables(), theEclipseLinkOrmPackage.getXmlPlsqlTable(), null, "plsqlTables", null, 0, -1, XmlEntityMappings_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(xmlMappedSuperclass_2_3EClass, XmlMappedSuperclass_2_3.class, "XmlMappedSuperclass_2_3", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getXmlMappedSuperclass_2_3_Multitenant(), this.getXmlMultitenant_2_3(), null, "multitenant", null, 0, 1, XmlMappedSuperclass_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlMappedSuperclass_2_3_NamedStoredFunctionQueries(), this.getXmlNamedStoredFunctionQuery_2_3(), null, "namedStoredFunctionQueries", null, 0, -1, XmlMappedSuperclass_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlMappedSuperclass_2_3_NamedPlsqlStoredFunctionQueries(), this.getXmlNamedPlsqlStoredFunctionQuery_2_3(), null, "namedPlsqlStoredFunctionQueries", null, 0, -1, XmlMappedSuperclass_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getXmlMappedSuperclass_2_3_NamedPlsqlStoredProcedureQueries(), this.getXmlNamedPlsqlStoredProcedureQuery_2_3(), null, "namedPlsqlStoredProcedureQueries", null, 0, -1, XmlMappedSuperclass_2_3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -2153,14 +2123,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl public static final EClass XML_ENTITY_23 = eINSTANCE.getXmlEntity_2_3(); /** - * The meta object literal for the '<em><b>Multitenant</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference XML_ENTITY_23__MULTITENANT = eINSTANCE.getXmlEntity_2_3_Multitenant(); - - /** * The meta object literal for the '<em><b>Named Stored Function Queries</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2219,14 +2181,6 @@ public class EclipseLinkOrmV2_3Package extends EPackageImpl public static final EClass XML_MAPPED_SUPERCLASS_23 = eINSTANCE.getXmlMappedSuperclass_2_3(); /** - * The meta object literal for the '<em><b>Multitenant</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference XML_MAPPED_SUPERCLASS_23__MULTITENANT = eINSTANCE.getXmlMappedSuperclass_2_3_Multitenant(); - - /** * The meta object literal for the '<em><b>Named Stored Function Queries</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlEntity_2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlEntity_2_3.java index 8235151c67..dd27d915d5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlEntity_2_3.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlEntity_2_3.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3; import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; /** @@ -21,7 +21,6 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getMultitenant <em>Multitenant</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getNamedStoredFunctionQueries <em>Named Stored Function Queries</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getNamedPlsqlStoredFunctionQueries <em>Named Plsql Stored Function Queries</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getNamedPlsqlStoredProcedureQueries <em>Named Plsql Stored Procedure Queries</em>}</li> @@ -33,38 +32,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; * * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package#getXmlEntity_2_3() * @model kind="class" interface="true" abstract="true" - * @extends JpaEObject * @generated */ -public interface XmlEntity_2_3 extends JpaEObject +public interface XmlEntity_2_3 extends XmlMultitenantHolder { /** - * Returns the value of the '<em><b>Multitenant</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Multitenant</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Multitenant</em>' containment reference. - * @see #setMultitenant(XmlMultitenant_2_3) - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package#getXmlEntity_2_3_Multitenant() - * @model containment="true" - * @generated - */ - XmlMultitenant_2_3 getMultitenant(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlEntity_2_3#getMultitenant <em>Multitenant</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Multitenant</em>' containment reference. - * @see #getMultitenant() - * @generated - */ - void setMultitenant(XmlMultitenant_2_3 value); - - /** * Returns the value of the '<em><b>Named Stored Function Queries</b></em>' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedStoredFunctionQuery_2_3}. * <!-- begin-user-doc --> diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlMappedSuperclass_2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlMappedSuperclass_2_3.java index 4dd62a9690..2868c3f44b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlMappedSuperclass_2_3.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlMappedSuperclass_2_3.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3; import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMultitenantHolder; import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; /** @@ -21,7 +21,6 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getMultitenant <em>Multitenant</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getNamedStoredFunctionQueries <em>Named Stored Function Queries</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getNamedPlsqlStoredFunctionQueries <em>Named Plsql Stored Function Queries</em>}</li> * <li>{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getNamedPlsqlStoredProcedureQueries <em>Named Plsql Stored Procedure Queries</em>}</li> @@ -32,38 +31,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPlsqlTable; * * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package#getXmlMappedSuperclass_2_3() * @model kind="class" interface="true" abstract="true" - * @extends JpaEObject * @generated */ -public interface XmlMappedSuperclass_2_3 extends JpaEObject +public interface XmlMappedSuperclass_2_3 extends XmlMultitenantHolder { /** - * Returns the value of the '<em><b>Multitenant</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Multitenant</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Multitenant</em>' containment reference. - * @see #setMultitenant(XmlMultitenant_2_3) - * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLinkOrmV2_3Package#getXmlMappedSuperclass_2_3_Multitenant() - * @model containment="true" - * @generated - */ - XmlMultitenant_2_3 getMultitenant(); - - /** - * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlMappedSuperclass_2_3#getMultitenant <em>Multitenant</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Multitenant</em>' containment reference. - * @see #getMultitenant() - * @generated - */ - void setMultitenant(XmlMultitenant_2_3 value); - - /** * Returns the value of the '<em><b>Named Stored Function Queries</b></em>' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlNamedStoredFunctionQuery_2_3}. * <!-- begin-user-doc --> diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlTenantDiscriminatorColumn_2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlTenantDiscriminatorColumn_2_3.java index cf09a4064e..e51f38c4a6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlTenantDiscriminatorColumn_2_3.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_3/XmlTenantDiscriminatorColumn_2_3.java @@ -9,6 +9,7 @@ *******************************************************************************/ package org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3; +import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.jpa.core.resource.orm.XmlBaseDiscriminatorColumn; @@ -110,4 +111,6 @@ public interface XmlTenantDiscriminatorColumn_2_3 extends XmlBaseDiscriminatorCo * @generated */ void setPrimaryKey(Boolean value); + + TextRange getTableTextRange(); } // XmlTenantDiscriminator2_3 diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenancy.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenancy.java new file mode 100644 index 0000000000..b8a013cb6e --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenancy.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context; + +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.jpa.core.context.JpaContextNode; + +/** + * EclipseLink multitenancy + * <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.1 + * @since 3.1 + */ +public interface EclipseLinkMultitenancy + extends JpaContextNode +{ + + // ********** type ********** + + /** + * This is the combination of defaultType and specifiedType. + * If getSpecifiedType() returns null, then return getDefaultType() + */ + EclipseLinkMultitenantType getType(); + + EclipseLinkMultitenantType getSpecifiedType(); + void setSpecifiedType(EclipseLinkMultitenantType type); + String SPECIFIED_TYPE_PROPERTY = "specifiedType"; //$NON-NLS-1$ + + EclipseLinkMultitenantType getDefaultType(); + String DEFAULT_TYPE_PROPERTY = "defaultType"; //$NON-NLS-1$ + EclipseLinkMultitenantType DEFAULT_TYPE = EclipseLinkMultitenantType.SINGLE_TABLE; + + + // ********** include criteria (EclipseLink 2.4+) ********** + + /** + * This is the combination of defaultIncludeCriteria and specifiedIncludeCriteria. + * If getSpecifiedIncludeCriteria() returns null, then return isDefaultIncludeCriteria() + */ + boolean isIncludeCriteria(); + + Boolean getSpecifiedIncludeCriteria(); + void setSpecifiedIncludeCriteria(Boolean includeCriteria); + String SPECIFIED_INCLUDE_CRITERIA_PROPERTY = "specifiedIncludeCriteria"; //$NON-NLS-1$ + + boolean isDefaultIncludeCriteria(); + String DEFAULT_INCLUDE_CRITERIA_PROPERTY = "defaultIncludeCriteria"; //$NON-NLS-1$ + boolean DEFAULT_INCLUDE_CRITERIA = true; + + + // ********** tenant discriminator columns ********** + + /** + * Return a list iterable of the specified tenant discriminator columns. + * This will not be null. + */ + ListIterable<? extends TenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns(); + String SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST = "specifiedTenantDiscriminatorColumns"; //$NON-NLS-1$ + + /** + * Return the number of specified tenant discriminator columns. + */ + int getSpecifiedTenantDiscriminatorColumnsSize(); + + /** + * Add a specified tenant discriminator column and return the object + * representing it. + */ + TenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(); + + /** + * Add a specified tenant discriminator column and return the object + * representing it. + */ + TenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index); + + /** + * Remove the specified tenant discriminator column. + */ + void removeSpecifiedTenantDiscriminatorColumn(TenantDiscriminatorColumn tenantDiscriminatorColumn); + + /** + * Remove the specified tenant discriminator column at the index. + */ + void removeSpecifiedTenantDiscriminatorColumn(int index); + + /** + * Move the specified tenant discriminator column from the source index to the target index. + */ + void moveSpecifiedTenantDiscriminatorColumn(int targetIndex, int sourceIndex); + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenantType.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenantType.java new file mode 100644 index 0000000000..41faea291b --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/EclipseLinkMultitenantType.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context; + + +/** + * + * + * 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.1 + * @since 3.1 + */ +public enum EclipseLinkMultitenantType { + + SINGLE_TABLE, + TABLE_PER_TENANT; + + + public static EclipseLinkMultitenantType fromJavaResourceModel(org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.MultitenantType javaMultitenantType) { + if (javaMultitenantType == null) { + return null; + } + switch (javaMultitenantType) { + case SINGLE_TABLE: + return SINGLE_TABLE; + case TABLE_PER_TENANT: + return TABLE_PER_TENANT; + default: + throw new IllegalArgumentException("unknown multitenant type: " + javaMultitenantType); //$NON-NLS-1$ + } + } + + public static org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.MultitenantType toJavaResourceModel(EclipseLinkMultitenantType multitenantType) { + if (multitenantType == null) { + return null; + } + switch (multitenantType) { + case SINGLE_TABLE: + return org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.MultitenantType.SINGLE_TABLE; + case TABLE_PER_TENANT: + return org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.MultitenantType.TABLE_PER_TENANT; + default: + throw new IllegalArgumentException("unknown multitenant type: " + multitenantType); //$NON-NLS-1$ + } + } + + public static EclipseLinkMultitenantType fromOrmResourceModel(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.MultitenantType ormMultitenantType) { + if (ormMultitenantType == null) { + return null; + } + switch (ormMultitenantType) { + case SINGLE_TABLE: + return SINGLE_TABLE; + case TABLE_PER_TENANT: + return TABLE_PER_TENANT; + default: + throw new IllegalArgumentException("unknown multitenant type: " + ormMultitenantType); //$NON-NLS-1$ + } + } + + public static org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.MultitenantType toOrmResourceModel(EclipseLinkMultitenantType multitenantType) { + if (multitenantType == null) { + return null; + } + switch (multitenantType) { + case SINGLE_TABLE: + return org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.MultitenantType.SINGLE_TABLE; + case TABLE_PER_TENANT: + return org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.MultitenantType.TABLE_PER_TENANT; + default: + throw new IllegalArgumentException("unknown multitenant type: " + multitenantType); //$NON-NLS-1$ + } + } + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/ReadOnlyTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/ReadOnlyTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..9986d9d666 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/ReadOnlyTenantDiscriminatorColumn.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context; + +import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.context.ReadOnlyTableColumn; + +/** + * tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface ReadOnlyTenantDiscriminatorColumn + extends ReadOnlyNamedDiscriminatorColumn, ReadOnlyTableColumn +{ + String DEFAULT_NAME = "TENANT_ID"; //$NON-NLS-1$ + + + // ********** context property ********** + + /** + * Return the specified context property if present, otherwise return + * the default context property. + */ + String getContextProperty(); + String getSpecifiedContextProperty(); + String SPECIFIED_CONTEXT_PROPERTY_PROPERTY = "specifiedContextProperty"; //$NON-NLS-1$ + String getDefaultContextProperty(); + String DEFAULT_CONTEXT_PROPERTY_PROPERTY = "defaultContextProperty"; //$NON-NLS-1$ + String DEFAULT_CONTEXT_PROPERTY = "eclipselink.tenant-id"; //$NON-NLS-1$ + + + // ********** primaryKey ********** + + /** + * Return the specified primaryKey setting if present, otherwise return the + * default primaryKey setting. + */ + boolean isPrimaryKey(); + Boolean getSpecifiedPrimaryKey(); + String SPECIFIED_PRIMARY_KEY_PROPERTY = "specifiedPrimaryKey"; //$NON-NLS-1$ + boolean isDefaultPrimaryKey(); + String DEFAULT_PRIMARY_KEY_PROPERTY = "defaultPrimaryKey"; //$NON-NLS-1$ + boolean DEFAULT_PRIMARY_KEY = false; + + + // ********** owner ********** + + /** + * interface allowing tenant discriminator columns to be used in multiple places + */ + interface Owner + extends ReadOnlyNamedDiscriminatorColumn.Owner, ReadOnlyTableColumn.Owner + { + /** + * Return the default context property name + */ + String getDefaultContextPropertyName(); + + /** + * Return the default primary key setting + */ + boolean getDefaultPrimaryKey(); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/TenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/TenantDiscriminatorColumn.java new file mode 100644 index 0000000000..b89d4d2c96 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/TenantDiscriminatorColumn.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context; + +import org.eclipse.jpt.jpa.core.context.NamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.context.TableColumn; + +/** + * tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface TenantDiscriminatorColumn + extends NamedDiscriminatorColumn, ReadOnlyTenantDiscriminatorColumn, TableColumn +{ + + void setSpecifiedContextProperty(String contextProperty); + void setSpecifiedPrimaryKey(Boolean primaryKey); + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaEclipseLinkMultitenancy.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaEclipseLinkMultitenancy.java new file mode 100644 index 0000000000..d464bd3621 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaEclipseLinkMultitenancy.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java; + +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenancy; + +public interface JavaEclipseLinkMultitenancy + extends EclipseLinkMultitenancy, JavaJpaContextNode +{ + ListIterable<JavaTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns(); + JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(); + JavaTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index); + +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaReadOnlyTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaReadOnlyTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..fc9fd0c973 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaReadOnlyTenantDiscriminatorColumn.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java; + +import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyTableColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.ReadOnlyTenantDiscriminatorColumn; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.resource.java.EclipseLinkTenantDiscriminatorColumnAnnotation; + +/** + * tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface JavaReadOnlyTenantDiscriminatorColumn + extends JavaReadOnlyNamedDiscriminatorColumn, ReadOnlyTenantDiscriminatorColumn, JavaReadOnlyTableColumn +{ + EclipseLinkTenantDiscriminatorColumnAnnotation getColumnAnnotation(); + + // ********** owner ********** + + /** + * interface allowing tenant discriminator columns to be used in multiple places + */ + interface Owner + extends ReadOnlyTenantDiscriminatorColumn.Owner, JavaReadOnlyNamedDiscriminatorColumn.Owner + { + //combining interfaces + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..76175f7c39 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/java/JavaTenantDiscriminatorColumn.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.java; + +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; + +/** + * tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface JavaTenantDiscriminatorColumn + extends TenantDiscriminatorColumn, JavaReadOnlyTenantDiscriminatorColumn +{ + //combining interfaces +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmEclipseLinkMultitenancy.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmEclipseLinkMultitenancy.java new file mode 100644 index 0000000000..f8736a3fa9 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmEclipseLinkMultitenancy.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm; + +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; +import org.eclipse.jpt.jpa.core.context.XmlContextNode; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.EclipseLinkMultitenancy; + +public interface OrmEclipseLinkMultitenancy + extends EclipseLinkMultitenancy, XmlContextNode +{ + ListIterable<OrmTenantDiscriminatorColumn> getSpecifiedTenantDiscriminatorColumns(); + OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(); + OrmTenantDiscriminatorColumn addSpecifiedTenantDiscriminatorColumn(int index); +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmReadOnlyTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmReadOnlyTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..abca012a04 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmReadOnlyTenantDiscriminatorColumn.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm; + +import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedDiscriminatorColumn; +import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyTableColumn; +import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlTenantDiscriminatorColumn_2_3; +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.ReadOnlyTenantDiscriminatorColumn; + +/** + * tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface OrmReadOnlyTenantDiscriminatorColumn + extends OrmReadOnlyNamedDiscriminatorColumn, ReadOnlyTenantDiscriminatorColumn, OrmReadOnlyTableColumn +{ + XmlTenantDiscriminatorColumn_2_3 getXmlColumn(); + + // ********** owner ********** + + /** + * interface allowing discriminator columns to be used in multiple places + */ + interface Owner + extends ReadOnlyTenantDiscriminatorColumn.Owner, OrmReadOnlyNamedDiscriminatorColumn.Owner + { + //combining interfaces + } +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmTenantDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmTenantDiscriminatorColumn.java new file mode 100644 index 0000000000..5644e915c4 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/context/orm/OrmTenantDiscriminatorColumn.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.orm; + +import org.eclipse.jpt.jpa.eclipselink.core.v2_3.context.TenantDiscriminatorColumn; + +/** + * orm tenant discriminator column + * <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.1 + * @since 3.1 + */ +public interface OrmTenantDiscriminatorColumn + extends TenantDiscriminatorColumn, OrmReadOnlyTenantDiscriminatorColumn +{ + //combining interfaces +} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/resource/java/EclipseLinkMultitenantAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/resource/java/EclipseLinkMultitenantAnnotation.java index dd8fc04180..d3ec217432 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/resource/java/EclipseLinkMultitenantAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_3/resource/java/EclipseLinkMultitenantAnnotation.java @@ -31,6 +31,10 @@ public interface EclipseLinkMultitenantAnnotation { String ANNOTATION_NAME = EclipseLink2_3.MULTITENANT; + /** + * Return whether the annotation exists in Java. + */ + boolean isSpecified(); /** * Corresponds to the 'value' element of the Multitenant annotation. |