Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornhauge2011-05-19 06:47:14 +0000
committernhauge2011-05-19 06:47:14 +0000
commit63da5009a46b2867bccf25c5ea3208bb982461ff (patch)
treee37730a0d9a6e42c5e12f84360fb3fe6fe51f59b /jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm
parenta66a6c5ac6c58f8403d161139d06836dcd49347b (diff)
downloadwebtools.dali-201105180000.tar.gz
webtools.dali-201105180000.tar.xz
webtools.dali-201105180000.zip
This commit was manufactured by cvs2svn to create tag 'v201105180000'.v201105180000
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java477
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java306
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java507
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java450
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java347
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java313
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java414
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java440
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java60
62 files changed, 0 insertions, 10336 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
deleted file mode 100644
index 2968119981..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
-
-public abstract class AbstractOrmConverter
- extends AbstractOrmXmlContextNode
- implements OrmConverter
-{
- protected AbstractOrmConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- protected OrmAttributeMapping getAttributeMapping() {
- return this.getParent();
- }
-
- protected XmlAttributeMapping getXmlAttributeMapping() {
- return this.getAttributeMapping().getXmlAttributeMapping();
- }
-
- protected XmlConvertibleMapping getXmlConvertibleMapping() {
- return (XmlConvertibleMapping) this.getXmlAttributeMapping();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlValidationTextRange();
- return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange();
- }
-
- protected abstract TextRange getXmlValidationTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
deleted file mode 100644
index 84e467a5bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified <code>orm.xml</code> override
- */
-public abstract class AbstractOrmOverride<C extends OrmOverrideContainer, X extends XmlOverride>
- extends AbstractOrmXmlContextNode
- implements OrmOverride
-{
- protected final X xmlOverride;
-
- protected String name;
-
-
- protected AbstractOrmOverride(C parent, X xmlOverride) {
- super(parent);
- this.xmlOverride = xmlOverride;
- this.name = xmlOverride.getName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.xmlOverride.getName());
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.setName_(name);
- this.xmlOverride.setName(name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
-
- // ********** specified/virtual **********
-
- public boolean isVirtual() {
- return false;
- }
-
- public OrmVirtualOverride convertToVirtual() {
- return this.getContainer().convertOverrideToVirtual(this);
- }
-
-
- // ********** misc **********
-
- @Override
- @SuppressWarnings("unchecked")
- public C getParent() {
- return (C) super.getParent();
- }
-
- public C getContainer() {
- return this.getParent();
- }
-
- public X getXmlOverride() {
- return this.xmlOverride;
- }
-
- protected void initializeFrom(ReadOnlyOverride oldOverride) {
- this.setName(oldOverride.getName());
- }
-
- protected void initializeFromVirtual(ReadOnlyOverride virtualOverride) {
- this.setName(virtualOverride.getName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.buildValidator().validate(messages, reporter);
- }
-
- protected JptValidator buildValidator() {
- return this.getContainer().buildValidator(this, this.buildTextRangeResolver());
- }
-
- protected OverrideTextRangeResolver buildTextRangeResolver() {
- return new OrmOverrideTextRangeResolver(this);
- }
-
- /**
- * @see AbstractOrmOverrideContainer#getValidationTextRange()
- */
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlOverride.getValidationTextRange();
- // skip the container since it really doesn't have a text range
- // (also, this prevents a stack overflow)
- return (textRange != null) ? textRange : this.getContainer().getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.xmlOverride.getNameTextRange());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
deleted file mode 100644
index c84801e4cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.context.BaseColumn;
-import org.eclipse.jpt.jpa.core.context.Override_;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.VirtualOverride;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> override container
- */
-public abstract class AbstractOrmOverrideContainer<
- O extends OrmOverrideContainer.Owner,
- R extends OrmReadOnlyOverride,
- S extends OrmOverride,
- V extends OrmVirtualOverride,
- X extends XmlOverride
- >
- extends AbstractOrmXmlContextNode
- implements OrmOverrideContainer
-{
- // this can be null if the container is "read-only" (i.e. a "null" container)
- protected final O owner;
-
- protected final Vector<S> specifiedOverrides = new Vector<S>();
- protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter();
-
- protected final Vector<V> virtualOverrides = new Vector<V>();
- protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter();
-
-
- protected AbstractOrmOverrideContainer(XmlContextNode parent, O owner) {
- super(parent);
- this.owner = owner;
- this.initializeSpecifiedOverrides();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedOverrides();
- // the virtual overrides do not need a sync
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getSpecifiedOverrides());
- this.updateVirtualOverrides();
- }
-
-
- // ********** overrides **********
-
- public ListIterator<R> overrides() {
- return this.getOverrides().iterator();
- }
-
- @SuppressWarnings("unchecked")
- protected ListIterable<R> getOverrides() {
- return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
- }
-
- public int overridesSize() {
- return this.specifiedOverrides.size() + this.virtualOverrides.size();
- }
-
- public R getOverrideNamed(String name) {
- return this.selectOverrideNamed(this.getOverrides(), name);
- }
-
-
- // ********** override conversions **********
-
- /**
- * <em>Silently</em> add the new virtual override before removing the
- * specified override, or the <em>update</em> will discover the missing
- * virtual override and add it preemptively.
- */
- public V convertOverrideToVirtual(Override_ override) {
- if (override.isVirtual()) {
- throw new IllegalArgumentException("Override is already virtual: " + override); //$NON-NLS-1$
- }
-
- @SuppressWarnings("unchecked")
- S specifiedOverride = (S) override;
- int virtualIndex = this.virtualOverrides.size();
- String overrideName = specifiedOverride.getName();
- V virtualOverride = null;
- // make sure the specified override actually overrides something before building the virtual override
- if (this.overrideWillBeVirtual(overrideName, specifiedOverride)) {
- virtualOverride = this.buildVirtualOverride(overrideName);
- this.virtualOverrides.add(virtualIndex, virtualOverride);
- }
-
- this.removeSpecifiedOverride(specifiedOverride); // trigger update
-
- if (virtualOverride != null) {
- this.fireItemAdded(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
- }
- return virtualOverride;
- }
-
- /**
- * Return whether the specified override name will be a
- * <em>virtual</em> override when the specified specified override is
- * removed from the container. The override name must be among the
- * valid override names and it must not correspond to any of the
- * remaining specified overrides.
- */
- protected boolean overrideWillBeVirtual(String overrideName, S specifiedOverrideToBeRemoved) {
- return CollectionTools.contains(this.allOverridableNames(), overrideName) &&
- (this.getSpecifiedOverrideNamed(overrideName, specifiedOverrideToBeRemoved) == null);
- }
-
- /**
- * <em>Silently</em> remove the virtual override and add the new specified
- * override before naming the specified override, or the <em>update</em>
- * will discover the dangling virtual override and remove it preemptively.
- */
- public S convertOverrideToSpecified(VirtualOverride override) {
- if ( ! override.isVirtual()) {
- throw new IllegalArgumentException("Override is already specified: " + override); //$NON-NLS-1$
- }
-
- @SuppressWarnings("unchecked")
- V virtualOverride = (V) override;
- int virtualIndex = this.virtualOverrides.indexOf(virtualOverride);
- this.virtualOverrides.remove(virtualIndex);
-
- int specifiedIndex = this.specifiedOverrides.size();
- X xmlOverride = this.buildXmlOverride();
- S specifiedOverride = this.buildSpecifiedOverride(xmlOverride);
- this.specifiedOverrides.add(specifiedIndex, specifiedOverride);
- this.owner.getXmlOverrides().add(specifiedIndex, xmlOverride);
-
- this.initializeSpecifiedOverride(specifiedOverride, virtualOverride); // trigger update
-
- this.fireItemRemoved(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
- this.fireItemAdded(SPECIFIED_OVERRIDES_LIST, specifiedIndex, specifiedOverride);
- return specifiedOverride;
- }
-
- protected abstract void initializeSpecifiedOverride(S specifiedOverride, V virtualOverride);
-
-
- // ********** specified overrides **********
-
- public ListIterator<S> specifiedOverrides() {
- return this.getSpecifiedOverrides().iterator();
- }
-
- protected ListIterable<S> getSpecifiedOverrides() {
- return new LiveCloneListIterable<S>(this.specifiedOverrides);
- }
-
- @SuppressWarnings("unchecked")
- protected ListIterable<R> getReadOnlySpecifiedOverrides() {
- // S should always be a subtype of R, but we can't enforce that in the
- // class declaration...
- return (ListIterable<R>) this.getSpecifiedOverrides();
- }
-
- public int specifiedOverridesSize() {
- return this.specifiedOverrides.size();
- }
-
- public S getSpecifiedOverride(int index) {
- return this.specifiedOverrides.get(index);
- }
-
- public S getSpecifiedOverrideNamed(String name) {
- return this.getSpecifiedOverrideNamed(name, null);
- }
-
- @SuppressWarnings("unchecked")
- protected S getSpecifiedOverrideNamed(String name, S exclude) {
- return (S) this.selectOverrideNamed(this.getReadOnlySpecifiedOverrides(), name, exclude);
- }
-
- protected S addSpecifiedOverride() {
- return this.addSpecifiedOverride(this.specifiedOverrides.size());
- }
-
- protected S addSpecifiedOverride(int index) {
- X xmlOverride = this.buildXmlOverride();
- S override = this.addSpecifiedOverride_(index, xmlOverride);
- this.owner.getXmlOverrides().add(index, xmlOverride);
- return override;
- }
-
- protected abstract X buildXmlOverride();
-
- protected void removeSpecifiedOverride(S override) {
- this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override));
- }
-
- protected void removeSpecifiedOverride(int index) {
- this.removeSpecifiedOverride_(index);
- this.owner.getXmlOverrides().remove(index);
- }
-
- protected void removeSpecifiedOverride_(int index) {
- this.removeItemFromList(index, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
- }
-
- public void moveSpecifiedOverride(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
- this.owner.getXmlOverrides().move(targetIndex, sourceIndex);
- }
-
- protected void initializeSpecifiedOverrides() {
- for (X xmlOverride : this.getXmlOverrides()) {
- this.specifiedOverrides.add(this.buildSpecifiedOverride(xmlOverride));
- }
- }
-
- protected abstract S buildSpecifiedOverride(X xmlOverride);
-
- protected void syncSpecifiedOverrides() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedOverrideContainerAdapter);
- }
-
- protected Iterable<X> getXmlOverrides() {
- return (this.owner == null) ? EmptyIterable.<X>instance() : this.getXmlOverrides_();
- }
-
- /**
- * pre-condition: {@link #owner} is not <code>null</code>
- */
- protected abstract Iterable<X> getXmlOverrides_();
-
- protected void moveSpecifiedOverride_(int index, S override) {
- this.moveItemInList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
- }
-
- protected S addSpecifiedOverride_(int index, X xmlOverride) {
- S override = this.buildSpecifiedOverride(xmlOverride);
- this.addItemToList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
- return override;
- }
-
- protected void removeSpecifiedOverride_(S override) {
- this.removeSpecifiedOverride_(this.specifiedOverrides.indexOf(override));
- }
-
- /**
- * specified override container adapter
- */
- protected class SpecifiedOverrideContainerAdapter
- implements ContextContainerTools.Adapter<S, X>
- {
- public Iterable<S> getContextElements() {
- return AbstractOrmOverrideContainer.this.getSpecifiedOverrides();
- }
- public Iterable<X> getResourceElements() {
- return AbstractOrmOverrideContainer.this.getXmlOverrides();
- }
- @SuppressWarnings("unchecked")
- public X getResourceElement(S contextElement) {
- return (X) contextElement.getXmlOverride();
- }
- public void moveContextElement(int index, S element) {
- AbstractOrmOverrideContainer.this.moveSpecifiedOverride_(index, element);
- }
- public void addContextElement(int index, X resourceElement) {
- AbstractOrmOverrideContainer.this.addSpecifiedOverride_(index, resourceElement);
- }
- public void removeContextElement(S element) {
- AbstractOrmOverrideContainer.this.removeSpecifiedOverride_(element);
- }
- }
-
-
- // ********** virtual overrides **********
-
- public ListIterator<V> virtualOverrides() {
- return this.getVirtualOverrides().iterator();
- }
-
- protected ListIterable<V> getVirtualOverrides() {
- return new LiveCloneListIterable<V>(this.virtualOverrides);
- }
-
- @SuppressWarnings("unchecked")
- protected ListIterable<R> getReadOnlyVirtualOverrides() {
- // V should always be a subtype of R, but we can't enforce that in the
- // class declaration...
- return (ListIterable<R>) this.getVirtualOverrides();
- }
-
- public int virtualOverridesSize() {
- return this.virtualOverrides.size();
- }
-
- protected void updateVirtualOverrides() {
- ContextContainerTools.update(this.virtualOverrideContainerAdapter);
- }
-
- /**
- * Return the overridable names that are not already in the list of
- * specified overrides.
- */
- protected Iterable<String> getVirtualOverrideNames() {
- return CollectionTools.iterable(this.virtualOverrideNames());
- }
-
- protected Iterator<String> virtualOverrideNames() {
- return new FilteringIterator<String>(this.allOverridableNames()) {
- @Override
- protected boolean accept(String name) {
- return AbstractOrmOverrideContainer.this.overrideIsVirtual(name);
- }
- };
- }
-
- protected boolean overrideIsVirtual(String name) {
- return this.getSpecifiedOverrideNamed(name) == null;
- }
-
- protected void moveVirtualOverride(int index, V override) {
- this.moveItemInList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
- }
-
- protected V addVirtualOverride(int index, String name) {
- V override = this.buildVirtualOverride(name);
- this.addItemToList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
- return override;
- }
-
- protected abstract V buildVirtualOverride(String name);
-
- protected void removeVirtualOverride(V override) {
- this.removeItemFromList(override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
- }
-
- /**
- * virtual override container adapter
- * NB: the context override is matched with a resource override by name
- */
- protected class VirtualOverrideContainerAdapter
- implements ContextContainerTools.Adapter<V, String>
- {
- public Iterable<V> getContextElements() {
- return AbstractOrmOverrideContainer.this.getVirtualOverrides();
- }
- public Iterable<String> getResourceElements() {
- return AbstractOrmOverrideContainer.this.getVirtualOverrideNames();
- }
- public String getResourceElement(V contextElement) {
- return contextElement.getName();
- }
- public void moveContextElement(int index, V element) {
- AbstractOrmOverrideContainer.this.moveVirtualOverride(index, element);
- }
- public void addContextElement(int index, String resourceElement) {
- AbstractOrmOverrideContainer.this.addVirtualOverride(index, resourceElement);
- }
- public void removeContextElement(V element) {
- AbstractOrmOverrideContainer.this.removeVirtualOverride(element);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return this.owner.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return this.owner.getTypeMapping();
- }
-
- public Iterator<String> allOverridableNames() {
- return (this.owner != null) ? this.owner.allOverridableNames() : EmptyIterator.<String>instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.owner.tableNameIsInvalid(tableName);
- }
-
- public Iterator<String> candidateTableNames() {
- return this.owner.candidateTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.owner.getDefaultTableName();
- }
-
- public JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver) {
- return this.owner.buildValidator(override, this, textRangeResolver);
- }
-
- public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- protected R selectOverrideNamed(Iterable<R> overrides, String name) {
- return this.selectOverrideNamed(overrides, name, null);
- }
-
- protected R selectOverrideNamed(Iterable<R> overrides, String name, S exclude) {
- for (R override : overrides) {
- if (override == exclude) {
- continue; // skip
- }
- if (this.valuesAreEqual(override.getName(), name)) {
- return override;
- }
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- for (R override : this.getOverrides()) {
- override.validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return (this.specifiedOverrides.size() > 0) ?
- this.specifiedOverrides.get(0).getValidationTextRange() :
- this.owner.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
deleted file mode 100644
index 8b0df34953..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-
-/**
- * Virtual <code>orm.xml</code> override
- */
-public abstract class AbstractOrmVirtualOverride<C extends OrmOverrideContainer>
- extends AbstractOrmXmlContextNode
- implements OrmVirtualOverride
-{
- protected final String name; // never null
-
-
- protected AbstractOrmVirtualOverride(C parent, String name) {
- super(parent);
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public boolean isVirtual() {
- return true;
- }
-
- public OrmOverride convertToSpecified() {
- return this.getContainer().convertOverrideToSpecified(this);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public C getParent() {
- return (C) super.getParent();
- }
-
- public C getContainer() {
- return this.getParent();
- }
-
- public TextRange getValidationTextRange() {
- return this.getContainer().getValidationTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java
deleted file mode 100644
index a6ae9ee62b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>entity-mappings</code> element
- */
-public class GenericEntityMappings
- extends AbstractEntityMappings
-{
- public GenericEntityMappings(OrmXml parent, XmlEntityMappings resource) {
- super(parent, resource);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
deleted file mode 100644
index 25b6eb44c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified <code>orm.xml</code> association override
- */
-public class GenericOrmAssociationOverride
- extends AbstractOrmOverride<OrmAssociationOverrideContainer, XmlAssociationOverride>
- implements OrmAssociationOverride
-{
- protected final OrmOverrideRelationship relationship;
-
-
- public GenericOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride) {
- super(parent, xmlOverride);
- this.relationship = this.buildRelationship();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.relationship.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.relationship.update();
- }
-
-
- // ********** specified/virtual **********
-
- @Override
- public OrmVirtualAssociationOverride convertToVirtual() {
- return (OrmVirtualAssociationOverride) super.convertToVirtual();
- }
-
-
- // ********** relationship **********
-
- public OrmOverrideRelationship getRelationship() {
- return this.relationship;
- }
-
- protected OrmOverrideRelationship buildRelationship() {
- return this.getContextNodeFactory().buildOrmOverrideRelationship(this);
- }
-
-
- // ********** misc **********
-
- public RelationshipMapping getMapping() {
- return this.getContainer().getRelationshipMapping(this.name);
- }
-
- public void initializeFrom(ReadOnlyAssociationOverride oldOverride) {
- super.initializeFrom(oldOverride);
- this.relationship.initializeFrom(oldOverride.getRelationship());
- }
-
- public void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride) {
- super.initializeFromVirtual(virtualOverride);
- this.relationship.initializeFromVirtual(virtualOverride.getRelationship());
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.relationship.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
deleted file mode 100644
index 6b34106360..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-
-/**
- * <code>orm.xml</code> association override container
- */
-public class GenericOrmAssociationOverrideContainer
- extends AbstractOrmOverrideContainer<
- OrmAssociationOverrideContainer.Owner,
- OrmReadOnlyAssociationOverride,
- OrmAssociationOverride,
- OrmVirtualAssociationOverride,
- XmlAssociationOverride
- >
- implements OrmAssociationOverrideContainer
-{
- public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public RelationshipMapping getRelationshipMapping(String attributeName) {
- return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
- }
-
- public Relationship resolveOverriddenRelationship(String associationOverrideName) {
- return this.owner.resolveOverriddenRelationship(associationOverrideName);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.owner.buildJoinTableJoinColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
- return this.owner.buildTableValidator(override, table, textRangeResolver);
- }
-
- @Override
- protected Iterable<XmlAssociationOverride> getXmlOverrides_() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlAssociationOverride>(this.owner.getXmlOverrides());
- }
-
- @Override
- protected XmlAssociationOverride buildXmlOverride() {
- return OrmFactory.eINSTANCE.createXmlAssociationOverride();
- }
-
- @Override
- protected OrmAssociationOverride buildSpecifiedOverride(XmlAssociationOverride xmlOverride) {
- return this.getContextNodeFactory().buildOrmAssociationOverride(this, xmlOverride);
- }
-
- @Override
- protected void initializeSpecifiedOverride(OrmAssociationOverride specifiedOverride, OrmVirtualAssociationOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected OrmVirtualAssociationOverride buildVirtualOverride(String name) {
- return this.getContextNodeFactory().buildOrmVirtualAssociationOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
deleted file mode 100644
index 9e6b30c0dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.context.BaseColumn;
-import org.eclipse.jpt.jpa.core.context.NamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-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.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified <code>orm.xml</code> attribute override
- */
-public class GenericOrmAttributeOverride
- extends AbstractOrmOverride<OrmAttributeOverrideContainer, XmlAttributeOverride>
- implements OrmAttributeOverride, OrmColumn.Owner
-{
- protected final OrmColumn column;
-
-
- public GenericOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride) {
- super(parent, xmlOverride);
- this.column = this.buildColumn();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.column.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update();
- }
-
-
- // ********** specified/virtual **********
-
- @Override
- public OrmVirtualAttributeOverride convertToVirtual() {
- return (OrmVirtualAttributeOverride) super.convertToVirtual();
- }
-
-
- // ********** column **********
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- protected OrmColumn buildColumn() {
- return this.getContextNodeFactory().buildOrmColumn(this, this);
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyAttributeOverride oldOverride) {
- super.initializeFrom(oldOverride);
- this.column.initializeFrom(oldOverride.getColumn());
- }
-
- public void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride) {
- super.initializeFromVirtual(oldOverride);
- this.column.initializeFromVirtual(oldOverride.getColumn());
- }
-
-
- // ********** column owner implementation **********
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public String getDefaultTableName() {
- return this.getContainer().getDefaultTableName();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getContainer().resolveDbTable(tableName);
- }
-
- public String getDefaultColumnName() {
- return this.name;
- }
-
- public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, (BaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getContainer().tableNameIsInvalid(tableName);
- }
-
- public Iterator<String> candidateTableNames() {
- return this.getContainer().candidateTableNames();
- }
-
- public XmlColumn getXmlColumn() {
- return this.getXmlOverride().getColumn();
- }
-
- public XmlColumn buildXmlColumn() {
- XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
- this.getXmlOverride().setColumn(xmlColumn);
- return xmlColumn;
- }
-
- public void removeXmlColumn() {
- this.getXmlOverride().setColumn(null);
- }
-
-
- // ********** mapped by relationship **********
-
- protected boolean isMappedByRelationship() {
- return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.buildQualifier());
- }
-
- protected Iterable<String> getMappedByRelationshipAttributeNames() {
- return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
- }
-
- /**
- * overridable names are (usually?) qualified with a container mapping,
- * which may also be the one mapped by a relationship
- */
- protected String buildQualifier() {
- if (this.name == null) {
- return null;
- }
- int index = this.name.indexOf('.');
- return (index == -1) ? this.name : this.name.substring(0, index);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- // [JPA 2.0] if the column is specified, or if the override is not mapped by a relationship,
- // then the column is validated.
- // (In JPA 1.0, the column will always be validated, since the override is never mapped by a
- // relationship)
- if (this.xmlColumnIsSpecified() || ! this.isMappedByRelationship()) {
- this.column.validate(messages, reporter);
- }
-
- // [JPA 2.0] if the override is mapped by a relationship, then that actually is in itself
- // a validation error
- // (We prevent implied overrides that are mapped by a relationship ... hopefully)
- // (In JPA 1.0, this will never occur)
- if (this.isMappedByRelationship()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- protected boolean xmlColumnIsSpecified() {
- return this.getXmlColumn() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
deleted file mode 100644
index 7501968550..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-
-/**
- * <code>orm.xml</code> attribute override container
- */
-public class GenericOrmAttributeOverrideContainer
- extends AbstractOrmOverrideContainer<
- OrmAttributeOverrideContainer.Owner,
- OrmReadOnlyAttributeOverride,
- OrmAttributeOverride,
- OrmVirtualAttributeOverride,
- XmlAttributeOverride
- >
- implements OrmAttributeOverrideContainer
-{
- public GenericOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public Column resolveOverriddenColumn(String attributeName) {
- return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName);
- }
-
- @Override
- protected Iterable<XmlAttributeOverride> getXmlOverrides_() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlAttributeOverride>(this.owner.getXmlOverrides());
- }
-
- @Override
- protected XmlAttributeOverride buildXmlOverride() {
- return OrmFactory.eINSTANCE.createXmlAttributeOverride();
- }
-
- @Override
- protected OrmAttributeOverride buildSpecifiedOverride(XmlAttributeOverride xmlOverride) {
- return this.getContextNodeFactory().buildOrmAttributeOverride(this, xmlOverride);
- }
-
- public void initializeFrom(OrmAttributeOverrideContainer oldContainer) {
- for (OrmAttributeOverride oldOverride : CollectionTools.iterable(oldContainer.specifiedOverrides())) {
- this.addSpecifiedOverride().initializeFrom(oldOverride);
- }
- }
-
- @Override
- protected void initializeSpecifiedOverride(OrmAttributeOverride specifiedOverride, OrmVirtualAttributeOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected OrmVirtualAttributeOverride buildVirtualOverride(String name) {
- return this.getContextNodeFactory().buildOrmVirtualAttributeOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
deleted file mode 100644
index 99f763d272..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBasicMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
-
-/**
- * <code>orm.xml</code> basic mapping
- */
-public class GenericOrmBasicMapping
- extends AbstractOrmBasicMapping<XmlBasic>
-{
- public GenericOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
deleted file mode 100644
index 76cba3a5c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Cascade;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCascade2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.CascadeType;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-
-public class GenericOrmCascade
- extends AbstractOrmXmlContextNode
- implements OrmCascade2_0
-{
- protected boolean all;
-
- protected boolean persist;
-
- protected boolean merge;
-
- protected boolean remove;
-
- protected boolean refresh;
-
- /* JPA 2.0 */
- protected boolean detach;
-
-
- /**
- * This is built directly by the mapping implementation; as opposed to via
- * a platform-specific factory.
- * @see AbstractOrmRelationshipMapping#buildCascade()
- */
- public GenericOrmCascade(OrmRelationshipMapping parent) {
- super(parent);
- this.all = this.buildAll();
- this.persist = this.buildPersist();
- this.merge = this.buildMerge();
- this.remove = this.buildRemove();
- this.refresh = this.buildRefresh();
- this.detach = this.buildDetach();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setAll_(this.buildAll());
- this.setPersist_(this.buildPersist());
- this.setMerge_(this.buildMerge());
- this.setRemove_(this.buildRemove());
- this.setRefresh_(this.buildRefresh());
- this.setDetach_(this.buildDetach());
- }
-
-
- // ********** all **********
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- if (this.all != all) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setAll_(all);
- xmlCascade.setCascadeAll(all);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected void setAll_(boolean all) {
- boolean old = this.all;
- this.all = all;
- this.firePropertyChanged(ALL_PROPERTY, old, all);
- }
-
- protected boolean buildAll() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeAll();
- }
-
-
- // ********** persist **********
-
- public boolean isPersist() {
- return this.persist;
- }
-
- public void setPersist(boolean persist) {
- if (this.persist != persist) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setPersist_(persist);
- xmlCascade.setCascadePersist(persist);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setPersist_(boolean persist) {
- boolean old = this.persist;
- this.persist = persist;
- return this.firePropertyChanged(PERSIST_PROPERTY, old, persist);
- }
-
- protected boolean buildPersist() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadePersist();
- }
-
-
- // ********** merge **********
-
- public boolean isMerge() {
- return this.merge;
- }
-
- public void setMerge(boolean merge) {
- if (this.merge != merge) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setMerge_(merge);
- xmlCascade.setCascadeMerge(merge);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setMerge_(boolean merge) {
- boolean old = this.merge;
- this.merge = merge;
- return this.firePropertyChanged(MERGE_PROPERTY, old, merge);
- }
-
- protected boolean buildMerge() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeMerge();
- }
-
-
- // ********** remove **********
-
- public boolean isRemove() {
- return this.remove;
- }
-
- public void setRemove(boolean remove) {
- if (this.remove != remove) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setRemove_(remove);
- xmlCascade.setCascadeRemove(remove);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setRemove_(boolean remove) {
- boolean old = this.remove;
- this.remove = remove;
- return this.firePropertyChanged(REMOVE_PROPERTY, old, remove);
- }
-
- protected boolean buildRemove() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeRemove();
- }
-
-
- // ********** refresh **********
-
- public boolean isRefresh() {
- return this.refresh;
- }
-
- public void setRefresh(boolean refresh) {
- if (this.refresh != refresh) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setRefresh_(refresh);
- xmlCascade.setCascadeRefresh(refresh);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setRefresh_(boolean refresh) {
- boolean old = this.refresh;
- this.refresh = refresh;
- return this.firePropertyChanged(REFRESH_PROPERTY, old, refresh);
- }
-
- protected boolean buildRefresh() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeRefresh();
- }
-
-
- // ********** detach **********
-
- public boolean isDetach() {
- return this.detach;
- }
-
- public void setDetach(boolean detach) {
- if (this.detach != detach) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setDetach_(detach);
- xmlCascade.setCascadeDetach(detach);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setDetach_(boolean detach) {
- boolean old = this.detach;
- this.detach = detach;
- return this.firePropertyChanged(DETACH_PROPERTY, old, detach);
- }
-
- protected boolean buildDetach() {
- return this.isJpa2_0Compatible() && this.buildDetach_();
- }
-
- protected boolean buildDetach_() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeDetach();
- }
-
-
- // ********** XML cascade **********
-
- /**
- * Return <code>null</code> if XML cascade does not exists.
- */
- protected CascadeType getXmlCascade() {
- return this.getXmlRelationshipMapping().getCascade();
- }
-
- /**
- * Build the XML cascade if it does not exist.
- */
- protected CascadeType getXmlCascadeForUpdate() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) ? xmlCascade : this.buildXmlCascade();
- }
-
- protected CascadeType buildXmlCascade() {
- CascadeType xmlCascade = OrmFactory.eINSTANCE.createCascadeType();
- this.getXmlRelationshipMapping().setCascade(xmlCascade);
- return xmlCascade;
- }
-
- protected void removeXmlCascadeIfUnset() {
- if (this.getXmlCascade().isUnset()) {
- this.removeXmlCascade();
- }
- }
-
- protected void removeXmlCascade() {
- this.getXmlRelationshipMapping().setCascade(null);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmRelationshipMapping getParent() {
- return (OrmRelationshipMapping) super.getParent();
- }
-
- protected OrmRelationshipMapping getRelationshipMapping() {
- return this.getParent();
- }
-
- protected AbstractXmlRelationshipMapping getXmlRelationshipMapping() {
- return this.getRelationshipMapping().getXmlAttributeMapping();
- }
-
- public void initializeFrom(Cascade oldCascade) {
- this.setAll(oldCascade.isAll());
- this.setPersist(oldCascade.isPersist());
- this.setMerge(oldCascade.isMerge());
- this.setRemove(oldCascade.isRemove());
- this.setRefresh(oldCascade.isRefresh());
- if (this.isJpa2_0Compatible()) {
- this.setDetach(((Cascade2_0) oldCascade).isDetach());
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getRelationshipMapping().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade == null) ? null : xmlCascade.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java
deleted file mode 100644
index 6e254476eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-
-/**
- * <code>orm.xml</code> column
- */
-public class GenericOrmColumn
- extends AbstractOrmBaseColumn<XmlColumn, OrmColumn.Owner>
- implements OrmColumn
-{
- // TODO defaults from java for all of these settings
- protected Integer specifiedLength;
-
- protected Integer specifiedPrecision;
-
- protected Integer specifiedScale;
-
-
- public GenericOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
- super(parent, owner);
- this.specifiedLength = this.buildSpecifiedLength();
- this.specifiedPrecision = this.buildSpecifiedPrecision();
- this.specifiedScale = this.buildSpecifiedScale();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedLength_(this.buildSpecifiedLength());
- this.setSpecifiedPrecision_(this.buildSpecifiedPrecision());
- this.setSpecifiedScale_(this.buildSpecifiedScale());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlColumn getXmlColumn() {
- return this.owner.getXmlColumn();
- }
-
- @Override
- protected XmlColumn buildXmlColumn() {
- return this.owner.buildXmlColumn();
- }
-
- @Override
- protected void removeXmlColumn() {
- this.owner.removeXmlColumn();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.getDefaultLength();
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer length) {
- if (this.valuesAreDifferent(this.specifiedLength, length)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedLength_(length);
- xmlColumn.setLength(length);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedLength_(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getLength();
- }
-
- public int getDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.getDefaultPrecision();
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- public void setSpecifiedPrecision(Integer precision) {
- if (this.valuesAreDifferent(this.specifiedPrecision, precision)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedPrecision_(precision);
- xmlColumn.setPrecision(precision);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedPrecision_(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getPrecision();
- }
-
- public int getDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.getDefaultScale();
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- public void setSpecifiedScale(Integer scale) {
- if (this.valuesAreDifferent(this.specifiedScale, scale)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedScale_(scale);
- xmlColumn.setScale(scale);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedScale_(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getScale();
- }
-
- public int getDefaultScale() {
- return DEFAULT_SCALE;
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyColumn oldColumn) {
- super.initializeFrom(oldColumn);
- this.setSpecifiedLength(oldColumn.getSpecifiedLength());
- this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
- this.setSpecifiedScale(oldColumn.getSpecifiedScale());
- }
-
- public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
- super.initializeFromVirtual(virtualColumn);
- // ignore other settings?
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
deleted file mode 100644
index be90386975..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
-
-/**
- * <code>orm.xml</code> discriminator column
- */
-public class GenericOrmDiscriminatorColumn
- extends AbstractOrmNamedColumn<XmlDiscriminatorColumn, OrmDiscriminatorColumn.Owner>
- implements OrmDiscriminatorColumn
-{
- protected DiscriminatorType specifiedDiscriminatorType;
- protected DiscriminatorType defaultDiscriminatorType;
-
- protected Integer specifiedLength;
- protected int defaultLength;
-
-
- public GenericOrmDiscriminatorColumn(XmlContextNode parent, OrmDiscriminatorColumn.Owner owner) {
- super(parent, owner);
- this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType();
- this.specifiedLength = this.buildSpecifiedLength();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType());
- this.setSpecifiedLength_(this.buildSpecifiedLength());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
- this.setDefaultLength(this.buildDefaultLength());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlDiscriminatorColumn getXmlColumn() {
- return this.owner.getXmlColumn();
- }
-
- @Override
- protected XmlDiscriminatorColumn buildXmlColumn() {
- return this.owner.buildXmlColumn();
- }
-
- @Override
- protected void removeXmlColumn() {
- this.owner.removeXmlColumn();
- }
-
-
- // ********** discriminator type **********
-
- public DiscriminatorType getDiscriminatorType() {
- return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType;
- }
-
- public DiscriminatorType getSpecifiedDiscriminatorType() {
- return this.specifiedDiscriminatorType;
- }
-
- public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) {
- if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedDiscriminatorType_(discriminatorType);
- xmlColumn.setDiscriminatorType(DiscriminatorType.toOrmResourceModel(discriminatorType));
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = discriminatorType;
- this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- protected DiscriminatorType buildSpecifiedDiscriminatorType() {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : DiscriminatorType.fromOrmResourceModel(xmlColumn.getDiscriminatorType());
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- return this.defaultDiscriminatorType;
- }
-
- protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.defaultDiscriminatorType;
- this.defaultDiscriminatorType = discriminatorType;
- this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- protected DiscriminatorType buildDefaultDiscriminatorType() {
- return this.owner.getDefaultDiscriminatorType();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer length) {
- if (this.valuesAreDifferent(this.specifiedLength, length)) {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedLength_(length);
- xmlColumn.setLength(length);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedLength_(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int defaultLength) {
- int old = this.defaultLength;
- this.defaultLength = defaultLength;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength);
- }
-
- protected int buildDefaultLength() {
- return this.owner.getDefaultLength();
- }
-
-
- // ********** validation **********
-
- public boolean isResourceSpecified() {
- return this.getXmlColumn() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
deleted file mode 100644
index 9ecf827277..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-
-/**
- * <code>orm.xml</code> embeddable type mapping
- */
-public class GenericOrmEmbeddable
- extends AbstractOrmEmbeddable<XmlEmbeddable>
-{
- public GenericOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(GenericJavaEmbeddable.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
deleted file mode 100644
index b8fad23d1c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded ID mapping
- */
-public class GenericOrmEmbeddedIdMapping
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>
- implements EmbeddedIdMapping2_0, OrmEmbeddedIdMapping
-{
- /* JPA 2.0 feature - a relationship may map this embedded ID */
- protected boolean mappedByRelationship;
-
-
- public GenericOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.setMappedByRelationship(this.buildMappedByRelationship());
- }
-
-
- // ********** mapped by relationship **********
-
- public boolean isMappedByRelationship() {
- return this.mappedByRelationship;
- }
-
- protected void setMappedByRelationship(boolean value) {
- boolean old = this.mappedByRelationship;
- this.mappedByRelationship = value;
- this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value);
- }
-
- protected boolean buildMappedByRelationship() {
- return this.isJpa2_0Compatible() && this.buildMappedByRelationship_();
- }
-
- protected boolean buildMappedByRelationship_() {
- return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.name);
- }
-
- protected Iterable<String> getMappedByRelationshipAttributeNames() {
- return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 10;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmEmbeddedIdMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- xmlAttributes.getEmbeddedIds().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- xmlAttributes.getEmbeddedIds().remove(this.xmlAttributeMapping);
- }
-
- @Override
- protected Iterator<String> embeddableOverridableAttributeMappingNames() {
- return this.mappedByRelationship ?
- EmptyIterator.<String>instance() :
- super.embeddableOverridableAttributeMappingNames();
- }
-
- @Override
- protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
- return new AttributeOverrideContainerOwner();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- // [JPA 2.0] if the embedded id is mapped by a relationship, then any specified
- // attribute overrides are in error
- // (in JPA 1.0, this will obviously never be reached)
- if (this.mappedByRelationship
- && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED,
- EMPTY_STRING_ARRAY,
- this.attributeOverrideContainer,
- this.attributeOverrideContainer.getValidationTextRange()
- )
- );
- }
- }
-
-
- // ********** attribute override container owner *********
-
- protected class AttributeOverrideContainerOwner
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>.AttributeOverrideContainerOwner
- {
- @Override
- public Iterator<String> allOverridableNames() {
- return GenericOrmEmbeddedIdMapping.this.isMappedByRelationship() ?
- EmptyIterator.<String>instance() :
- super.allOverridableNames();
- }
-
- /**
- * pre-condition: type mapping is not <code>null</code>
- */
- @Override
- protected Iterator<String> allOverridableAttributeNames_(TypeMapping typeMapping) {
- final Set<String> mappedByRelationshipAttributeNames = this.buildMappedByRelationshipAttributeNames();
- if (mappedByRelationshipAttributeNames.isEmpty()) {
- return super.allOverridableAttributeNames_(typeMapping);
- }
- return new FilteringIterator<String>(super.allOverridableAttributeNames_(typeMapping)) {
- @Override
- protected boolean accept(String attributeName) {
- // overridable names are (usually?) qualified with a container mapping,
- // which may also be the one mapped by a relationship
- int dotIndex = attributeName.indexOf('.');
- String qualifier = (dotIndex > 0) ? attributeName.substring(0, dotIndex) : attributeName;
- return ! mappedByRelationshipAttributeNames.contains(qualifier);
- }
- };
- }
-
- protected Set<String> buildMappedByRelationshipAttributeNames() {
- return CollectionTools.set(GenericOrmEmbeddedIdMapping.this.getMappedByRelationshipAttributeNames());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
deleted file mode 100644
index 32ec16c4b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.BaseColumn;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.JoinTable;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Override_;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded mapping
- */
-public class GenericOrmEmbeddedMapping
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbedded>
- implements OrmEmbeddedMapping2_0
-{
- protected final OrmAssociationOverrideContainer associationOverrideContainer;
-
-
- public GenericOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded xmlMapping) {
- super(parent, xmlMapping);
- this.associationOverrideContainer = this.buildAssociationOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.associationOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.associationOverrideContainer.update();
- }
-
-
- // ********** association override container **********
-
- public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
- protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) :
- new GenericOrmAssociationOverrideContainer(this, null);
- }
-
- protected OrmAssociationOverrideContainer.Owner buildAssociationOverrideContainerOwner() {
- return new AssociationOverrideContainerOwner();
- }
-
-
- // ********** embedded mappings **********
-
- /**
- * This is only to build the choices for a "mapped by" setting in a
- * relationship mapping. JPA 2.0 does not support relationship mappings
- * in an embedded ID class; so we only put this logic here.
- */
- @Override
- @SuppressWarnings("unchecked")
- public Iterator<String> allMappingNames() {
- return this.isJpa2_0Compatible() ?
- new CompositeIterator<String>(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()) :
- super.allMappingNames();
- }
-
- protected Iterator<String> allEmbeddableAttributeMappingNames() {
- return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterator<RelationshipMapping> allOverridableAssociations() {
- return (this.targetEmbeddable != null) ?
- new SubIteratorWrapper<AttributeMapping, RelationshipMapping>(this.allOverridableAssociations_()) :
- EmptyIterator.<RelationshipMapping>instance();
- }
-
- protected Iterator<AttributeMapping> allOverridableAssociations_() {
- return new FilteringIterator<AttributeMapping>(this.targetEmbeddable.attributeMappings()) {
- @Override
- protected boolean accept(AttributeMapping attributeMapping) {
- return attributeMapping.isOverridableAssociationMapping();
- }
- };
- }
-
- @Override
- public AttributeMapping resolveAttributeMapping(String attributeName) {
- AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- return this.isJpa2_0Compatible() ? this.resolveAttributeMapping_(attributeName) : null;
- }
-
- protected AttributeMapping resolveAttributeMapping_(String attributeName) {
- attributeName = this.unqualify(attributeName);
- if (attributeName == null) {
- return null;
- }
- // recurse into the embeddable mappings
- for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) {
- AttributeMapping resolvedMapping = mapping.resolveAttributeMapping(attributeName);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- return null;
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 80;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmEmbeddedMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- xmlAttributes.getEmbeddeds().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- xmlAttributes.getEmbeddeds().remove(this.xmlAttributeMapping);
- }
-
- @Override
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return this.isJpa2_0Compatible() ? this.resolveOverriddenRelationship_(attributeName) : null;
- }
-
- protected Relationship resolveOverriddenRelationship_(String attributeName) {
- attributeName = this.unqualify(attributeName);
- if (attributeName == null) {
- return null;
- }
- AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
- // recurse into the target embeddable if necessary
- return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName);
- }
-
- protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) {
- return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenRelationship(attributeName);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateOverrides(List<IMessage> messages, IReporter reporter) {
- super.validateOverrides(messages, reporter);
- this.associationOverrideContainer.validate(messages, reporter);
- }
-
-
- // ********** association override container owner **********
-
- protected class AssociationOverrideContainerOwner
- implements OrmAssociationOverrideContainer.Owner
- {
- protected String getMappingName() {
- return GenericOrmEmbeddedMapping.this.getName();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return GenericOrmEmbeddedMapping.this.getTypeMapping();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return GenericOrmEmbeddedMapping.this.getTargetEmbeddable();
- }
-
- public Iterator<String> allOverridableNames() {
- TypeMapping typeMapping = this.getOverridableTypeMapping();
- return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.<String>instance();
- }
-
- public EList<XmlAssociationOverride> getXmlOverrides() {
- return GenericOrmEmbeddedMapping.this.getXmlAttributeMapping().getAssociationOverrides();
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterator<String> candidateTableNames() {
- return this.getTypeMapping().allAssociatedTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmEmbeddedMapping.this.getValidationTextRange();
- }
-
- public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (JoinTable) table, textRangeResolver);
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return GenericOrmEmbeddedMapping.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
deleted file mode 100644
index 839ccc846d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEntity;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
-
-public class GenericOrmEntity
- extends AbstractOrmEntity<XmlEntity>
-{
- // EclipseLink holds its cacheable in its caching
- protected final OrmCacheable2_0 cacheable;
-
-
- public GenericOrmEntity(OrmPersistentType parent, XmlEntity xmlEntity) {
- super(parent, xmlEntity);
- this.cacheable = this.buildCacheable();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.cacheable.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.cacheable.update();
- }
-
-
- // ********** cacheable **********
-
- public OrmCacheable2_0 getCacheable() {
- return this.cacheable;
- }
-
- protected OrmCacheable2_0 buildCacheable() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmCacheable(this) :
- new NullOrmCacheable2_0(this);
- }
-
- public boolean calculateDefaultCacheable() {
- CacheableHolder2_0 javaEntity = (CacheableHolder2_0) this.getJavaTypeMappingForDefaults();
- if (javaEntity != null) {
- return javaEntity.getCacheable().isCacheable();
- }
-
- Cacheable2_0 parentCacheable = this.getParentCacheable();
- return (parentCacheable != null) ?
- parentCacheable.isCacheable() :
- ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable();
- }
-
- protected Cacheable2_0 getParentCacheable() {
- CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getCacheable();
- }
-
- public XmlCacheable_2_0 getXmlCacheable() {
- return this.getXmlTypeMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
deleted file mode 100644
index 06bfd06add..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.EnumType;
-import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class GenericOrmEnumeratedConverter
- extends AbstractOrmConverter
- implements OrmEnumeratedConverter
-{
- protected EnumType specifiedEnumType;
- protected EnumType defaultEnumType;
-
-
- public GenericOrmEnumeratedConverter(OrmAttributeMapping parent) {
- super(parent);
- this.specifiedEnumType = this.buildSpecifiedEnumType();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultEnumType(this.buildDefaultEnumType());
- }
-
-
- // ********** enum type **********
-
- public EnumType getEnumType() {
- return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.getDefaultEnumType();
- }
-
- public EnumType getSpecifiedEnumType() {
- return this.specifiedEnumType;
- }
-
- public void setSpecifiedEnumType(EnumType enumType) {
- this.setSpecifiedEnumType_(enumType);
- this.setXmlEnumerated(enumType);
- }
-
- protected void setSpecifiedEnumType_(EnumType enumType) {
- EnumType old = this.specifiedEnumType;
- this.specifiedEnumType = enumType;
- this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- protected void setXmlEnumerated(EnumType enumType) {
- this.getXmlConvertibleMapping().setEnumerated(EnumType.toOrmResourceModel(enumType));
- }
-
- protected EnumType buildSpecifiedEnumType() {
- return EnumType.fromOrmResourceModel(this.getXmlConvertibleMapping().getEnumerated());
- }
-
- public EnumType getDefaultEnumType() {
- return this.defaultEnumType;
- }
-
- protected void setDefaultEnumType(EnumType enumType) {
- EnumType old = this.defaultEnumType;
- this.defaultEnumType = enumType;
- this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- /**
- * There is no default enum type in XML.
- * If you specify the enumerated element, you must
- * specify either {@link EnumType#ORDINAL} or
- * {@link EnumType#STRING}.
- */
- protected EnumType buildDefaultEnumType() {
- return null;
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return EnumeratedConverter.class;
- }
-
- public void initialize() {
- this.specifiedEnumType = DEFAULT_ENUM_TYPE;
- this.setXmlEnumerated(this.specifiedEnumType);
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getEnumeratedTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
deleted file mode 100644
index 33c0c8fc93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.GenerationType;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> generated value
- */
-public class GenericOrmGeneratedValue
- extends AbstractOrmXmlContextNode
- implements OrmGeneratedValue
-{
- protected final XmlGeneratedValue xmlGeneratedValue;
-
- protected GenerationType specifiedStrategy;
- protected GenerationType defaultStrategy;
-
- protected String specifiedGenerator;
- protected String defaultGenerator;
-
-
- public GenericOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue xmlGeneratedValue) {
- super(parent);
- this.xmlGeneratedValue = xmlGeneratedValue;
- this.specifiedStrategy = this.buildSpecifiedStrategy();
- this.specifiedGenerator = xmlGeneratedValue.getGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
- this.setSpecifiedGenerator_(this.xmlGeneratedValue.getGenerator());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultStrategy(this.buildDefaultStrategy());
- this.setDefaultGenerator(this.buildDefaultGenerator());
- }
-
-
- // ********** strategy **********
-
- public GenerationType getStrategy() {
- return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy;
- }
-
- public GenerationType getSpecifiedStrategy() {
- return this.specifiedStrategy;
- }
-
- public void setSpecifiedStrategy(GenerationType strategy) {
- this.setSpecifiedStrategy_(strategy);
- this.xmlGeneratedValue.setStrategy(GenerationType.toOrmResourceModel(strategy));
- }
-
- protected void setSpecifiedStrategy_(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected GenerationType buildSpecifiedStrategy() {
- return GenerationType.fromOrmResourceModel(this.xmlGeneratedValue.getStrategy());
- }
-
- public GenerationType getDefaultStrategy() {
- return this.defaultStrategy;
- }
-
- protected void setDefaultStrategy(GenerationType strategy) {
- GenerationType old = this.defaultStrategy;
- this.defaultStrategy = strategy;
- this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy);
- }
-
- // TODO
- protected GenerationType buildDefaultStrategy() {
- return DEFAULT_STRATEGY;
- }
-
-
- // ********** generator **********
-
- public String getGenerator() {
- return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
- }
-
- public String getSpecifiedGenerator() {
- return this.specifiedGenerator;
- }
-
- public void setSpecifiedGenerator(String generator) {
- this.setSpecifiedGenerator_(generator);
- this.xmlGeneratedValue.setGenerator(generator);
- }
-
- protected void setSpecifiedGenerator_(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
- public String getDefaultGenerator() {
- return this.defaultGenerator;
- }
-
- protected void setDefaultGenerator(String generator) {
- String old = this.defaultGenerator;
- this.defaultGenerator = generator;
- this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator);
- }
-
- // TODO
- protected String buildDefaultGenerator() {
- return null;
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public XmlGeneratedValue getXmlGeneratedValue() {
- return this.xmlGeneratedValue;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- String generator = this.getGenerator();
- if (generator == null) {
- return;
- }
-
- for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
- if (generator.equals(stream.next().getName())) {
- return;
- }
- }
-
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
- new String[] {generator},
- this.getParent(),
- this.getGeneratorTextRange()
- )
- );
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlGeneratedValue.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- public TextRange getGeneratorTextRange() {
- return this.getValidationTextRange(this.xmlGeneratedValue.getGeneratorTextRange());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
deleted file mode 100644
index 07d580f8df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmGeneratorContainer
- extends AbstractOrmXmlContextNode
- implements OrmGeneratorContainer
-{
- protected final XmlGeneratorContainer xmlGeneratorContainer;
-
- protected OrmSequenceGenerator sequenceGenerator;
-
- protected OrmTableGenerator tableGenerator;
-
-
- public GenericOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer xmlGeneratorContainer) {
- super(parent);
- this.xmlGeneratorContainer = xmlGeneratorContainer;
- this.sequenceGenerator = this.buildSequenceGenerator();
- this.tableGenerator = this.buildTableGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSequenceGenerator();
- this.syncTableGenerator();
- }
-
- @Override
- public void update() {
- super.update();
- if (this.sequenceGenerator != null) {
- this.sequenceGenerator.update();
- }
- if (this.tableGenerator != null) {
- this.tableGenerator.update();
- }
- }
-
-
- // ********** sequence generator **********
-
- public OrmSequenceGenerator getSequenceGenerator() {
- return this.sequenceGenerator;
- }
-
- public OrmSequenceGenerator addSequenceGenerator() {
- if (this.sequenceGenerator != null) {
- throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$
- }
- XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
- OrmSequenceGenerator generator = this.buildSequenceGenerator(xmlGenerator);
- this.setSequenceGenerator_(generator);
- this.xmlGeneratorContainer.setSequenceGenerator(xmlGenerator);
- return generator;
- }
-
- protected XmlSequenceGenerator buildXmlSequenceGenerator() {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- }
-
- public void removeSequenceGenerator() {
- if (this.sequenceGenerator == null) {
- throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$
- }
- this.setSequenceGenerator_(null);
- this.xmlGeneratorContainer.setSequenceGenerator(null);
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator() {
- XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
- return (xmlGenerator == null) ? null : this.buildSequenceGenerator(xmlGenerator);
- }
-
- protected XmlSequenceGenerator getXmlSequenceGenerator() {
- return this.xmlGeneratorContainer.getSequenceGenerator();
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) {
- return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator);
- }
-
- protected void syncSequenceGenerator() {
- XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
- if (xmlGenerator == null) {
- if (this.sequenceGenerator != null) {
- this.setSequenceGenerator_(null);
- }
- } else {
- if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getXmlGenerator() == xmlGenerator)) {
- this.sequenceGenerator.synchronizeWithResourceModel();
- } else {
- this.setSequenceGenerator_(this.buildSequenceGenerator(xmlGenerator));
- }
- }
- }
-
- protected void setSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
- OrmSequenceGenerator old = this.sequenceGenerator;
- this.sequenceGenerator = sequenceGenerator;
- this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator);
- }
-
-
- // ********** table generator **********
-
- public OrmTableGenerator getTableGenerator() {
- return this.tableGenerator;
- }
-
- public OrmTableGenerator addTableGenerator() {
- if (this.tableGenerator != null) {
- throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$
- }
- XmlTableGenerator xmlGenerator = this.buildXmlTableGenerator();
- OrmTableGenerator generator = this.buildTableGenerator(xmlGenerator);
- this.setTableGenerator_(generator);
- this.xmlGeneratorContainer.setTableGenerator(xmlGenerator);
- return generator;
- }
-
- protected XmlTableGenerator buildXmlTableGenerator() {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-
- public void removeTableGenerator() {
- if (this.tableGenerator == null) {
- throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$
- }
- this.setTableGenerator_(null);
- this.xmlGeneratorContainer.setTableGenerator(null);
- }
-
- protected OrmTableGenerator buildTableGenerator() {
- XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
- return (xmlGenerator == null) ? null : this.buildTableGenerator(xmlGenerator);
- }
-
- protected XmlTableGenerator getXmlTableGenerator() {
- return this.xmlGeneratorContainer.getTableGenerator();
- }
-
- protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) {
- return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator);
- }
-
- protected void syncTableGenerator() {
- XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
- if (xmlGenerator == null) {
- if (this.tableGenerator != null) {
- this.setTableGenerator_(null);
- }
- } else {
- if ((this.tableGenerator != null) && (this.tableGenerator.getXmlGenerator() == xmlGenerator)) {
- this.tableGenerator.synchronizeWithResourceModel();
- } else {
- this.setTableGenerator_(this.buildTableGenerator(xmlGenerator));
- }
- }
- }
-
- protected void setTableGenerator_(OrmTableGenerator tableGenerator) {
- OrmTableGenerator old = this.tableGenerator;
- this.tableGenerator = tableGenerator;
- this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator);
- }
-
-
- // ********** validation **********
-
- /**
- * The generators are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // generators are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlGeneratorContainer.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
deleted file mode 100644
index 958b87ddf5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmIdMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
-
-/**
- * <code>orm.xml</code> ID mapping
- */
-public class GenericOrmIdMapping
- extends AbstractOrmIdMapping<XmlId>
-{
- public GenericOrmIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
deleted file mode 100644
index b87a6661ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> join column
- */
-public class GenericOrmJoinColumn
- extends AbstractOrmBaseColumn<XmlJoinColumn, OrmJoinColumn.Owner>
- implements OrmJoinColumn
-{
- /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
- protected /* final */ XmlJoinColumn xmlColumn; // null for default join columns
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner) {
- this(parent, owner, null);
- }
-
- public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn xmlColumn) {
- super(parent, owner, xmlColumn);
- this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlJoinColumn getXmlColumn() {
- return this.xmlColumn;
- }
-
- @Override
- protected void setXmlColumn(XmlJoinColumn xmlColumn) {
- this.xmlColumn = xmlColumn;
- }
-
- /**
- * join columns are part of a collection;
- * the 'join-column' element will be removed/added
- * when the XML join column is removed from/added to
- * the owner's collection
- */
- @Override
- protected XmlJoinColumn buildXmlColumn() {
- throw new IllegalStateException("XML join column is missing"); //$NON-NLS-1$
- }
-
- /**
- * @see #buildXmlColumn()
- */
- @Override
- protected void removeXmlColumn() {
- // do nothing
- }
-
-
- // ********** referenced column name **********
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String name) {
- this.setSpecifiedReferencedColumnName_(name);
- this.getXmlColumn().setReferencedColumnName(name);
- }
-
- protected void setSpecifiedReferencedColumnName_(String name) {
- String old = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = name;
- this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildSpecifiedReferencedColumnName() {
- XmlJoinColumn joinColumn = this.getXmlColumn();
- return (joinColumn == null) ? null : joinColumn.getReferencedColumnName();
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String name) {
- String old = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = name;
- this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultReferencedColumnName() {
- return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
- }
-
-
- // ********** database stuff **********
-
- public Table getReferencedColumnDbTable() {
- return this.owner.getReferencedColumnDbTable();
- }
-
- protected Column getReferencedDbColumn() {
- Table table = this.getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
- }
-
- public boolean referencedColumnIsResolved() {
- return this.getReferencedDbColumn() != null;
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyJoinColumn oldColumn) {
- super.initializeFrom(oldColumn);
- this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
- }
-
- public void initializeFromVirtual(ReadOnlyJoinColumn virtualColumn) {
- super.initializeFromVirtual(virtualColumn);
- this.setSpecifiedReferencedColumnName(virtualColumn.getReferencedColumnName());
- }
-
- public boolean isDefault() {
- return this.owner.joinColumnIsDefault(this);
- }
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this, this.owner);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmJoinColumnTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
deleted file mode 100644
index 9bd4e51936..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.NamedColumn;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> join table
- */
-public class GenericOrmJoinTable
- extends GenericOrmReferenceTable<XmlJoinTable>
- implements OrmJoinTable
-{
- protected final Vector<OrmJoinColumn> specifiedInverseJoinColumns = new Vector<OrmJoinColumn>();
- protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
- protected final OrmJoinColumn.Owner inverseJoinColumnOwner;
-
- protected OrmJoinColumn defaultInverseJoinColumn;
-
-
- public GenericOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Owner owner) {
- super(parent, owner);
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.initializeSpecifiedInverseJoinColumns();
- }
-
- @Override
- protected OrmJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedInverseJoinColumns();
- if (this.defaultInverseJoinColumn != null) {
- this.defaultInverseJoinColumn.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getSpecifiedInverseJoinColumns());
- this.updateDefaultInverseJoinColumn();
- }
-
-
- // ********** XML table **********
-
- @Override
- protected XmlJoinTable getXmlTable() {
- return this.getJoinStrategy().getXmlJoinTable();
- }
-
- @Override
- protected XmlJoinTable buildXmlTable() {
- return this.getJoinStrategy().buildXmlJoinTable();
- }
-
- @Override
- protected void removeXmlTable() {
- this.getJoinStrategy().removeXmlJoinTable();
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterator<OrmJoinColumn> inverseJoinColumns() {
- return this.getInverseJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getInverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
- }
-
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedInverseJoinColumn() {
- MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterator<OrmJoinColumn> specifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().iterator();
- }
-
- public ListIterable<OrmJoinColumn> getSpecifiedInverseJoinColumns() {
- return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedInverseJoinColumns);
- }
-
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
- }
-
- public OrmJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumns.get(index);
- }
-
- public OrmJoinColumn addSpecifiedInverseJoinColumn() {
- return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
- }
-
- public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) {
- XmlJoinTable xmlTable = this.getXmlTableForUpdate();
- XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.addSpecifiedInverseJoinColumn_(index, xmlJoinColumn);
- xmlTable.getInverseJoinColumns().add(index, xmlJoinColumn);
- return joinColumn;
- }
-
- public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedInverseJoinColumn(int index) {
- this.removeSpecifiedInverseJoinColumn_(index);
- this.getXmlTable().getInverseJoinColumns().remove(index);
- this.removeXmlTableIfUnset();
- }
-
- protected void removeSpecifiedInverseJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- this.getXmlTable().getInverseJoinColumns().move(targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedInverseJoinColumns() {
- this.clearCollection(this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- this.getXmlTable().getInverseJoinColumns().clear();
- }
-
- protected void initializeSpecifiedInverseJoinColumns() {
- for (XmlJoinColumn xmlJoinColumn : this.getXmlInverseJoinColumns()) {
- this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(xmlJoinColumn));
- }
- }
-
- protected void syncSpecifiedInverseJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter);
- }
-
- protected Iterable<XmlJoinColumn> getXmlInverseJoinColumns() {
- XmlJoinTable xmlTable = this.getXmlTable();
- return (xmlTable == null) ?
- EmptyIterable.<XmlJoinColumn>instance() :
- // clone to reduce chance of concurrency problems
- new LiveCloneIterable<XmlJoinColumn>(xmlTable.getInverseJoinColumns());
- }
-
- protected void moveSpecifiedInverseJoinColumn_(int index, OrmJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- protected OrmJoinColumn addSpecifiedInverseJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
- OrmJoinColumn joinColumn = this.buildInverseJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedInverseJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn));
- }
-
- /**
- * specified inverse join column container adapter
- */
- protected class SpecifiedInverseJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
- {
- public Iterable<OrmJoinColumn> getContextElements() {
- return GenericOrmJoinTable.this.getSpecifiedInverseJoinColumns();
- }
- public Iterable<XmlJoinColumn> getResourceElements() {
- return GenericOrmJoinTable.this.getXmlInverseJoinColumns();
- }
- public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- public void moveContextElement(int index, OrmJoinColumn element) {
- GenericOrmJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlJoinColumn resourceElement) {
- GenericOrmJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmJoinColumn element) {
- GenericOrmJoinTable.this.removeSpecifiedInverseJoinColumn_(element);
- }
- }
-
- protected OrmJoinColumn.Owner buildInverseJoinColumnOwner() {
- return new InverseJoinColumnOwner();
- }
-
-
- // ********** default inverse join column **********
-
- public OrmJoinColumn getDefaultInverseJoinColumn() {
- return this.defaultInverseJoinColumn;
- }
-
- protected void setDefaultInverseJoinColumn(OrmJoinColumn joinColumn) {
- OrmJoinColumn old = this.defaultInverseJoinColumn;
- this.defaultInverseJoinColumn = joinColumn;
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn);
- }
-
- protected ListIterable<OrmJoinColumn> getDefaultInverseJoinColumns() {
- return (this.defaultInverseJoinColumn != null) ?
- new SingleElementListIterable<OrmJoinColumn>(this.defaultInverseJoinColumn) :
- EmptyListIterable.<OrmJoinColumn>instance();
- }
-
- protected int getDefaultInverseJoinColumnsSize() {
- return (this.defaultInverseJoinColumn == null) ? 0 : 1;
- }
-
- protected void updateDefaultInverseJoinColumn() {
- if (this.buildsDefaultInverseJoinColumn()) {
- if (this.defaultInverseJoinColumn == null) {
- this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(null));
- } else {
- this.defaultInverseJoinColumn.update();
- }
- } else {
- this.setDefaultInverseJoinColumn(null);
- }
- }
-
- protected boolean buildsDefaultInverseJoinColumn() {
- return ! this.hasSpecifiedInverseJoinColumns();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmJoinTableRelationshipStrategy getParent() {
- return (OrmJoinTableRelationshipStrategy) super.getParent();
- }
-
- protected OrmJoinTableRelationshipStrategy getJoinStrategy() {
- return this.getParent();
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getJoinStrategy().getJoinTableDefaultName();
- }
-
- public void initializeFrom(ReadOnlyJoinTable oldTable) {
- super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) {
- this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) {
- this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
- }
- }
-
- protected OrmJoinColumn buildInverseJoinColumn(XmlJoinColumn xmlJoinColumn) {
- return this.getContextNodeFactory().buildOrmJoinColumn(this, this.inverseJoinColumnOwner, xmlJoinColumn);
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getJoinStrategy().getRelationship().getMapping();
- }
-
- public PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
- super.validateJoinColumns(messages, reporter);
- this.validateJoinColumns(this.getInverseJoinColumns(), messages, reporter);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getJoinStrategy().validatesAgainstDatabase();
- }
-
-
- // ********** join column owners **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements OrmJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericOrmJoinTable.this.getJoinStrategy().getRelationship().getTypeMapping();
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return GenericOrmJoinTable.this.getPersistentAttribute();
- }
-
- /**
- * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
- */
- public String getDefaultColumnName() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. the table is always the join table
- */
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public Iterator<String> candidateTableNames() {
- return EmptyIterator.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericOrmJoinTable.this.getName(), tableName) ?
- GenericOrmJoinTable.this.getDbTable() :
- null;
- }
-
- /**
- * by default, the join column is, obviously, in the join table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericOrmJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmJoinTable.this.getValidationTextRange();
- }
-
- protected String getPersistentAttributeName() {
- return this.getPersistentAttribute().getName();
- }
-
- protected OrmJoinTableRelationshipStrategy getJoinStrategy() {
- return GenericOrmJoinTable.this.getJoinStrategy();
- }
- }
-
-
- /**
- * owner for "back-pointer" join columns;
- * these point at the source/owning entity
- */
- protected class JoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- public Entity getRelationshipTarget() {
- return this.getJoinStrategy().getRelationship().getEntity();
- }
-
- public String getAttributeName() {
- return MappingTools.getTargetAttributeName(GenericOrmJoinTable.this.getRelationshipMapping());
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.joinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getJoinStrategy().buildJoinTableJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-
-
- /**
- * owner for "forward-pointer" join columns;
- * these point at the target/inverse entity
- */
- protected class InverseJoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected InverseJoinColumnOwner() {
- super();
- }
-
- public Entity getRelationshipTarget() {
- RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getName();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.inverseJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getJoinStrategy().buildJoinTableInverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
deleted file mode 100644
index 94c52ecc93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.LobConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class GenericOrmLobConverter
- extends AbstractOrmConverter
- implements OrmLobConverter
-{
- public GenericOrmLobConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return LobConverter.class;
- }
-
- public void initialize() {
- this.getXmlConvertibleMapping().setLob(true);
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getLobTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
deleted file mode 100644
index 6a002b3d2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-
-public class GenericOrmManyToManyMapping
- extends AbstractOrmManyToManyMapping<XmlManyToMany>
-{
- public GenericOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
deleted file mode 100644
index 740c4e01e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-
-public class GenericOrmManyToOneMapping
- extends AbstractOrmManyToOneMapping<XmlManyToOne>
-{
- public GenericOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
deleted file mode 100644
index 45014549d5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
-
-/**
- * <code>orm.xml</code> mapped superclass
- */
-public class GenericOrmMappedSuperclass
- extends AbstractOrmMappedSuperclass<XmlMappedSuperclass>
-{
- public GenericOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
- super(parent, resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
deleted file mode 100644
index 9fd7ad9075..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> named native query
- */
-public class GenericOrmNamedNativeQuery
- extends AbstractOrmQuery<XmlNamedNativeQuery>
- implements OrmNamedNativeQuery
-{
- protected String resultClass;
-
- protected String resultSetMapping;
-
-
- public GenericOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery xmlNamedNativeQuery) {
- super(parent, xmlNamedNativeQuery);
- this.resultClass = xmlNamedNativeQuery.getResultClass();
- this.resultSetMapping = xmlNamedNativeQuery.getResultSetMapping();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setResultClass_(this.xmlQuery.getResultClass());
- this.setResultSetMapping_(this.xmlQuery.getResultSetMapping());
- }
-
-
- // ********** result class **********
-
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String resultClass) {
- this.setResultClass_(resultClass);
- this.xmlQuery.setResultClass(resultClass);
- }
-
- protected void setResultClass_(String resultClass) {
- String old = this.resultClass;
- this.resultClass = resultClass;
- this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
- }
-
- public char getResultClassEnclosingTypeSeparator() {
- return '$';
- }
-
-
- // ********** result set mapping **********
-
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String resultSetMapping) {
- this.setResultSetMapping_(resultSetMapping);
- this.xmlQuery.setResultSetMapping(resultSetMapping);
- }
-
- protected void setResultSetMapping_(String resultSetMapping) {
- String old = this.resultSetMapping;
- this.resultSetMapping = resultSetMapping;
- this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(List<IMessage> messages, IReporter reporter) {
- // nothing yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
deleted file mode 100644
index be9134eeab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> named query
- */
-public class GenericOrmNamedQuery
- extends AbstractOrmQuery<XmlNamedQuery>
- implements OrmNamedQuery
-{
- public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- super(parent, resourceNamedQuery);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) {
- // Convert the literal escape characters into actual escape characters
- String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]);
-
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
- helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
deleted file mode 100644
index 374f84e338..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
-
-/**
- * <code>orm.xml</code> null attribute mapping
- */
-public class GenericOrmNullAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
- public GenericOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- return null;
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
deleted file mode 100644
index 4fdad7ce7b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-
-public class GenericOrmOneToManyMapping
- extends AbstractOrmOneToManyMapping<XmlOneToMany>
-{
- public GenericOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
deleted file mode 100644
index e89cef7e89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-
-/**
- * <code>orm.xml</code> 1:1 mapping
- */
-public class GenericOrmOneToOneMapping
- extends AbstractOrmOneToOneMapping<XmlOneToOne>
-{
- public GenericOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
deleted file mode 100644
index 71ac3cee4e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.NamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-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.internal.jpa2.context.OrderColumnValidator;
-import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> ordering
- * <p>
- * <strong>NB:</strong> Setting any flag to <code>false</code> (or setting the
- * specified "order by" to <code>null</code>) can be a bit unpredictable. The
- * intent is to set a flag to <code>true</code> (or set the specified "order by"
- * to a non-<code>null</code> value).
- * <p>
- * <strong>(JPA 2.0 only) NB:</strong> If both the "order-by" and the
- * "order-column" elements are present (which is prohibited by the JPA spec),
- * both are ignored.
- */
-public class GenericOrmOrderable
- extends AbstractOrmXmlContextNode
- implements OrmOrderable2_0
-{
- protected String specifiedOrderBy;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
- // JPA 2.0
- protected final Owner owner; // this is null for JPA 1.0 mappings
- protected boolean orderColumnOrdering = false;
- protected final OrmOrderColumn2_0 orderColumn; // this is null for JPA 1.0 mappings
-
-
- /**
- * JPA 1.0
- */
- public GenericOrmOrderable(OrmAttributeMapping parent) {
- this(parent, null);
- }
-
- /**
- * JPA 2.0
- */
- public GenericOrmOrderable(OrmAttributeMapping parent, Owner owner) {
- super(parent);
-
- this.specifiedOrderBy = this.buildSpecifiedOrderBy();
- this.noOrdering = this.buildNoOrdering();
- this.pkOrdering = this.buildPkOrdering();
- this.customOrdering = this.buildCustomOrdering();
-
- this.owner = owner;
- this.orderColumnOrdering = this.buildOrderColumnOrdering();
- this.orderColumn = this.buildOrderColumn();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
-
- this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy());
- this.setNoOrdering_(this.buildNoOrdering());
- this.setPkOrdering_(this.buildPkOrdering());
- this.setCustomOrdering_(this.buildCustomOrdering());
-
- this.setOrderColumnOrdering_(this.buildOrderColumnOrdering());
- if (this.orderColumn != null) {
- this.orderColumn.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- if (this.orderColumn != null) {
- this.orderColumn.update();
- }
- }
-
-
- // ********** specified order by **********
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- if (orderBy != null) {
- this.setSpecifiedOrderBy_(orderBy);
- this.setNoOrdering_(false);
- this.setPkOrdering_(orderBy.length() == 0);
- this.setCustomOrdering_(orderBy.length() != 0);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(orderBy);
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected String buildSpecifiedOrderBy() {
- if (this.xmlOrderColumnIsPresent()) {
- return null;
- }
- return this.getXmlOrderBy();
- }
-
-
- // ********** no ordering **********
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- if (noOrdering) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(null);
- } else {
- this.setPkOrdering(true); // hmmm...
- }
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected boolean buildNoOrdering() {
- return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0();
- }
-
- /**
- * both elements are missing <em>or</em> both are present
- */
- protected boolean buildNoOrdering2_0() {
- boolean orderByMissing = (this.getXmlOrderBy() == null);
- boolean orderByPresent = ! orderByMissing;
- boolean orderColumnMissing = (this.getXmlOrderColumn() == null);
- boolean orderColumnPresent = ! orderColumnMissing;
- return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent);
- }
-
- /**
- * the order-by element is missing
- */
- protected boolean buildNoOrdering1_0() {
- return this.getXmlOrderBy() == null;
- }
-
-
- // ********** pk ordering **********
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- if (pkOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- /**
- * the order-by element is present but no value specified
- */
- protected boolean buildPkOrdering() {
- if (this.xmlOrderColumnIsPresent()) {
- return false;
- }
- String xmlOrderBy = this.getXmlOrderBy();
- return (xmlOrderBy != null) && (xmlOrderBy.length() == 0);
- }
-
-
- // ********** custom ordering **********
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- /**
- * Unfortunately, setting the "custom ordering" flag directly is a bit hacky:
- * The "specified order-by" is initially set to an empty string, which is
- * the same as a "primary key ordering" state....
- */
- public void setCustomOrdering(boolean customOrdering) {
- if (customOrdering) {
- this.setSpecifiedOrderBy_(""); // hmmm... //$NON-NLS-1$
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(true);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(""); //$NON-NLS-1$
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- /**
- * the order-by element is present and it has a specified value
- */
- protected boolean buildCustomOrdering() {
- if (this.xmlOrderColumnIsPresent()) {
- return false;
- }
- String xmlOrderBy = this.getXmlOrderBy();
- return (xmlOrderBy != null) && (xmlOrderBy.length() != 0);
- }
-
-
- // ********** order column ordering **********
-
- public boolean isOrderColumnOrdering() {
- return this.orderColumnOrdering;
- }
-
- public void setOrderColumnOrdering(boolean orderColumnOrdering) {
- if (orderColumnOrdering) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(true);
-
- this.getXmlOrderable().setOrderBy(null);
- this.buildXmlOrderColumn();
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- /**
- * JPA 2.0 only;
- * the <code>order-column</code> element is present <em>and</em>
- * the <code>order-by</code> element is missing
- */
- protected boolean buildOrderColumnOrdering() {
- return this.xmlOrderColumnIsPresent() &&
- (this.getXmlOrderBy() == null);
- }
-
-
- // ********** order column **********
-
- public OrmOrderColumn2_0 getOrderColumn() {
- return this.orderColumn;
- }
-
- /**
- * JPA 2.0 only
- */
- protected OrmOrderColumn2_0 buildOrderColumn() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmOrderColumn(this, new OrderColumnOwner()) :
- null;
- }
-
-
- // ********** xml order by **********
-
- protected String getXmlOrderBy() {
- return this.getXmlOrderable().getOrderBy();
- }
-
-
- // ********** xml order column **********
-
- protected XmlOrderColumn getXmlOrderColumn() {
- return this.getXmlOrderable().getOrderColumn();
- }
-
- /**
- * NB: Only return <code>true</code> for JPA 2.0 mappings.
- */
- protected boolean xmlOrderColumnIsPresent() {
- return this.isJpa2_0Compatible() && (this.getXmlOrderColumn() != null);
- }
-
- protected XmlOrderColumn buildXmlOrderColumn() {
- XmlOrderColumn xmlColumn = OrmFactory.eINSTANCE.createXmlOrderColumn();
- GenericOrmOrderable.this.getXmlOrderable().setOrderColumn(xmlColumn);
- return xmlColumn;
- }
-
- protected void removeXmlOrderColumn() {
- if (this.xmlOrderColumnIsPresent()) {
- this.getXmlOrderable().setOrderColumn(null);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- protected OrmAttributeMapping getAttributeMapping() {
- return this.getParent();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return this.getAttributeMapping().getPersistentAttribute();
- }
-
- protected XmlOrderable getXmlOrderable() {
- return (XmlOrderable) this.getAttributeMapping().getXmlAttributeMapping();
- }
-
- // JPA 2.0
- public String getDefaultTableName() {
- return this.owner.getTableName();
- }
-
- // JPA 2.0
- protected Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlOrderable().getValidationTextRange();
- return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // order-column and order-by both specified is handled with schema validation
- if (this.orderColumnOrdering) {
- // TODO validation message if type is not List
- this.orderColumn.validate(messages, reporter);
- }
- }
-
-
- // ********** order column owner (JPA 2.0) **********
-
- protected class OrderColumnOwner
- implements OrmOrderColumn2_0.Owner
- {
- public String getDefaultTableName() {
- return GenericOrmOrderable.this.getDefaultTableName();
- }
-
- public Table resolveDbTable(String tableName) {
- return GenericOrmOrderable.this.resolveDbTable(tableName);
- }
-
- public String getDefaultColumnName() {
- return this.getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
- }
-
- public TypeMapping getTypeMapping() {
- return this.getPersistentAttribute().getOwningTypeMapping();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmOrderable.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver);
- }
-
- public XmlOrderColumn getXmlColumn() {
- return GenericOrmOrderable.this.getXmlOrderColumn();
- }
-
- public XmlOrderColumn buildXmlColumn() {
- return GenericOrmOrderable.this.buildXmlOrderColumn();
- }
-
- public void removeXmlColumn() {
- GenericOrmOrderable.this.removeXmlOrderColumn();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return GenericOrmOrderable.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
deleted file mode 100644
index f669f9864d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.orm.NullOrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmOverrideRelationship
- extends AbstractOrmXmlContextNode
- implements OrmOverrideRelationship2_0
-{
- protected OrmRelationshipStrategy strategy;
-
- protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy;
-
- // JPA 2.0
- protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
-
-
- public GenericOrmOverrideRelationship(OrmAssociationOverride parent) {
- super(parent);
- this.joinColumnStrategy = this.buildJoinColumnStrategy();
- this.joinTableStrategy = this.buildJoinTableStrategy();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.joinColumnStrategy.synchronizeWithResourceModel();
- this.joinTableStrategy.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.setStrategy(this.buildStrategy());
- this.joinColumnStrategy.update();
- this.joinTableStrategy.update();
- }
-
-
- // ********** strategy **********
-
- public OrmRelationshipStrategy getStrategy() {
- return this.strategy;
- }
-
- protected void setStrategy(OrmRelationshipStrategy strategy) {
- OrmRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- protected OrmRelationshipStrategy buildStrategy() {
- if (this.isJpa2_0Compatible()) {
- if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
- return this.joinColumnStrategy;
- }
- return this.joinTableStrategy;
- }
- return this.joinColumnStrategy;
- }
-
-
- // ********** join column strategy **********
-
- public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public void setStrategyToJoinColumn() {
- this.joinColumnStrategy.addStrategy();
- this.joinTableStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return false;
- }
-
- protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
- return new GenericOrmOverrideJoinColumnRelationshipStrategy(this);
- }
-
-
- // ********** join table strategy **********
-
- public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
- return this.joinTableStrategy;
- }
-
- public boolean strategyIsJoinTable() {
- return this.strategy == this.joinTableStrategy;
- }
-
- public void setStrategyToJoinTable() {
- this.joinTableStrategy.addStrategy();
- this.joinColumnStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return false;
- }
-
- protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
- return this.isJpa2_0Compatible() ?
- new GenericOrmOverrideJoinTableRelationshipStrategy2_0(this) :
- new NullOrmJoinTableRelationshipStrategy(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeFrom(ReadOnlyRelationship oldRelationship) {
- oldRelationship.initializeOn(this);
- }
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromJoinTableRelationship(this);
- newRelationship.initializeFromJoinColumnRelationship(this);
- }
-
- public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
- // NOP
- }
-
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
- }
-
- public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
- this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
- }
-
- public void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship) {
- virtualRelationship.initializeOnSpecified(this);
- }
-
- public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
- throw new UnsupportedOperationException();
- }
-
- public void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship) {
- this.joinTableStrategy.initializeFromVirtual(virtualRelationship.getJoinTableStrategy());
- }
-
- public void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship) {
- this.joinColumnStrategy.initializeFromVirtual(virtualRelationship.getJoinColumnStrategy());
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmAssociationOverride getParent() {
- return (OrmAssociationOverride) super.getParent();
- }
-
- public OrmAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- public XmlAssociationOverride getXmlContainer() {
- return this.getAssociationOverride().getXmlOverride();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getContainer().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = this.getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isVirtual() {
- return false;
- }
-
- public RelationshipMapping getMapping() {
- return this.getAssociationOverride().getMapping();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getAssociationOverride().getValidationTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.joinColumnStrategy.validate(messages, reporter);
- this.joinTableStrategy.validate(messages, reporter);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().getContainer().buildJoinTableJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().getContainer().buildJoinTableInverseJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver);
- }
-
- public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().getContainer().buildTableValidator(this.getAssociationOverride(), table, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
deleted file mode 100644
index 47f0deb90e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitDefaults2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-defaults</code> element
- */
-public class GenericOrmPersistenceUnitDefaults
- extends AbstractOrmXmlContextNode
- implements OrmPersistenceUnitDefaults2_0
-{
- protected AccessType access;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected boolean cascadePersist;
-
- protected boolean delimitedIdentifiers;
-
-
- // ********** constructor/initialization **********
-
- public GenericOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) {
- super(parent);
- this.access = this.buildAccess();
- this.specifiedCatalog = this.buildSpecifiedCatalog();
- this.specifiedSchema = this.buildSpecifiedSchema();
- this.cascadePersist = this.buildCascadePersist();
- this.delimitedIdentifiers = this.buildDelimitedIdentifiers();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setAccess_(this.buildAccess());
- this.setSpecifiedCatalog_(this.buildSpecifiedCatalog());
- this.setSpecifiedSchema_(this.buildSpecifiedSchema());
- this.setCascadePersist_(this.buildCascadePersist());
- this.setDelimitedIdentifiers_(this.buildDelimitedIdentifiers());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setDefaultSchema(this.buildDefaultSchema());
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return this.access;
- }
-
- public void setAccess(AccessType access) {
- if (this.valuesAreDifferent(this.access, access)) {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
- this.setAccess_(access);
- xmlDefaults.setAccess(AccessType.toOrmResourceModel(access));
- this.removeXmlDefaultsIfUnset();
- }
- }
-
- protected void setAccess_(AccessType access) {
- AccessType old = this.access;
- this.access = access;
- this.firePropertyChanged(ACCESS_PROPERTY, old, access);
- }
-
- protected AccessType buildAccess() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? null : AccessType.fromOrmResourceModel(xmlDefaults.getAccess());
- }
-
-
- // ********** schema container **********
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
-
- // ********** catalog **********
-
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
- this.setSpecifiedCatalog_(catalog);
- xmlDefaults.setCatalog(catalog);
- this.removeXmlDefaultsIfUnset();
- }
- }
-
- protected void setSpecifiedCatalog_(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
-
- protected String buildSpecifiedCatalog() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? null : xmlDefaults.getCatalog();
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String catalog) {
- String old = this.defaultCatalog;
- this.defaultCatalog = catalog;
- this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
- protected String buildDefaultCatalog() {
- return this.getJpaProject().getDefaultCatalog();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDbCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
-
- // ********** schema **********
-
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- if (this.valuesAreDifferent(this.specifiedSchema, schema)) {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
- this.setSpecifiedSchema_(schema);
- xmlDefaults.setSchema(schema);
- this.removeXmlDefaultsIfUnset();
- }
- }
-
- protected void setSpecifiedSchema_(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
- }
-
- protected String buildSpecifiedSchema() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? null : xmlDefaults.getSchema();
- }
-
- public String getDefaultSchema() {
- return this.defaultSchema;
- }
-
- protected void setDefaultSchema(String schema) {
- String old = this.defaultSchema;
- this.defaultSchema = schema;
- this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
- protected String buildDefaultSchema() {
- return this.getJpaProject().getDefaultSchema();
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
-
- // ********** cascade persist **********
-
- public boolean isCascadePersist() {
- return this.cascadePersist;
- }
-
- public void setCascadePersist(boolean cascadePersist) {
- if (this.cascadePersist != cascadePersist) {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
- this.setCascadePersist_(cascadePersist);
- xmlDefaults.setCascadePersist(cascadePersist);
- this.removeXmlDefaultsIfUnset();
- }
- }
-
- protected void setCascadePersist_(boolean cascadePersist) {
- boolean old = this.cascadePersist;
- this.cascadePersist = cascadePersist;
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
- }
-
- protected boolean buildCascadePersist() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? false : xmlDefaults.isCascadePersist();
- }
-
-
- // ********** delimited identifiers **********
-
- public boolean isDelimitedIdentifiers() {
- return this.delimitedIdentifiers;
- }
-
- public void setDelimitedIdentifiers(boolean delimitedIdentifiers) {
- if (this.delimitedIdentifiers != delimitedIdentifiers) {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
- this.setDelimitedIdentifiers_(delimitedIdentifiers);
- xmlDefaults.setDelimitedIdentifiers(delimitedIdentifiers);
- this.removeXmlDefaultsIfUnset();
- }
- }
-
- protected void setDelimitedIdentifiers_(boolean di) {
- boolean old = this.delimitedIdentifiers;
- this.delimitedIdentifiers = di;
- this.firePropertyChanged(DELIMITED_IDENTIFIERS_PROPERTY, old, di);
- }
-
- protected boolean buildDelimitedIdentifiers() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? false : xmlDefaults.isDelimitedIdentifiers();
- }
-
-
- // ********** XML defaults **********
-
- /**
- * Return <code>null</code> if the XML defaults does not exist.
- */
- protected XmlPersistenceUnitDefaults getXmlDefaults() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata == null) ? null : xmlMetadata.getPersistenceUnitDefaults();
- }
-
- protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() {
- return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadata();
- }
-
- /**
- * Build the XML defaults (and XML metadata if necessary) if it does not exist.
- */
- protected XmlPersistenceUnitDefaults getXmlDefaultsForUpdate() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
- XmlPersistenceUnitDefaults xmlDefaults = xmlMetadata.getPersistenceUnitDefaults();
- return (xmlDefaults != null) ? xmlDefaults : this.buildXmlDefaults(xmlMetadata);
- }
-
- protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() {
- return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadataForUpdate();
- }
-
- protected XmlPersistenceUnitDefaults buildXmlDefaults(XmlPersistenceUnitMetadata xmlMetadata) {
- XmlPersistenceUnitDefaults xmlDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- xmlMetadata.setPersistenceUnitDefaults(xmlDefaults);
- return xmlDefaults;
- }
-
- /**
- * clear the XML defaults (and the XML metadata) if appropriate
- */
- protected void removeXmlDefaultsIfUnset() {
- if (this.getXmlDefaults().isUnset()) {
- this.getXmlPersistenceUnitMetadata().setPersistenceUnitDefaults(null);
- this.removeXmlPersistenceUnitMetadataIfUnset();
- }
- }
-
- protected void removeXmlPersistenceUnitMetadataIfUnset() {
- this.getPersistenceUnitMetadata().removeXmlPersistenceUnitMetadataIfUnset();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmPersistenceUnitMetadata getParent() {
- return (OrmPersistenceUnitMetadata) super.getParent();
- }
-
- public OrmPersistenceUnitMetadata getPersistenceUnitMetadata() {
- return this.getParent();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnitMetadata().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? null : xmlDefaults.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
deleted file mode 100644
index 1fc8f131a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitMetadata2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-metadata</code> element
- */
-public class GenericOrmPersistenceUnitMetadata
- extends AbstractOrmXmlContextNode
- implements OrmPersistenceUnitMetadata2_0
-{
- protected boolean xmlMappingMetadataComplete;
-
- protected String description;
-
- // never null
- protected final OrmPersistenceUnitDefaults persistenceUnitDefaults;
-
-
- public GenericOrmPersistenceUnitMetadata(EntityMappings parent) {
- super(parent);
- this.xmlMappingMetadataComplete = this.buildXmlMappingMetadataComplete();
- this.description = this.buildDescription();
- this.persistenceUnitDefaults = this.buildPersistenceUnitDefaults();
- }
-
- protected OrmPersistenceUnitDefaults buildPersistenceUnitDefaults() {
- return this.getContextNodeFactory().buildOrmPersistenceUnitDefaults(this);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setXmlMappingMetadataComplete_(this.buildXmlMappingMetadataComplete());
- this.setDescription_(this.buildDescription());
- this.persistenceUnitDefaults.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.persistenceUnitDefaults.update();
- }
-
-
- // ********** XML metadata **********
-
- /**
- * Return <code>null</code> if the XML metadata does not exist.
- */
- public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() {
- return this.getXmlEntityMappings().getPersistenceUnitMetadata();
- }
-
- /**
- * Build the XML metadata if it does not exist.
- */
- public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata != null) ? xmlMetadata : this.buildXmlPersistenceUnitMetadata();
- }
-
- protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata() {
- XmlPersistenceUnitMetadata xmlMetadata = this.buildXmlPersistenceUnitMetadata_();
- this.getXmlEntityMappings().setPersistenceUnitMetadata(xmlMetadata);
- return xmlMetadata;
- }
-
- protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_() {
- return EmfTools.create(
- this.getResourceNodeFactory(),
- OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(),
- XmlPersistenceUnitMetadata.class
- );
- }
-
- public void removeXmlPersistenceUnitMetadataIfUnset() {
- if (this.getXmlPersistenceUnitMetadata().isUnset()) {
- this.getXmlEntityMappings().setPersistenceUnitMetadata(null);
- }
- }
-
-
- // ********** XML mapping metadata complete **********
-
- public boolean isXmlMappingMetadataComplete() {
- return this.xmlMappingMetadataComplete;
- }
-
- public void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete) {
- if (this.xmlMappingMetadataComplete != xmlMappingMetadataComplete) {
- XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
- this.setXmlMappingMetadataComplete_(xmlMappingMetadataComplete);
- xmlPersistenceUnitMetadata.setXmlMappingMetadataComplete(xmlMappingMetadataComplete);
- this.removeXmlPersistenceUnitMetadataIfUnset();
- }
- }
-
- protected void setXmlMappingMetadataComplete_(boolean xmlMappingMetadataComplete) {
- boolean old = this.xmlMappingMetadataComplete;
- this.xmlMappingMetadataComplete = xmlMappingMetadataComplete;
- this.firePropertyChanged(XML_MAPPING_METADATA_COMPLETE_PROPERTY, old, xmlMappingMetadataComplete);
- }
-
- protected boolean buildXmlMappingMetadataComplete() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata != null) ? xmlMetadata.isXmlMappingMetadataComplete() : false;
- }
-
-
- // ********** description **********
-
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String description) {
- if (this.valuesAreDifferent(this.description, description)) {
- XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
- this.setDescription_(description);
- xmlPersistenceUnitMetadata.setDescription(description);
- this.removeXmlPersistenceUnitMetadataIfUnset();
- }
- }
-
- protected void setDescription_(String description) {
- String old = this.description;
- this.description = description;
- this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description);
- }
-
- protected String buildDescription() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata == null) ? null : xmlMetadata.getDescription();
- }
-
-
- // ********** persistence unit defaults **********
-
- public OrmPersistenceUnitDefaults getPersistenceUnitDefaults() {
- return this.persistenceUnitDefaults;
- }
-
-
- // ********** misc **********
-
- @Override
- public EntityMappings getParent() {
- return (EntityMappings) super.getParent();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- public XmlEntityMappings getXmlEntityMappings() {
- return this.getEntityMappings().getXmlEntityMappings();
- }
-
- public boolean resourceExists() {
- return this.getXmlPersistenceUnitMetadata() != null;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getEntityMappings().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata == null) ? null : xmlMetadata.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
deleted file mode 100644
index 1bdd5cc4c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> persistent attribute
- */
-public class GenericOrmPersistentAttribute
- extends SpecifiedOrmPersistentAttribute
-{
- public GenericOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** access **********
-
- /**
- * JPA 1.0 does not support a specified access for attributes.
- */
- @Override
- public AccessType getSpecifiedAccess() {
- return null;
- }
-
- public void setSpecifiedAccess(AccessType access) {
- throw new UnsupportedOperationException("A specified access is not supported in JPA 1.0: " + this); //$NON-NLS-1$
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateAttribute(List<IMessage> messages, IReporter reporter) {
- super.validateAttribute(messages, reporter);
- if (this.javaPersistentAttribute != null) {
- JavaPersistentType javaPersistentType = this.getOwningPersistentType().getJavaPersistentType();
- if ((javaPersistentType != null) && (javaPersistentType.getAttributeNamed(this.javaPersistentAttribute.getName()) == null)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED,
- new String[] {
- this.getName(),
- this.getOwningPersistentType().getMapping().getClass_()
- },
- this.mapping,
- this.mapping.getNameTextRange()
- )
- );
- }
- }
- }
-
- @Override
- protected JptValidator buildAttibuteValidator() {
- return new GenericPersistentAttributeValidator(this, getJavaPersistentAttribute(), buildTextRangeResolver());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
deleted file mode 100644
index 63761be6c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ /dev/null
@@ -1,1198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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.core.internal.jpa1.context.orm;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.BodySourceWriter;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> persistent type:<ul>
- * <li>mapping
- * <li>access
- * <li>attributes
- * <li>super persistent type
- * <li>Java persistent type
- * </ul>
- */
-public class GenericOrmPersistentType
- extends AbstractOrmXmlContextNode
- implements OrmPersistentType2_0
-{
- protected OrmTypeMapping mapping; // never null
-
- protected JavaPersistentType javaPersistentType;
-
- protected AccessType specifiedAccess;
- protected AccessType defaultAccess; // never null
-
- protected final Vector<OrmPersistentAttribute> specifiedAttributes = new Vector<OrmPersistentAttribute>();
- protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter();
-
- protected final Vector<OrmReadOnlyPersistentAttribute> virtualAttributes = new Vector<OrmReadOnlyPersistentAttribute>();
- protected final VirtualAttributeContainerAdapter virtualAttributeContainerAdapter = new VirtualAttributeContainerAdapter();
-
- protected PersistentType superPersistentType;
-
- protected String declaringTypeName;
-
- protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
-
-
- public GenericOrmPersistentType(EntityMappings parent, XmlTypeMapping xmlTypeMapping) {
- super(parent);
- this.mapping = this.buildMapping(xmlTypeMapping);
- // 'javaPersistentType' is resolved in the update
- this.specifiedAccess = this.buildSpecifiedAccess();
- this.defaultAccess = AccessType.FIELD; // keep this non-null
- this.initializeSpecifiedAttributes();
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.mapping.synchronizeWithResourceModel();
- this.syncJavaPersistentType();
- this.setSpecifiedAccess_(this.buildSpecifiedAccess());
- this.syncSpecifiedAttributes();
- this.synchronizeNodesWithResourceModel(this.getVirtualAttributes());
- }
-
- @Override
- public void update() {
- super.update();
- this.mapping.update();
- this.updateJavaPersistentType();
- this.setDefaultAccess(this.buildDefaultAccess());
- this.updateNodes(this.getSpecifiedAttributes());
- this.updateVirtualAttributes();
- this.setSuperPersistentType(this.buildSuperPersistentType());
- this.setDeclaringTypeName(this.buildDeclaringTypeName());
- }
-
-
- // ********** mapping **********
-
- public OrmTypeMapping getMapping() {
- return this.mapping;
- }
-
- public String getMappingKey() {
- return this.mapping.getKey();
- }
-
- public void setMappingKey(String mappingKey) {
- if (this.valuesAreDifferent(this.getMappingKey(), mappingKey)) {
- this.setMappingKey_(mappingKey);
- }
- }
-
- protected void setMappingKey_(String mappingKey) {
- OrmTypeMapping old = this.mapping;
- OrmTypeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getTypeMappingDefinition(mappingKey);
- XmlTypeMapping xmlTypeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory());
- this.mapping = this.buildMapping(xmlTypeMapping);
- this.getEntityMappings().changeMapping(this, old, this.mapping);
- this.firePropertyChanged(MAPPING_PROPERTY, old, this.mapping);
- }
-
- protected OrmTypeMapping buildMapping(XmlTypeMapping xmlTypeMapping) {
- OrmTypeMappingDefinition md = this.getMappingFileDefinition().getTypeMappingDefinition(xmlTypeMapping.getMappingKey());
- return md.buildContextMapping(this, xmlTypeMapping, this.getContextNodeFactory());
- }
-
- protected XmlTypeMapping getXmlTypeMapping() {
- return this.mapping.getXmlTypeMapping();
- }
-
- public boolean isMapped() {
- return true;
- }
-
-
- // ********** name **********
-
- public String getName() {
- return (this.javaPersistentType != null) ?
- this.javaPersistentType.getName() :
- this.convertMappingClassName(this.mapping.getClass_());
- }
-
- public String getSimpleName(){
- String className = this.getName();
- return StringTools.stringIsEmpty(className) ? null : ClassName.getSimpleName(className);
- }
-
- /**
- * We clear out {@link #javaPersistentType} here because we cannot compare its name
- * to the mapping's class name, since it may have been prefixed by the entity
- * mappings package.
- */
- public void mappingClassChanged(String oldClass, String newClass) {
- this.firePropertyChanged(NAME_PROPERTY, this.convertMappingClassName(oldClass), this.convertMappingClassName(newClass));
- // clear out the Java type here, it will be rebuilt during "update"
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(null);
- }
- }
-
- /**
- * Nested class names are specified with a <code>'$'</code>
- * in <code>orm.xml</code>.
- */
- protected String convertMappingClassName(String name) {
- return (name == null) ? null : name.replace('$', '.');
- }
-
-
- // ********** Java persistent type **********
-
- public JavaPersistentType getJavaPersistentType() {
- return this.javaPersistentType;
- }
-
- protected void setJavaPersistentType(JavaPersistentType javaPersistentType) {
- JavaPersistentType old = this.javaPersistentType;
- this.javaPersistentType = javaPersistentType;
- this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType);
- }
-
- /**
- * If the persistent type's mapping's class (name) changes during
- * <em>sync</em>, the Java persistent type will be cleared out in
- * {@link #mappingClassChanged(String, String)}. If we get here and
- * the Java persistent type is still present, we can
- * <em>sync</em> it. Of course, it might still be obsolete if the
- * entity mappings's package has changed....
- *
- * @see #updateJavaPersistentType()
- */
- protected void syncJavaPersistentType() {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.synchronizeWithResourceModel();
- }
- }
-
- /**
- * @see #syncJavaPersistentType()
- */
- protected void updateJavaPersistentType() {
- JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType();
- if (resourceType == null) {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(null);
- }
- } else {
- if (this.javaPersistentType == null) {
- this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
- } else {
- if (this.javaPersistentType.getResourcePersistentType() == resourceType) {
- this.javaPersistentType.update();
- } else {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
- }
- }
- }
- }
-
- protected JavaResourcePersistentType resolveJavaResourcePersistentType() {
- return this.getEntityMappings().resolveJavaResourcePersistentType(this.getName());
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- public void setSpecifiedAccess(AccessType access) {
- this.setSpecifiedAccess_(access);
- this.getXmlTypeMapping().setAccess(AccessType.toOrmResourceModel(access));
- }
-
- protected void setSpecifiedAccess_(AccessType access) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = access;
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
- }
-
- protected AccessType buildSpecifiedAccess() {
- return AccessType.fromOrmResourceModel(this.getXmlTypeMapping().getAccess());
- }
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType access) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = access;
- this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
- }
-
- protected AccessType buildDefaultAccess() {
- if ( ! this.mapping.isMetadataComplete()) {
- if (this.javaPersistentType != null) {
- if (this.javaPersistentTypeHasSpecifiedAccess()) {
- return this.javaPersistentType.getAccess();
- }
- if (this.superPersistentType != null) {
- return this.superPersistentType.getAccess();
- }
- }
- }
- AccessType access = this.getMappingFileRoot().getAccess();
- return (access != null) ? access : AccessType.FIELD; // default to FIELD if no specified access found
- }
-
- /**
- * pre-condition: {@link #javaPersistentType} is not <code>null</code>
- */
- protected boolean javaPersistentTypeHasSpecifiedAccess() {
- return (this.javaPersistentType.getSpecifiedAccess() != null) ||
- this.javaPersistentType.hasAnyAnnotatedAttributes();
- }
-
- public AccessType getOwnerOverrideAccess() {
- return this.getEntityMappings().getOverridePersistentTypeAccess();
- }
-
- public AccessType getOwnerDefaultAccess() {
- return this.getEntityMappings().getDefaultPersistentTypeAccess();
- }
-
-
- // ********** attributes **********
-
- public ListIterator<OrmReadOnlyPersistentAttribute> attributes() {
- return this.getAttributes().iterator();
- }
-
- @SuppressWarnings("unchecked")
- public ListIterable<OrmReadOnlyPersistentAttribute> getAttributes() {
- return new CompositeListIterable<OrmReadOnlyPersistentAttribute>(this.getReadOnlySpecifiedAttributes(), this.getVirtualAttributes());
- }
-
- public int attributesSize() {
- return this.specifiedAttributesSize() + this.virtualAttributesSize();
- }
-
- public Iterator<String> attributeNames() {
- return this.getAttributeNames().iterator();
- }
-
- public Iterable<String> getAttributeNames() {
- return this.convertToNames(this.getAttributes());
- }
-
- public OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
- Iterator<OrmReadOnlyPersistentAttribute> stream = this.getAttributesNamed(attributeName).iterator();
- return stream.hasNext() ? stream.next() : null;
- }
-
- public Iterator<ReadOnlyPersistentAttribute> allAttributes() {
- return this.getAllAttributes().iterator();
- }
-
- public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
- return new CompositeIterable<ReadOnlyPersistentAttribute>(
- new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
- @Override
- protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
- return new SnapshotCloneIterable<ReadOnlyPersistentAttribute>(pt.attributes());
- }
- }
- );
- }
-
- public Iterator<String> allAttributeNames() {
- return this.getAllAttributeNames().iterator();
- }
-
- public Iterable<String> getAllAttributeNames() {
- return this.convertToNames(this.getAllAttributes());
- }
-
- protected Iterable<OrmReadOnlyPersistentAttribute> getAttributesNamed(final String attributeName) {
- return new FilteringIterable<OrmReadOnlyPersistentAttribute>(this.getAttributes()) {
- @Override
- protected boolean accept(OrmReadOnlyPersistentAttribute attribute) {
- return Tools.valuesAreEqual(attributeName, attribute.getName());
- }
- };
- }
-
- public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) {
- Iterator<OrmReadOnlyPersistentAttribute> attributes = this.getAttributesNamed(attributeName).iterator();
- if (attributes.hasNext()) {
- OrmReadOnlyPersistentAttribute attribute = attributes.next();
- return attributes.hasNext() ? null /* more than one */: attribute;
- }
- // recurse
- return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
- }
-
- protected Iterable<String> convertToNames(Iterable<? extends ReadOnlyPersistentAttribute> attributes) {
- return new TransformationIterable<ReadOnlyPersistentAttribute, String>(attributes) {
- @Override
- protected String transform(ReadOnlyPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
-
- // ********** attribute conversions **********
-
- public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute) {
- return this.convertAttributeToSpecified(virtualAttribute, virtualAttribute.getMappingKey());
- }
-
- public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) {
- if ( ! virtualAttribute.isVirtual()) {
- throw new IllegalArgumentException("Attribute is already specified: " + virtualAttribute); //$NON-NLS-1$
- }
- if (mappingKey == null) {
- // this typically happens when the virtual attribute does not have a mapping
- throw new IllegalArgumentException("Use convertAttributeToSpecified(OrmReadOnlyPersistentAttribute, String) instead and specify a mapping key"); //$NON-NLS-1$
- }
- return this.convertAttributeToSpecified_(virtualAttribute, mappingKey);
- }
-
- /**
- * <em>Silently</em> remove the virtual attribute and add specified
- * attribute before triggering an <em>update</em> or the dangling
- * virtual attribute will be removed preemptively.
- */
- protected OrmPersistentAttribute convertAttributeToSpecified_(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) {
- // silently remove the virtual attribute
- int virtualIndex = this.virtualAttributes.indexOf(virtualAttribute);
- this.virtualAttributes.remove(virtualIndex);
- virtualAttribute.dispose();
-
- // silently add the specified attribute
- OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory());
-
- OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping);
- // we need to add the attribute to the right spot in the list - stupid spec...
- int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute);
- this.specifiedAttributes.add(specifiedIndex, specifiedAttribute);
-
- // this will trigger the initial update;
- // no changes to either collection (virtual or specified) should be detected at this point
- specifiedAttribute.getMapping().setName(virtualAttribute.getName());
-
- // fire the list change events
- this.fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute);
- this.fireItemAdded(SPECIFIED_ATTRIBUTES_LIST, specifiedIndex, specifiedAttribute);
-
- // it should be safe to update the XML now
- Attributes xmlAttributes = this.getXmlAttributesForUpdate();
- specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes);
- // possibly a NOP, but needed when we trigger the creation of a new 'attributes'
- this.getXmlTypeMapping().setAttributes(xmlAttributes);
-
- // copy over the specified access(?)
- AccessType oldAccess = virtualAttribute.getJavaPersistentAttribute().getSpecifiedAccess();
- if (oldAccess != null) {
- specifiedAttribute.setSpecifiedAccess(oldAccess);
- }
- return specifiedAttribute;
- }
-
- // TODO this is used only by our tests...
- // we cannot delegate to getAttributeNamed(String).convertToSpecified()
- // because the tests use this method to add "orphan" xml attributes (that
- // do not have a corresponding java attribute :( )
- public OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName) {
- // force the creation of an empty xml attribute container beforehand or it will trigger
- // a sync and, if we do this after adding the attribute, clear out our context attributes
- Attributes xmlAttributes = this.getXmlAttributesForUpdate();
- this.getXmlTypeMapping().setAttributes(xmlAttributes); // possibly a NOP
-
- OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory());
-
- OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping);
- // we need to add the attribute to the right spot in the list - stupid spec...
- int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute);
- // the virtual attributes list should remain unchanged since the specified attribute has no name
- this.addItemToList(specifiedIndex, specifiedAttribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
- specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes);
-
- // this will trigger the update of the virtual attributes list
- specifiedAttribute.getMapping().setName(attributeName);
-
- return specifiedAttribute;
- }
-
- protected int getSpecifiedAttributeInsertionIndex(OrmPersistentAttribute attribute) {
- return CollectionTools.insertionIndexOf(this.specifiedAttributes, attribute, this.getAttributeComparator());
- }
-
- protected Comparator<OrmPersistentAttribute> getAttributeComparator() {
- return ATTRIBUTE_COMPARATOR;
- }
-
- protected static final Comparator<OrmPersistentAttribute> ATTRIBUTE_COMPARATOR =
- new Comparator<OrmPersistentAttribute>() {
- public int compare(OrmPersistentAttribute attribute1, OrmPersistentAttribute attribute2) {
- int seq1 = attribute1.getMapping().getXmlSequence();
- int seq2 = attribute2.getMapping().getXmlSequence();
- return (seq1 == seq2) ? 0 : (seq1 < seq2) ? -1 : 1;
- }
- };
-
- /**
- * <em>Silently</em> add the new virtual attribute before removing the
- * specified attribute, or the <em>update</em> will discover the missing
- * virtual attribute and add it preemptively.
- */
- public OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute) {
- if (specifiedAttribute.isVirtual()) {
- throw new IllegalArgumentException("Attribute is already virtual: " + specifiedAttribute); //$NON-NLS-1$
- }
-
- int virtualIndex = this.virtualAttributes.size();
- OrmReadOnlyPersistentAttribute virtualAttribute = null;
- // make sure the corresponding resource Java attribute actually exists in the *current* type;
- // do *not* take the context Java attribute directly from the specified ORM
- // attribute we are converting since it may have come from a superclass;
- // instead, use its resource Java attribute (which will match both name and access type,
- // but we still need to check its parent type)
- JavaResourcePersistentAttribute javaResourceAttribute = specifiedAttribute.getJavaResourcePersistentAttribute();
- if ((javaResourceAttribute != null) && this.javaResourceAttributeWillBeVirtual(javaResourceAttribute, specifiedAttribute)) {
- virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
- this.virtualAttributes.add(virtualIndex, virtualAttribute);
- }
-
- this.removeSpecifiedAttribute(specifiedAttribute); // trigger update
-
- if (virtualAttribute != null) {
- this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute);
- }
- return virtualAttribute;
- }
-
- /**
- * Return whether the specified Java resource attribute will be a
- * <em>virtual</em> attribute when the specified specified attribute is
- * removed from the type. The Java resource attribute must be among the
- * valid Java resource attributes and it must not correspond to any of the
- * remaining specified attributes.
- */
- protected boolean javaResourceAttributeWillBeVirtual(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
- return CollectionTools.contains(this.getJavaResourceAttributes(), javaResourceAttribute) &&
- (this.getSpecifiedAttributeFor(javaResourceAttribute, specifiedAttributeToBeRemoved) == null);
- }
-
-
- // ********** xml attributes **********
-
- /**
- * Return <code>null</code> if the <code>attributes</code> element is missing.
- */
- protected Attributes getXmlAttributes() {
- return this.getXmlTypeMapping().getAttributes();
- }
-
- /**
- * Build a new <code>attributes</code> element if it is not present;
- * but do <em>not</em> add it to the XML type mapping. Callers will have
- * to add it to the XML type mapping when appropriate.
- */
- protected Attributes getXmlAttributesForUpdate() {
- Attributes xmlAttributes = this.getXmlAttributes();
- return (xmlAttributes != null) ? xmlAttributes : this.buildXmlAttributes();
- }
-
- protected Attributes buildXmlAttributes() {
- return EmfTools.create(this.getResourceNodeFactory(), OrmPackage.eINSTANCE.getAttributes(), Attributes.class);
- }
-
- protected void removeXmlAttributesIfUnset() {
- if (this.getXmlAttributes().isUnset()) {
- this.getXmlTypeMapping().setAttributes(null);
- }
- }
-
-
- // ********** specified attributes **********
-
- public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
- return this.getSpecifiedAttributes().iterator();
- }
-
- protected ListIterable<OrmPersistentAttribute> getSpecifiedAttributes() {
- return new LiveCloneListIterable<OrmPersistentAttribute>(this.specifiedAttributes);
- }
-
- protected ListIterable<OrmReadOnlyPersistentAttribute> getReadOnlySpecifiedAttributes() {
- return new SuperListIterableWrapper<OrmReadOnlyPersistentAttribute>(this.getSpecifiedAttributes());
- }
-
- public int specifiedAttributesSize() {
- return this.specifiedAttributes.size();
- }
-
- protected void removeSpecifiedAttribute(OrmPersistentAttribute attribute) {
- this.removeSpecifiedAttribute_(attribute);
- attribute.getMapping().removeXmlAttributeMappingFrom(this.getXmlAttributes());
- this.removeXmlAttributesIfUnset();
- }
-
- public void changeMapping(OrmPersistentAttribute attribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) {
- // keep the context model in sync with each change to the resource model
- int sourceIndex = this.specifiedAttributes.indexOf(attribute);
- this.specifiedAttributes.remove(sourceIndex);
- oldMapping.removeXmlAttributeMappingFrom(this.getXmlAttributes());
-
- int targetIndex = this.getSpecifiedAttributeInsertionIndex(attribute);
- this.specifiedAttributes.add(targetIndex, attribute);
- newMapping.addXmlAttributeMappingTo(this.getXmlAttributes());
-
- oldMapping.initializeOn(newMapping);
-
- this.fireItemMoved(SPECIFIED_ATTRIBUTES_LIST, targetIndex, sourceIndex);
- }
-
- protected void initializeSpecifiedAttributes() {
- for (XmlAttributeMapping xmlMapping : this.getXmlAttributeMappings()) {
- this.specifiedAttributes.add(this.buildSpecifiedAttribute(xmlMapping));
- }
- }
-
- protected Iterable<XmlAttributeMapping> getXmlAttributeMappings() {
- Attributes xmlAttributes = this.getXmlAttributes();
- return (xmlAttributes != null) ? xmlAttributes.getAttributeMappings() : EmptyIterable.<XmlAttributeMapping>instance();
- }
-
- protected OrmPersistentAttribute buildSpecifiedAttribute(XmlAttributeMapping xmlMapping) {
- return this.getContextNodeFactory().buildOrmPersistentAttribute(this, xmlMapping);
- }
-
- protected void syncSpecifiedAttributes() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedAttributeContainerAdapter);
- }
-
- protected void moveSpecifiedAttribute_(int index, OrmPersistentAttribute attribute) {
- this.moveItemInList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
- }
-
- protected void addSpecifiedAttribute_(int index, XmlAttributeMapping xmlMapping) {
- OrmPersistentAttribute attribute = this.buildSpecifiedAttribute(xmlMapping);
- this.addItemToList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
- }
-
- protected void removeSpecifiedAttribute_(OrmPersistentAttribute attribute) {
- this.removeItemFromList(attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
- }
-
- /**
- * specified attribute container adapter
- */
- protected class SpecifiedAttributeContainerAdapter
- implements ContextContainerTools.Adapter<OrmPersistentAttribute, XmlAttributeMapping>
- {
- public Iterable<OrmPersistentAttribute> getContextElements() {
- return GenericOrmPersistentType.this.getSpecifiedAttributes();
- }
- public Iterable<XmlAttributeMapping> getResourceElements() {
- return GenericOrmPersistentType.this.getXmlAttributeMappings();
- }
- public XmlAttributeMapping getResourceElement(OrmPersistentAttribute contextElement) {
- return contextElement.getMapping().getXmlAttributeMapping();
- }
- public void moveContextElement(int index, OrmPersistentAttribute element) {
- GenericOrmPersistentType.this.moveSpecifiedAttribute_(index, element);
- }
- public void addContextElement(int index, XmlAttributeMapping resourceElement) {
- GenericOrmPersistentType.this.addSpecifiedAttribute_(index, resourceElement);
- }
- public void removeContextElement(OrmPersistentAttribute element) {
- GenericOrmPersistentType.this.removeSpecifiedAttribute_(element);
- }
- }
-
-
- // ********** virtual attributes **********
-
- public ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes() {
- return this.getVirtualAttributes().iterator();
- }
-
- public ListIterable<OrmReadOnlyPersistentAttribute> getVirtualAttributes() {
- return new LiveCloneListIterable<OrmReadOnlyPersistentAttribute>(this.virtualAttributes);
- }
-
- public int virtualAttributesSize() {
- return this.virtualAttributes.size();
- }
-
- protected void updateVirtualAttributes() {
- ContextContainerTools.update(this.virtualAttributeContainerAdapter);
- }
-
- /**
- * Return all the Java resource attributes that have the appropriate access
- * and do not have a corresponding <code>orm.xml</code> mapping currently
- * specified in the <code>orm.xml</code> persistent type.
- */
- protected Iterable<JavaResourcePersistentAttribute> getVirtualJavaResourceAttributes() {
- return new FilteringIterable<JavaResourcePersistentAttribute>(this.getJavaResourceAttributes()) {
- @Override
- protected boolean accept(JavaResourcePersistentAttribute javaResourceAttribute) {
- return GenericOrmPersistentType.this.javaResourceAttributeIsVirtual(javaResourceAttribute);
- }
- };
- }
-
- protected Iterable<JavaResourcePersistentAttribute> getJavaResourceAttributes() {
- return CollectionTools.iterable(this.javaResourceAttributes());
- }
-
- /**
- * Return the Java resource attributes with the appropriate access type.
- */
- protected Iterator<JavaResourcePersistentAttribute> javaResourceAttributes() {
- JavaResourcePersistentType javaResourceType = this.getJavaResourceType();
- return (javaResourceType != null) ?
- javaResourceType.persistableAttributes(this.getVirtualJavaAccess().getJavaAccessType()) :
- EmptyListIterator.<JavaResourcePersistentAttribute>instance();
- }
-
- protected JavaResourcePersistentType getJavaResourceType() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getResourcePersistentType();
- }
-
- /**
- * Return the access type that determines which Java attributes are to be
- * used for the <code>orm.xml</code> type's <em>virtual</em> attributes.
- */
- protected AccessType getVirtualJavaAccess() {
- if (this.specifiedAccess != null) {
- return this.specifiedAccess;
- }
- if (this.mapping.isMetadataComplete()) {
- return this.defaultAccess;
- }
- AccessType javaAccess = this.javaPersistentType.getSpecifiedAccess();
- return (javaAccess != null) ? javaAccess : this.defaultAccess;
- }
-
- protected boolean javaResourceAttributeIsVirtual(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getSpecifiedAttributeFor(javaResourceAttribute) == null;
- }
-
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getSpecifiedAttributeFor(javaResourceAttribute, null);
- }
-
- /**
- * Return the specified attribute corresponding to the specified Java
- * resource attribute, ignoring the specified excluded attribute (since
- * there can be more than one specified attribute per Java resource
- * attribute; albeit erroneously).
- */
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute exclude) {
- for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
- if (ormAttribute == exclude) {
- continue; // skip
- }
- if (ormAttribute.getJavaResourcePersistentAttribute() == javaResourceAttribute) {
- return ormAttribute;
- }
- }
- return null;
- }
-
- protected void moveVirtualAttribute(int index, OrmReadOnlyPersistentAttribute virtualAttribute) {
- this.moveItemInList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- protected void addVirtualAttribute(int index, JavaResourcePersistentAttribute javaResourceAttribute) {
- OrmReadOnlyPersistentAttribute virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
- this.addItemToList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getContextNodeFactory().buildVirtualOrmPersistentAttribute(this, javaResourceAttribute);
- }
-
- protected void removeVirtualAttribute(OrmReadOnlyPersistentAttribute virtualAttribute) {
- virtualAttribute.dispose();
- this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- /**
- * virtual attribute container adapter
- */
- protected class VirtualAttributeContainerAdapter
- implements ContextContainerTools.Adapter<OrmReadOnlyPersistentAttribute, JavaResourcePersistentAttribute>
- {
- public Iterable<OrmReadOnlyPersistentAttribute> getContextElements() {
- return GenericOrmPersistentType.this.getVirtualAttributes();
- }
- public Iterable<JavaResourcePersistentAttribute> getResourceElements() {
- return GenericOrmPersistentType.this.getVirtualJavaResourceAttributes();
- }
- public JavaResourcePersistentAttribute getResourceElement(OrmReadOnlyPersistentAttribute contextElement) {
- return contextElement.getJavaResourcePersistentAttribute();
- }
- public void moveContextElement(int index, OrmReadOnlyPersistentAttribute element) {
- GenericOrmPersistentType.this.moveVirtualAttribute(index, element);
- }
- public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) {
- GenericOrmPersistentType.this.addVirtualAttribute(index, resourceElement);
- }
- public void removeContextElement(OrmReadOnlyPersistentAttribute element) {
- GenericOrmPersistentType.this.removeVirtualAttribute(element);
- }
- }
-
-
- // ********** super persistent type **********
-
- public PersistentType getSuperPersistentType() {
- return this.superPersistentType;
- }
-
- protected void setSuperPersistentType(PersistentType persistentType) {
- PersistentType old = this.superPersistentType;
- this.superPersistentType = persistentType;
- this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, persistentType);
- }
-
- protected PersistentType buildSuperPersistentType() {
- PersistentType spt = this.buildSuperPersistentType_();
- if (spt == null) {
- return null;
- }
- // check for circular inheritance
- return CollectionTools.contains(spt.inheritanceHierarchy(), this) ? null : spt;
- }
-
- protected PersistentType buildSuperPersistentType_() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
- }
-
-
- // ********** inheritance **********
-
- public Iterator<PersistentType> inheritanceHierarchy() {
- return this.getInheritanceHierarchy().iterator();
- }
-
- public Iterable<PersistentType> getInheritanceHierarchy() {
- return this.getInheritanceHierarchyOf(this);
- }
-
- public Iterator<PersistentType> ancestors() {
- return this.getAncestors().iterator();
- }
-
- public Iterable<PersistentType> getAncestors() {
- return this.getInheritanceHierarchyOf(this.superPersistentType);
- }
-
- protected Iterable<PersistentType> getInheritanceHierarchyOf(PersistentType start) {
- // using a chain iterable to traverse up the inheritance tree
- return new ChainIterable<PersistentType>(start) {
- @Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
- }
- };
- }
-
-
- // ********** declaring type name **********
-
- public String getDeclaringTypeName() {
- return this.declaringTypeName;
- }
-
- protected void setDeclaringTypeName(String name) {
- String old = this.declaringTypeName;
- this.declaringTypeName = name;
- this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, name);
- }
-
- protected String buildDeclaringTypeName() {
- return this.isJpa2_0Compatible() ? this.buildDeclaringTypeName_() : null;
- }
-
- protected String buildDeclaringTypeName_() {
- return (this.javaPersistentType == null) ?
- null : ((JavaPersistentType2_0) this.javaPersistentType).getDeclaringTypeName();
- }
-
-
- // ********** metamodel **********
-
- protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildMetamodelSynchronizer(this) :
- null;
- }
-
- public IFile getMetamodelFile() {
- return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile();
- }
-
- public void initializeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- public boolean isManaged() {
- return true;
- }
-
- /**
- * All <code>orm.xml</code> persistent types must be able to generate a static metamodel
- * because 1.0 <code>orm.xml</code> files can be referenced from 2.0 persistence.xml files.
- */
- public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- if (this.javaPersistentType != null) {
- this.metamodelSynchronizer.synchronize(memberTypeTree);
- }
- }
-
- public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- if (this.javaPersistentType != null) {
- this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
- }
- }
-
- public void disposeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return OrmStructureNodes.PERSISTENT_TYPE_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
- if (attribute.contains(textOffset)) {
- return attribute;
- }
- }
- return this;
- }
-
- public TextRange getSelectionTextRange() {
- return this.mapping.getSelectionTextRange();
- }
-
- public void dispose() {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
- }
- for (OrmReadOnlyPersistentAttribute virtualAttribute : this.getVirtualAttributes()) {
- virtualAttribute.dispose();
- }
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getOverridePersistentTypeAccess() {
- if (this.specifiedAccess != null) {
- return this.specifiedAccess;
- }
-
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- if (this.mapping.isMetadataComplete()) {
- AccessType accessType = this.getOwnerDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- // no override access type
- return null;
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- return this.getOwnerDefaultAccess();
- }
-
-
- //*********** refactoring ***********
-
- public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
- return this.isFor(type.getFullyQualifiedName('.')) ?
- new SingleElementIterable<DeleteEdit>(this.mapping.createDeleteEdit()) :
- EmptyIterable.<DeleteEdit>instance();
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createRenameTypeEdits(originalType, newName),
- this.createSpecifiedAttributesRenameTypeEdits(originalType, newName)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesRenameTypeEdits(final IType originalType, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createRenameTypeEdits(originalType, newName);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createMoveTypeEdits(originalType, newPackage),
- this.createSpecifiedAttributesMoveTypeEdits(originalType, newPackage)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createMoveTypeEdits(originalType, newPackage);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createRenamePackageEdits(originalPackage, newName),
- this.createSpecifiedAttributesRenamePackageEdits(originalPackage, newName)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createRenamePackageEdits(originalPackage, newName);
- }
- }
- );
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateClass(messages);
- this.validateMapping(messages, reporter);
- this.validateAttributes(messages, reporter);
- }
-
- protected void validateClass(List<IMessage> messages) {
- if (this.javaPersistentType == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
- new String[] {this.getName()},
- this,
- this.mapping.getClassTextRange()
- )
- );
- }
- }
-
- protected void validateMapping(List<IMessage> messages, IReporter reporter) {
- try {
- this.mapping.validate(messages, reporter);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = this.attributes(); stream.hasNext(); ) {
- this.validateAttribute(stream.next(), messages, reporter);
- }
- }
-
- protected void validateAttribute(OrmReadOnlyPersistentAttribute attribute, List<IMessage> messages, IReporter reporter) {
- try {
- attribute.validate(messages, reporter);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.mapping.getValidationTextRange();
- return (textRange != null) ? textRange : this.getEntityMappings().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public EntityMappings getParent() {
- return (EntityMappings) super.getParent();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- public String getDefaultPackage() {
- return this.getEntityMappings().getPackage();
- }
-
- public boolean isFor(String typeName) {
- String name = this.getName();
- if (name == null) {
- return false;
- }
- if (name.equals(typeName)) {
- return true;
- }
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
- }
- return (defaultPackage + '.' + name).equals(typeName);
- }
-
- public boolean isIn(IPackageFragment packageFragment) {
- String packageName = this.getPackageName();
- if (Tools.valuesAreEqual(packageName, packageFragment.getElementName())) {
- return true;
- }
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
- }
- packageName = (packageName == null) ? defaultPackage : defaultPackage + '.' + packageName;
- return packageName.equals(packageFragment.getElementName());
- }
-
- protected String getPackageName() {
- String className = this.getName();
- if (className == null) {
- return null;
- }
- int lastPeriod = className.lastIndexOf('.');
- return (lastPeriod == -1) ? null : className.substring(0, lastPeriod);
- }
-
- public boolean contains(int textOffset) {
- return this.mapping.containsOffset(textOffset);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
deleted file mode 100644
index 642231286e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> primary key join column
- */
-public class GenericOrmPrimaryKeyJoinColumn
- extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn, OrmBaseJoinColumn.Owner>
- implements OrmPrimaryKeyJoinColumn
-{
- /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
- protected /* final */ XmlPrimaryKeyJoinColumn xmlColumn; // null for default pk join columns
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn xmlColumn) {
- super(parent, owner, xmlColumn);
- this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlPrimaryKeyJoinColumn getXmlColumn() {
- return this.xmlColumn;
- }
-
- @Override
- protected void setXmlColumn(XmlPrimaryKeyJoinColumn xmlColumn) {
- this.xmlColumn = xmlColumn;
- }
-
- /**
- * primary key join columns are part of a collection;
- * the 'primary-key-join-column' element will be removed/added
- * when the XML join column is removed from/added to
- * the owner's collection
- */
- @Override
- protected XmlPrimaryKeyJoinColumn buildXmlColumn() {
- throw new IllegalStateException("XML primary key join column is missing"); //$NON-NLS-1$
- }
-
- /**
- * @see #buildXmlColumn()
- */
- @Override
- protected void removeXmlColumn() {
- // do nothing
- }
-
-
- // ********** referenced column name **********
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String name) {
- this.setSpecifiedReferencedColumnName_(name);
- this.xmlColumn.setReferencedColumnName(name);
- }
-
- protected void setSpecifiedReferencedColumnName_(String name) {
- String old = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = name;
- this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildSpecifiedReferencedColumnName() {
- return (this.xmlColumn == null) ? null : this.xmlColumn.getReferencedColumnName();
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String name) {
- String old = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = name;
- this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- // TODO not correct when we start supporting
- // primary key join columns in 1-1 mappings
- protected String buildDefaultReferencedColumnName() {
- return this.buildDefaultName();
- }
-
-
- // ********** database stuff **********
-
- public Table getReferencedColumnDbTable() {
- return this.owner.getReferencedColumnDbTable();
- }
-
- protected Column getReferencedDbColumn() {
- Table table = this.getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
- }
-
- public boolean referencedColumnIsResolved() {
- return this.getReferencedDbColumn() != null;
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyPrimaryKeyJoinColumn oldColumn) {
- super.initializeFrom(oldColumn);
- this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
- }
-
- public boolean isDefault() {
- return this.owner.joinColumnIsDefault(this);
- }
-
- @Override
- public String getTable() {
- return this.owner.getDefaultTableName();
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmPrimaryKeyJoinColumnTextRangeResolver(this);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
deleted file mode 100644
index c0d42a00ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> query container
- */
-public class GenericOrmQueryContainer
- extends AbstractOrmXmlContextNode
- implements OrmQueryContainer
-{
- protected final XmlQueryContainer xmlQueryContainer;
-
- protected final Vector<OrmNamedQuery> namedQueries = new Vector<OrmNamedQuery>();
- protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter();
-
- protected final Vector<OrmNamedNativeQuery> namedNativeQueries = new Vector<OrmNamedNativeQuery>();
- protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter();
-
-
- public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer xmlQueryContainer) {
- super(parent);
- this.xmlQueryContainer = xmlQueryContainer;
- this.initializeNamedQueries();
- this.initializeNamedNativeQueries();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncNamedQueries();
- this.syncNamedNativeQueries();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getNamedQueries());
- this.updateNodes(this.getNamedNativeQueries());
- }
-
-
- // ********** named queries **********
-
- public ListIterator<OrmNamedQuery> namedQueries() {
- return this.getNamedQueries().iterator();
- }
-
- protected ListIterable<OrmNamedQuery> getNamedQueries() {
- return new LiveCloneListIterable<OrmNamedQuery>(this.namedQueries);
- }
-
- public int namedQueriesSize() {
- return this.namedQueries.size();
- }
-
- public OrmNamedQuery addNamedQuery() {
- return this.addNamedQuery(this.namedQueries.size());
- }
-
- public OrmNamedQuery addNamedQuery(int index) {
- XmlNamedQuery xmlQuery = this.buildXmlNamedQuery();
- OrmNamedQuery query = this.addNamedQuery_(index, xmlQuery);
- this.xmlQueryContainer.getNamedQueries().add(index, xmlQuery);
- return query;
- }
-
- protected XmlNamedQuery buildXmlNamedQuery() {
- return OrmFactory.eINSTANCE.createXmlNamedQuery();
- }
-
- public void removeNamedQuery(NamedQuery namedQuery) {
- this.removeNamedQuery(this.namedQueries.indexOf(namedQuery));
- }
-
- public void removeNamedQuery(int index) {
- this.removeNamedQuery_(index);
- this.xmlQueryContainer.getNamedQueries().remove(index);
- }
-
- protected void removeNamedQuery_(int index) {
- this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- public void moveNamedQuery(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST);
- this.xmlQueryContainer.getNamedQueries().move(targetIndex, sourceIndex);
- }
-
- protected void initializeNamedQueries() {
- for (XmlNamedQuery xmlQuery : this.getXmlNamedQueries()) {
- this.namedQueries.add(this.buildNamedQuery(xmlQuery));
- }
- }
-
- protected OrmNamedQuery buildNamedQuery(XmlNamedQuery xmlNamedQuery) {
- return this.getContextNodeFactory().buildOrmNamedQuery(this, xmlNamedQuery);
- }
-
- protected void syncNamedQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter);
- }
-
- protected Iterable<XmlNamedQuery> getXmlNamedQueries() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlNamedQuery>(this.xmlQueryContainer.getNamedQueries());
- }
-
- protected void moveNamedQuery_(int index, OrmNamedQuery namedQuery) {
- this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected OrmNamedQuery addNamedQuery_(int index, XmlNamedQuery xmlNamedQuery) {
- OrmNamedQuery query = this.buildNamedQuery(xmlNamedQuery);
- this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedQuery_(OrmNamedQuery namedQuery) {
- this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery));
- }
-
- /**
- * named query container adapter
- */
- protected class NamedQueryContainerAdapter
- implements ContextContainerTools.Adapter<OrmNamedQuery, XmlNamedQuery>
- {
- public Iterable<OrmNamedQuery> getContextElements() {
- return GenericOrmQueryContainer.this.getNamedQueries();
- }
- public Iterable<XmlNamedQuery> getResourceElements() {
- return GenericOrmQueryContainer.this.getXmlNamedQueries();
- }
- public XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) {
- return contextElement.getXmlQuery();
- }
- public void moveContextElement(int index, OrmNamedQuery element) {
- GenericOrmQueryContainer.this.moveNamedQuery_(index, element);
- }
- public void addContextElement(int index, XmlNamedQuery resourceElement) {
- GenericOrmQueryContainer.this.addNamedQuery_(index, resourceElement);
- }
- public void removeContextElement(OrmNamedQuery element) {
- GenericOrmQueryContainer.this.removeNamedQuery_(element);
- }
- }
-
-
- // ********** named native queries **********
-
- public ListIterator<OrmNamedNativeQuery> namedNativeQueries() {
- return this.getNamedNativeQueries().iterator();
- }
-
- protected ListIterable<OrmNamedNativeQuery> getNamedNativeQueries() {
- return new LiveCloneListIterable<OrmNamedNativeQuery>(this.namedNativeQueries);
- }
-
- public int namedNativeQueriesSize() {
- return this.namedNativeQueries.size();
- }
-
- public OrmNamedNativeQuery addNamedNativeQuery() {
- return this.addNamedNativeQuery(this.namedNativeQueries.size());
- }
-
- public OrmNamedNativeQuery addNamedNativeQuery(int index) {
- XmlNamedNativeQuery xmlQuery = this.buildXmlNamedNativeQuery();
- OrmNamedNativeQuery query = this.addNamedNativeQuery_(index, xmlQuery);
- this.xmlQueryContainer.getNamedNativeQueries().add(index, xmlQuery);
- return query;
- }
-
- protected XmlNamedNativeQuery buildXmlNamedNativeQuery() {
- return OrmFactory.eINSTANCE.createXmlNamedNativeQuery();
- }
-
- public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
- }
-
- public void removeNamedNativeQuery(int index) {
- this.removeNamedNativeQuery_(index);
- this.xmlQueryContainer.getNamedNativeQueries().remove(index);
- }
-
- protected void removeNamedNativeQuery_(int index) {
- this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- this.xmlQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex);
- }
-
- protected void initializeNamedNativeQueries() {
- for (XmlNamedNativeQuery xmlQuery : this.getXmlNamedNativeQueries()) {
- this.namedNativeQueries.add(this.buildNamedNativeQuery(xmlQuery));
- }
- }
-
- protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery xmlNamedNativeQuery) {
- return this.getContextNodeFactory().buildOrmNamedNativeQuery(this, xmlNamedNativeQuery);
- }
-
- protected void syncNamedNativeQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter);
- }
-
- protected Iterable<XmlNamedNativeQuery> getXmlNamedNativeQueries() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlNamedNativeQuery>(this.xmlQueryContainer.getNamedNativeQueries());
- }
-
- protected void moveNamedNativeQuery_(int index, OrmNamedNativeQuery namedNativeQuery) {
- this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected OrmNamedNativeQuery addNamedNativeQuery_(int index, XmlNamedNativeQuery xmlNamedNativeQuery) {
- OrmNamedNativeQuery query = this.buildNamedNativeQuery(xmlNamedNativeQuery);
- this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedNativeQuery_(OrmNamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery));
- }
-
- /**
- * named native query container adapter
- */
- protected class NamedNativeQueryContainerAdapter
- implements ContextContainerTools.Adapter<OrmNamedNativeQuery, XmlNamedNativeQuery>
- {
- public Iterable<OrmNamedNativeQuery> getContextElements() {
- return GenericOrmQueryContainer.this.getNamedNativeQueries();
- }
- public Iterable<XmlNamedNativeQuery> getResourceElements() {
- return GenericOrmQueryContainer.this.getXmlNamedNativeQueries();
- }
- public XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) {
- return contextElement.getXmlQuery();
- }
- public void moveContextElement(int index, OrmNamedNativeQuery element) {
- GenericOrmQueryContainer.this.moveNamedNativeQuery_(index, element);
- }
- public void addContextElement(int index, XmlNamedNativeQuery resourceElement) {
- GenericOrmQueryContainer.this.addNamedNativeQuery_(index, resourceElement);
- }
- public void removeContextElement(OrmNamedNativeQuery element) {
- GenericOrmQueryContainer.this.removeNamedNativeQuery_(element);
- }
- }
-
-
- // ********** validation **********
-
- /**
- * The queries are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateQueries(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // queries are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlQueryContainer.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
deleted file mode 100644
index 370b277edb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
-
-/**
- * <code>orm.xml</code> query hint
- */
-public class GenericOrmQueryHint
- extends AbstractOrmXmlContextNode
- implements OrmQueryHint
-{
- protected final XmlQueryHint xmlQueryHint;
-
- protected String name;
- protected String value;
-
-
- public GenericOrmQueryHint(OrmQuery parent, XmlQueryHint xmlQueryHint) {
- super(parent);
- this.xmlQueryHint = xmlQueryHint;
- this.name = xmlQueryHint.getName();
- this.value = xmlQueryHint.getValue();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.xmlQueryHint.getName());
- this.setValue_(this.xmlQueryHint.getValue());
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.setName_(name);
- this.xmlQueryHint.setName(name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
-
- // ********** value **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- this.setValue_(value);
- this.xmlQueryHint.setValue(value);
- }
-
- protected void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlQueryHint.getValidationTextRange();
- return (textRange != null) ? textRange : this.getQuery().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmQuery getParent() {
- return (OrmQuery) super.getParent();
- }
-
- protected OrmQuery getQuery() {
- return this.getParent();
- }
-
- public XmlQueryHint getXmlQueryHint() {
- return this.xmlQueryHint;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
deleted file mode 100644
index f6a5bc41c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-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.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> join table or collection table
- */
-public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTable>
- extends AbstractOrmTable<X>
- implements OrmReferenceTable
-{
- protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
- protected final OrmJoinColumn.Owner joinColumnOwner;
-
- protected OrmJoinColumn defaultJoinColumn;
-
-
- protected GenericOrmReferenceTable(XmlContextNode parent, Owner owner) {
- super(parent, owner);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedJoinColumns();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getSpecifiedJoinColumns());
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterator<OrmJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedJoinColumn() {
- MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this);
- }
-
-
- // ********** specified join columns **********
-
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
- }
-
- public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- X xmlTable = this.getXmlTableForUpdate();
- XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn);
- xmlTable.getJoinColumns().add(index, xmlJoinColumn);
- return joinColumn;
- }
-
- protected XmlJoinColumn buildXmlJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn();
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- this.removeSpecifiedJoinColumn_(index);
- this.getXmlTable().getJoinColumns().remove(index);
- this.removeXmlTableIfUnset();
- }
-
- protected void removeSpecifiedJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- this.getXmlTable().getJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected void initializeSpecifiedJoinColumns() {
- for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
- }
- }
-
- protected void syncSpecifiedJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
- }
-
- protected Iterable<XmlJoinColumn> getXmlJoinColumns() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ?
- EmptyIterable.<XmlJoinColumn>instance() :
- // clone to reduce chance of concurrency problems
- new LiveCloneIterable<XmlJoinColumn>(xmlTable.getJoinColumns());
- }
-
- protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
- OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- /**
- * specified join column container adapter
- */
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
- {
- public Iterable<OrmJoinColumn> getContextElements() {
- return GenericOrmReferenceTable.this.getSpecifiedJoinColumns();
- }
- public Iterable<XmlJoinColumn> getResourceElements() {
- return GenericOrmReferenceTable.this.getXmlJoinColumns();
- }
- public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- public void moveContextElement(int index, OrmJoinColumn element) {
- GenericOrmReferenceTable.this.moveSpecifiedJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlJoinColumn resourceElement) {
- GenericOrmReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmJoinColumn element) {
- GenericOrmReferenceTable.this.removeSpecifiedJoinColumn_(element);
- }
- }
-
- protected abstract OrmJoinColumn.Owner buildJoinColumnOwner();
-
-
- // ********** default join column **********
-
- public OrmJoinColumn getDefaultJoinColumn() {
- return this.defaultJoinColumn;
- }
-
- protected void setDefaultJoinColumn(OrmJoinColumn joinColumn) {
- OrmJoinColumn old = this.defaultJoinColumn;
- this.defaultJoinColumn = joinColumn;
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
- }
-
- protected ListIterable<OrmJoinColumn> getDefaultJoinColumns() {
- return (this.defaultJoinColumn != null) ?
- new SingleElementListIterable<OrmJoinColumn>(this.defaultJoinColumn) :
- EmptyListIterable.<OrmJoinColumn>instance();
- }
-
- protected int getDefaultJoinColumnsSize() {
- return (this.defaultJoinColumn == null) ? 0 : 1;
- }
-
- protected void updateDefaultJoinColumn() {
- if (this.buildsDefaultJoinColumn()) {
- if (this.defaultJoinColumn == null) {
- this.setDefaultJoinColumn(this.buildJoinColumn(null));
- } else {
- this.defaultJoinColumn.update();
- }
- } else {
- this.setDefaultJoinColumn(null);
- }
- }
-
- protected boolean buildsDefaultJoinColumn() {
- return ! this.hasSpecifiedJoinColumns();
- }
-
-
- // ********** misc **********
-
- protected void initializeFrom(ReadOnlyReferenceTable oldTable) {
- super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) {
- this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) {
- this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
- }
- }
-
- protected OrmJoinColumn buildJoinColumn(XmlJoinColumn xmlJoinColumn) {
- return this.getContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, xmlJoinColumn);
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- boolean continueValidating = this.buildTableValidator().validate(messages, reporter);
-
- //join column validation will handle the check for whether to validate against the database
- //some validation messages are not database specific. If the database validation for the
- //table fails we will stop there and not validate the join columns at all
- if (continueValidating) {
- this.validateJoinColumns(messages, reporter);
- }
- }
-
- protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
- this.validateJoinColumns(this.getJoinColumns(), messages, reporter);
- }
-
- protected void validateJoinColumns(Iterable<OrmJoinColumn> joinColumns, List<IMessage> messages, IReporter reporter) {
- for (OrmJoinColumn joinColumn : joinColumns) {
- joinColumn.validate(messages, reporter);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
deleted file mode 100644
index e9c73a6993..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-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.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.NamedColumn;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-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.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> secondary table
- */
-public class GenericOrmSecondaryTable
- extends AbstractOrmTable<XmlSecondaryTable>
- implements OrmSecondaryTable
-{
- /** @see AbstractOrmTable#AbstractOrmTable(org.eclipse.jpt.jpa.core.context.XmlContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable) */
- protected /* final */ XmlSecondaryTable xmlSecondaryTable;
-
- protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
- protected final OrmBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
-
- protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
-
- public GenericOrmSecondaryTable(OrmEntity parent, Owner owner, XmlSecondaryTable xmlSecondaryTable) {
- super(parent, owner, xmlSecondaryTable);
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedPrimaryKeyJoinColumns();
- if (this.defaultPrimaryKeyJoinColumn != null) {
- this.defaultPrimaryKeyJoinColumn.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns());
- this.updateDefaultPrimaryKeyJoinColumn();
- }
-
-
- // ********** XML table **********
-
- @Override
- public XmlSecondaryTable getXmlTable() {
- return this.xmlSecondaryTable;
- }
-
- /**
- * @see AbstractOrmTable
- */
- @Override
- protected void setXmlTable(XmlSecondaryTable xmlTable) {
- this.xmlSecondaryTable = xmlTable;
- }
-
- /**
- * secondary tables are part of a collection;
- * the 'secondary-table' element will be removed from/added
- * when the XML secondary table is removed/added to
- * the XML entity's collection
- */
- @Override
- protected XmlSecondaryTable buildXmlTable() {
- throw new IllegalStateException("XML secondary table is missing"); //$NON-NLS-1$
- }
-
- /**
- * @see #buildXmlTable()
- */
- @Override
- protected void removeXmlTable() {
- // do nothing
- }
-
-
- // ********** primary key join columns **********
-
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
- }
-
-
- // ********** specified primary key join columns **********
-
- public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
- }
-
- public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
- }
-
- protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.size() != 0;
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn joinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlJoinColumn);
- this.xmlSecondaryTable.getPrimaryKeyJoinColumns().add(index, xmlJoinColumn);
- return joinColumn;
- }
-
- protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(index);
- this.xmlSecondaryTable.getPrimaryKeyJoinColumns().remove(index);
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- this.xmlSecondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
- this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn));
- }
- }
-
- protected void syncSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
- }
-
- protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.xmlSecondaryTable.getPrimaryKeyJoinColumns());
- }
-
- protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) {
- OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
- }
-
- /**
- * specified primary key join column container adapter
- */
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
- {
- public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
- return GenericOrmSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
- }
- public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
- return GenericOrmSecondaryTable.this.getXmlPrimaryKeyJoinColumns();
- }
- public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
- GenericOrmSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
- GenericOrmSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
- GenericOrmSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
- }
- }
-
- protected OrmBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
-
- // ********** default primary key join column **********
-
- public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- return this.defaultPrimaryKeyJoinColumn;
- }
-
- protected void setDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn joinColumn) {
- OrmPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
- this.defaultPrimaryKeyJoinColumn = joinColumn;
- this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, joinColumn);
- }
-
- protected ListIterable<OrmPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- return (this.defaultPrimaryKeyJoinColumn != null) ?
- new SingleElementListIterable<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
- EmptyListIterable.<OrmPrimaryKeyJoinColumn>instance();
- }
-
- protected int getDefaultPrimaryKeyJoinColumnsSize() {
- return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
- }
-
- protected void updateDefaultPrimaryKeyJoinColumn() {
- if (this.buildsDefaultPrimaryKeyJoinColumn()) {
- if (this.defaultPrimaryKeyJoinColumn == null) {
- this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(null));
- } else {
- this.defaultPrimaryKeyJoinColumn.update();
- }
- } else {
- this.setDefaultPrimaryKeyJoinColumn(null);
- }
- }
-
- protected boolean buildsDefaultPrimaryKeyJoinColumn() {
- return ! this.hasSpecifiedPrimaryKeyJoinColumns();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmEntity getParent() {
- return (OrmEntity) super.getParent();
- }
-
- protected OrmEntity getEntity() {
- return this.getParent();
- }
-
- public boolean isVirtual() {
- return false;
- }
-
- public void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable) {
- super.initializeFrom(oldSecondaryTable);
- for (ReadOnlyPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
- this.addSpecifiedPrimaryKeyJoinColumn().initializeFrom(pkJoinColumn);
- }
- }
-
- protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlJoinColumn) {
- return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlJoinColumn);
- }
-
-
- // ********** defaults **********
-
- /**
- * a secondary table doesn't have a default name
- */
- @Override
- protected String buildDefaultName() {
- return null;
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- boolean continueValidating = this.buildTableValidator().validate(messages, reporter);
-
- //join column validation will handle the check for whether to validate against the database
- //some validation messages are not database specific. If the database validation for the
- //table fails we will stop there and not validate the join columns at all
- if (continueValidating) {
- for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.validate(messages, reporter);
- }
- }
- }
-
-
- // ********** primary key join column owner adapter **********
-
- protected class PrimaryKeyJoinColumnOwner
- implements OrmBaseJoinColumn.Owner
- {
- protected OrmEntity getEntity() {
- return GenericOrmSecondaryTable.this.getEntity();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getEntity();
- }
-
- public String getDefaultTableName() {
- return GenericOrmSecondaryTable.this.getName();
- }
-
- public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = this.getEntity().getParentEntity();
- return (parentEntity != null) ?
- parentEntity.getPrimaryKeyColumnName() :
- this.getEntity().getPrimaryKeyColumnName();
- }
-
- public Table resolveDbTable(String tableName) {
- return GenericOrmSecondaryTable.this.getDbTable();
- }
-
- public int joinColumnsSize() {
- return GenericOrmSecondaryTable.this.primaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmSecondaryTable.this.getValidationTextRange();
- }
-
- protected String getSecondaryTableName() {
- return GenericOrmSecondaryTable.this.getName();
- }
-
- public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
deleted file mode 100644
index 5e56c71cc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * <code>orm.xml</code> sequence generator
- */
-public class GenericOrmSequenceGenerator
- extends AbstractOrmSequenceGenerator
-{
- public GenericOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
- super(parent, xmlSequenceGenerator);
- }
-
- // ********** database stuff **********
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a catalog.
- */
- @Override
- protected String getCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a schema.
- */
- @Override
- protected String getSchema() {
- return this.getContextDefaultSchema();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java
deleted file mode 100644
index 0832952ada..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTable;
-
-/**
- * <code>orm.xml</code> table
- */
-public class GenericOrmTable
- extends AbstractOrmTable<XmlTable>
-{
- public GenericOrmTable(OrmEntity parent, Owner owner) {
- super(parent, owner);
- }
-
-
- // ********** XML table **********
-
- @Override
- protected XmlTable getXmlTable() {
- return this.getXmlEntity().getTable();
- }
-
- @Override
- protected XmlTable buildXmlTable() {
- XmlTable xmlTable = OrmFactory.eINSTANCE.createXmlTable();
- this.getXmlEntity().setTable(xmlTable);
- return xmlTable;
- }
-
- @Override
- protected void removeXmlTable() {
- this.getXmlEntity().setTable(null);
- }
-
- protected XmlEntity getXmlEntity() {
- return this.getEntity().getXmlTypeMapping();
- }
-
-
- // ********** defaults **********
-
- @Override
- protected String buildDefaultName() {
- return this.getEntity().getDefaultTableName();
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getEntity().getDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getEntity().getDefaultCatalog();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmEntity getParent() {
- return (OrmEntity) super.getParent();
- }
-
- protected OrmEntity getEntity() {
- return this.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
deleted file mode 100644
index 9805b186f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> table generator
- */
-public class GenericOrmTableGenerator
- extends AbstractOrmGenerator<XmlTableGenerator>
- implements OrmTableGenerator, UniqueConstraint.Owner
-{
- protected String specifiedTable;
- protected String defaultTable;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedPkColumnName;
- protected String defaultPkColumnName;
-
- protected String specifiedValueColumnName;
- protected String defaultValueColumnName;
-
- protected String specifiedPkColumnValue;
- protected String defaultPkColumnValue;
-
- protected final Vector<OrmUniqueConstraint> uniqueConstraints = new Vector<OrmUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
-
-
- // ********** constructor **********
-
- public GenericOrmTableGenerator(XmlContextNode parent, XmlTableGenerator xmlTableGenerator) {
- super(parent, xmlTableGenerator);
- this.specifiedTable = xmlTableGenerator.getTable();
- this.specifiedSchema = xmlTableGenerator.getSchema();
- this.specifiedCatalog = xmlTableGenerator.getCatalog();
- this.specifiedPkColumnName = xmlTableGenerator.getPkColumnName();
- this.specifiedValueColumnName = xmlTableGenerator.getValueColumnName();
- this.specifiedPkColumnValue = xmlTableGenerator.getPkColumnValue();
- this.initializeUniqueContraints();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedTable_(this.xmlGenerator.getTable());
- this.setSpecifiedSchema_(this.xmlGenerator.getSchema());
- this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog());
- this.setSpecifiedPkColumnName_(this.xmlGenerator.getPkColumnName());
- this.setSpecifiedValueColumnName_(this.xmlGenerator.getValueColumnName());
- this.setSpecifiedPkColumnValue_(this.xmlGenerator.getPkColumnValue());
- this.syncUniqueConstraints();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultTable(this.buildDefaultTable());
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setDefaultPkColumnName(this.buildDefaultPkColumnName());
- this.setDefaultValueColumnName(this.buildDefaultValueColumnName());
- this.setDefaultPkColumnValue(this.buildDefaultPkColumnValue());
- this.updateNodes(this.getUniqueConstraints());
- }
-
-
- // ********** initial value **********
-
- @Override
- protected int buildDefaultInitialValue() {
- return DEFAULT_INITIAL_VALUE;
- }
-
-
- // ********** table **********
-
- public String getTable() {
- return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
- }
-
- public String getSpecifiedTable() {
- return this.specifiedTable;
- }
-
- public void setSpecifiedTable(String table) {
- this.setSpecifiedTable_(table);
- this.xmlGenerator.setTable(table);
- }
-
- protected void setSpecifiedTable_(String table) {
- String old = this.specifiedTable;
- this.specifiedTable = table;
- this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
- }
-
- 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 null; // TODO the default table is determined by the runtime provider...
- }
-
- public Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable());
- }
-
-
- // ********** schema **********
-
- @Override
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- this.setSpecifiedSchema_(schema);
- this.xmlGenerator.setSchema(schema);
- }
-
- protected void setSpecifiedSchema_(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
- }
-
- public String getDefaultSchema() {
- return this.defaultSchema;
- }
-
- protected void setDefaultSchema(String schema) {
- String old = this.defaultSchema;
- this.defaultSchema = schema;
- this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- this.setSpecifiedCatalog_(catalog);
- this.xmlGenerator.setCatalog(catalog);
- }
-
- protected void setSpecifiedCatalog_(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String catalog) {
- String old = this.defaultCatalog;
- this.defaultCatalog = catalog;
- this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** primary key column name **********
-
- public String getPkColumnName() {
- return (this.specifiedPkColumnName != null) ? this.specifiedPkColumnName : this.defaultPkColumnName;
- }
-
- public String getSpecifiedPkColumnName() {
- return this.specifiedPkColumnName;
- }
-
- public void setSpecifiedPkColumnName(String name) {
- this.setSpecifiedPkColumnName_(name);
- this.xmlGenerator.setPkColumnName(name);
- }
-
- protected void setSpecifiedPkColumnName_(String name) {
- String old = this.specifiedPkColumnName;
- this.specifiedPkColumnName = name;
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name);
- }
-
- public String getDefaultPkColumnName() {
- return this.defaultPkColumnName;
- }
-
- protected void setDefaultPkColumnName(String name) {
- String old = this.defaultPkColumnName;
- this.defaultPkColumnName = name;
- this.firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultPkColumnName() {
- return null; // TODO the default pk column name is determined by the runtime provider...
- }
-
-
- // ********** value column name **********
-
- public String getValueColumnName() {
- return (this.specifiedValueColumnName != null) ? this.specifiedValueColumnName : this.defaultValueColumnName;
- }
-
- public String getSpecifiedValueColumnName() {
- return this.specifiedValueColumnName;
- }
-
- public void setSpecifiedValueColumnName(String name) {
- this.setSpecifiedValueColumnName_(name);
- this.xmlGenerator.setValueColumnName(name);
- }
-
- protected void setSpecifiedValueColumnName_(String name) {
- String old = this.specifiedValueColumnName;
- this.specifiedValueColumnName = name;
- this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, name);
- }
-
- public String getDefaultValueColumnName() {
- return this.defaultValueColumnName;
- }
-
- protected void setDefaultValueColumnName(String name) {
- String old = this.defaultValueColumnName;
- this.defaultValueColumnName = name;
- this.firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultValueColumnName() {
- return null; // TODO the default value column name is determined by the runtime provider...
- }
-
-
- // ********** primary key column value **********
-
- public String getPkColumnValue() {
- return (this.specifiedPkColumnValue != null) ? this.specifiedPkColumnValue : this.defaultPkColumnValue;
- }
-
- public String getSpecifiedPkColumnValue() {
- return this.specifiedPkColumnValue;
- }
-
- public void setSpecifiedPkColumnValue(String value) {
- this.setSpecifiedPkColumnValue_(value);
- this.xmlGenerator.setPkColumnValue(value);
- }
-
- protected void setSpecifiedPkColumnValue_(String value) {
- String old = this.specifiedPkColumnValue;
- this.specifiedPkColumnValue = value;
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, value);
- }
-
- public String getDefaultPkColumnValue() {
- return this.defaultPkColumnValue;
- }
-
- protected void setDefaultPkColumnValue(String value) {
- String old = this.defaultPkColumnValue;
- this.defaultPkColumnValue = value;
- this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value);
- }
-
- protected String buildDefaultPkColumnValue() {
- return null; // TODO the default pk column value is determined by the runtime provider...
- }
-
-
- // ********** unique constraints **********
-
- public Iterable<OrmUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneIterable<OrmUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public OrmUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
- }
-
- public OrmUniqueConstraint addUniqueConstraint(int index) {
- XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
- OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint);
- this.xmlGenerator.getUniqueConstraints().add(index, xmlConstraint);
- return constraint;
- }
-
- protected XmlUniqueConstraint buildXmlUniqueConstraint() {
- return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- this.removeUniqueConstraint_(index);
- this.xmlGenerator.getUniqueConstraints().remove(index);
- }
-
- protected void removeUniqueConstraint_(int index) {
- this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- this.xmlGenerator.getUniqueConstraints().move(targetIndex, sourceIndex);
- }
-
- protected void initializeUniqueContraints() {
- for (XmlUniqueConstraint constraint : this.getXmlUniqueConstraints()) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(constraint));
- }
- }
-
- protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
- return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
- }
-
- protected void syncUniqueConstraints() {
- ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
- }
-
- protected Iterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlUniqueConstraint>(this.xmlGenerator.getUniqueConstraints());
- }
-
- protected void moveUniqueConstraint_(int index, OrmUniqueConstraint uniqueConstraint) {
- this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) {
- OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint);
- this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return constraint;
- }
-
- protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- /**
- * unique constraint container adapter
- */
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<OrmUniqueConstraint, XmlUniqueConstraint>
- {
- public Iterable<OrmUniqueConstraint> getContextElements() {
- return GenericOrmTableGenerator.this.getUniqueConstraints();
- }
- public Iterable<XmlUniqueConstraint> getResourceElements() {
- return GenericOrmTableGenerator.this.getXmlUniqueConstraints();
- }
- public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
- return contextElement.getXmlUniqueConstraint();
- }
- public void moveContextElement(int index, OrmUniqueConstraint element) {
- GenericOrmTableGenerator.this.moveUniqueConstraint_(index, element);
- }
- public void addContextElement(int index, XmlUniqueConstraint resourceElement) {
- GenericOrmTableGenerator.this.addUniqueConstraint_(index, resourceElement);
- }
- public void removeContextElement(OrmUniqueConstraint element) {
- GenericOrmTableGenerator.this.removeUniqueConstraint_(element);
- }
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
deleted file mode 100644
index 138e39344f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.TemporalConverter;
-import org.eclipse.jpt.jpa.core.context.TemporalType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmTemporalConverter
- extends AbstractOrmConverter
- implements OrmTemporalConverter
-{
- protected TemporalType temporalType;
-
-
- public GenericOrmTemporalConverter(OrmAttributeMapping parent) {
- super(parent);
- this.temporalType = this.buildTemporalType();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setTemporalType_(this.buildTemporalType());
- }
-
-
- // ********** temporal type **********
-
- public TemporalType getTemporalType() {
- return this.temporalType;
- }
-
- public void setTemporalType(TemporalType temporalType) {
- this.setTemporalType_(temporalType);
- this.setXmlTemporal(temporalType);
- }
-
- protected void setTemporalType_(TemporalType temporalType) {
- TemporalType old = this.temporalType;
- this.temporalType = temporalType;
- this.firePropertyChanged(TEMPORAL_TYPE_PROPERTY, old, temporalType);
- }
-
- protected void setXmlTemporal(TemporalType temporalType) {
- this.getXmlConvertibleMapping().setTemporal(TemporalType.toOrmResourceModel(temporalType));
- }
-
- protected TemporalType buildTemporalType() {
- return TemporalType.fromOrmResourceModel(this.getXmlConvertibleMapping().getTemporal());
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return TemporalConverter.class;
- }
-
- public void initialize() {
- // start with DATE(?)
- this.temporalType = TemporalType.DATE;
- this.setXmlTemporal(this.temporalType);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateAttributeTypeWithTemporal(messages);
- }
-
- protected void validateAttributeTypeWithTemporal(List<IMessage> messages) {
- if (this.getAttributeMapping().getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
- @SuppressWarnings("rawtypes")
- String typeName = ((AbstractOrmElementCollectionMapping2_0) this.getAttributeMapping()).getTargetClass();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- }
- } else {
- String typeName = this.getAttributeMapping().getPersistentAttribute().getTypeName();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- }
-
- }
- }
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getTemporalTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
deleted file mode 100644
index fdd0cbbe07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
-
-/**
- * <code>orm.xml</code> transient mapping
- */
-public class GenericOrmTransientMapping
- extends AbstractOrmAttributeMapping<XmlTransient>
- implements OrmTransientMapping
-{
- public GenericOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 90;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmTransientMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getTransients().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getTransients().remove(this.xmlAttributeMapping);
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
deleted file mode 100644
index 37ff432641..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-
-public class GenericOrmUniqueConstraint
- extends AbstractOrmReadOnlyUniqueConstraint
- implements OrmUniqueConstraint
-{
- protected Owner owner;
- protected final XmlUniqueConstraint xmlUniqueConstraint;
-
-
- public GenericOrmUniqueConstraint(XmlContextNode parent, Owner owner, XmlUniqueConstraint xmlUniqueConstraint) {
- super(parent);
- this.owner = owner;
- this.xmlUniqueConstraint = xmlUniqueConstraint;
- this.initializeColumnNames();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncColumnNames();
- }
-
-
- // ********** column names **********
-
- public void addColumnName(String columnName) {
- this.addColumnName(this.columnNames.size(), columnName);
- }
-
- public void addColumnName(int index, String columnName) {
- this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().add(index, columnName);
- }
-
- public void removeColumnName(String columnName) {
- this.removeColumnName(this.columnNames.indexOf(columnName));
- }
-
- public void removeColumnName(int index) {
- this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().remove(index);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().move(targetIndex, sourceIndex);
- }
-
- protected void initializeColumnNames() {
- for (String xmlColumnName : this.xmlUniqueConstraint.getColumnNames()) {
- this.columnNames.add(xmlColumnName);
- }
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.xmlUniqueConstraint.getColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlUniqueConstraint.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public XmlUniqueConstraint getXmlUniqueConstraint() {
- return this.xmlUniqueConstraint;
- }
-
- public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) {
- for (String columnName : oldUniqueConstraint.getColumnNames()) {
- this.addColumnName(columnName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
deleted file mode 100644
index 5cd6602686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVersionMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
-
-
-public class GenericOrmVersionMapping
- extends AbstractOrmVersionMapping<XmlVersion>
-{
- public GenericOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
deleted file mode 100644
index aee0a4591d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
-
-/**
- * Virtual <code>orm.xml</code> association override
- */
-public class GenericOrmVirtualAssociationOverride
- extends AbstractOrmVirtualOverride<OrmAssociationOverrideContainer>
- implements OrmVirtualAssociationOverride
-{
- protected final OrmVirtualOverrideRelationship relationship;
-
-
- public GenericOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name) {
- super(parent, name);
- this.relationship = this.buildRelationship();
- }
-
- @Override
- public void update() {
- super.update();
- this.relationship.update();
- }
-
- @Override
- public OrmAssociationOverride convertToSpecified() {
- return (OrmAssociationOverride) super.convertToSpecified();
- }
-
- public RelationshipMapping getMapping() {
- return this.getContainer().getRelationshipMapping(this.name);
- }
-
-
- // ********** relationship **********
-
- public OrmVirtualOverrideRelationship getRelationship() {
- return this.relationship;
- }
-
- /**
- * The relationship should be available (since its presence precipitated the
- * creation of the virtual override).
- */
- protected OrmVirtualOverrideRelationship buildRelationship() {
- return this.getContextNodeFactory().buildOrmVirtualOverrideRelationship(this);
- }
-
- public Relationship resolveOverriddenRelationship() {
- return this.getContainer().resolveOverriddenRelationship(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
deleted file mode 100644
index d1327dba88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
-
-/**
- * Virtual <code>orm.xml</code> attribute override
- */
-public class GenericOrmVirtualAttributeOverride
- extends AbstractOrmVirtualOverride<OrmAttributeOverrideContainer>
- implements OrmVirtualAttributeOverride, OrmVirtualColumn.Owner
-{
- protected final OrmVirtualColumn column;
-
-
- public GenericOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name) {
- super(parent, name);
- this.column = this.buildColumn();
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update();
- }
-
- @Override
- public OrmAttributeOverride convertToSpecified() {
- return (OrmAttributeOverride) super.convertToSpecified();
- }
-
-
- // ********** column **********
-
- public OrmVirtualColumn getColumn() {
- return this.column;
- }
-
- /**
- * The original column should be available (since the presence of its
- * attribute is what precipitated the creation of the virtual override).
- */
- protected OrmVirtualColumn buildColumn() {
- return this.getContextNodeFactory().buildOrmVirtualColumn(this, this);
- }
-
-
- // ********** column owner implementation **********
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public String getDefaultTableName() {
- String overriddenColumnTable = this.getOverriddenColumnTable();
- return (overriddenColumnTable != null) ? overriddenColumnTable : this.getContainer().getDefaultTableName();
- }
-
- protected String getOverriddenColumnTable() {
- ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
- // pretty sure this is the *specified* table...
- return (overriddenColumn == null) ? null : overriddenColumn.getSpecifiedTable();
- }
-
- public String getDefaultColumnName() {
- String overriddenColumnName = this.getOverriddenColumnName();
- return (overriddenColumnName != null) ? overriddenColumnName : this.name;
- }
-
- protected String getOverriddenColumnName() {
- ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
- return (overriddenColumn == null) ? null : overriddenColumn.getName();
- }
-
- public Column resolveOverriddenColumn() {
- return this.getContainer().resolveOverriddenColumn(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
deleted file mode 100644
index 6f50c93750..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
-
-/**
- * <code>orm.xml</code> virtual column
- */
-public class GenericOrmVirtualColumn
- extends AbstractOrmVirtualBaseColumn<OrmVirtualColumn.Owner, Column>
- implements OrmVirtualColumn
-{
- protected Integer specifiedLength;
- protected int defaultLength;
-
- protected Integer specifiedPrecision;
- protected int defaultPrecision;
-
- protected Integer specifiedScale;
- protected int defaultScale;
-
-
- public GenericOrmVirtualColumn(XmlContextNode parent, OrmVirtualColumn.Owner owner) {
- super(parent, owner);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
-
- this.setSpecifiedLength(this.buildSpecifiedLength());
- this.setDefaultLength(this.buildDefaultLength());
-
- this.setSpecifiedPrecision(this.buildSpecifiedPrecision());
- this.setDefaultPrecision(this.buildDefaultPrecision());
-
- this.setSpecifiedScale(this.buildSpecifiedScale());
- this.setDefaultScale(this.buildDefaultScale());
- }
-
-
- // ********** column **********
-
- @Override
- public Column getOverriddenColumn() {
- return this.owner.resolveOverriddenColumn();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- protected void setSpecifiedLength(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- return this.getOverriddenColumn().getSpecifiedLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int length) {
- int old = this.defaultLength;
- this.defaultLength = length;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
- }
-
- protected int buildDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- protected void setSpecifiedPrecision(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- return this.getOverriddenColumn().getSpecifiedPrecision();
- }
-
- public int getDefaultPrecision() {
- return this.defaultPrecision;
- }
-
- protected void setDefaultPrecision(int precision) {
- int old = this.defaultPrecision;
- this.defaultPrecision = precision;
- this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
- }
-
- protected int buildDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- protected void setSpecifiedScale(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- return this.getOverriddenColumn().getSpecifiedScale();
- }
-
- public int getDefaultScale() {
- return this.defaultScale;
- }
-
- protected void setDefaultScale(int scale) {
- int old = this.defaultScale;
- this.defaultScale = scale;
- this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
- }
-
- protected int buildDefaultScale() {
- return DEFAULT_SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
deleted file mode 100644
index dcf6cf5856..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
-
-/**
- * <code>orm.xml</code> virtual join column
- */
-public class GenericOrmVirtualJoinColumn
- extends AbstractOrmVirtualBaseColumn<ReadOnlyJoinColumn.Owner, JoinColumn>
- implements OrmVirtualJoinColumn
-{
- protected final JoinColumn overriddenColumn;
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmVirtualJoinColumn(XmlContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn overriddenColumn) {
- super(parent, owner);
- this.overriddenColumn = overriddenColumn;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
-
- this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- // ********** column **********
-
- @Override
- public JoinColumn getOverriddenColumn() {
- return this.overriddenColumn;
- }
-
- public boolean isDefault() {
- return this.owner.joinColumnIsDefault(this);
- }
-
-
- // ********** referenced column name **********
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- protected void setSpecifiedReferencedColumnName(String name) {
- String old = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = name;
- this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildSpecifiedReferencedColumnName() {
- return this.getOverriddenColumn().getSpecifiedReferencedColumnName();
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String name) {
- String old = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = name;
- this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultReferencedColumnName() {
- return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
- }
-
-
- // ********** misc **********
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this, this.owner);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
deleted file mode 100644
index b6d57f39c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmVirtualOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualOverrideRelationship2_0;
-
-public class GenericOrmVirtualOverrideRelationship
- extends AbstractOrmXmlContextNode
- implements OrmVirtualOverrideRelationship2_0
-{
- protected OrmVirtualRelationshipStrategy strategy;
-
- protected final OrmVirtualJoinColumnRelationshipStrategy joinColumnStrategy;
-
- // JPA 2.0
- protected final OrmVirtualJoinTableRelationshipStrategy joinTableStrategy;
-
-
- public GenericOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent) {
- super(parent);
- this.joinColumnStrategy = this.buildJoinColumnStrategy();
- this.joinTableStrategy = this.buildJoinTableStrategy();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.setStrategy(this.buildStrategy());
- this.joinColumnStrategy.update();
- this.joinTableStrategy.update();
- }
-
-
- // ********** strategy **********
-
- public OrmVirtualRelationshipStrategy getStrategy() {
- return this.strategy;
- }
-
- protected void setStrategy(OrmVirtualRelationshipStrategy strategy) {
- OrmVirtualRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- protected OrmVirtualRelationshipStrategy buildStrategy() {
- if (this.isJpa2_0Compatible()) {
- if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
- return this.joinColumnStrategy;
- }
- return this.joinTableStrategy;
- }
- return this.joinColumnStrategy;
- }
-
-
- // ********** join column strategy **********
-
- public OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return false;
- }
-
- protected OrmVirtualJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
- return new GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(this);
- }
-
-
- // ********** join table strategy **********
-
- public OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy() {
- return this.joinTableStrategy;
- }
-
- public boolean strategyIsJoinTable() {
- return this.strategy == this.joinTableStrategy;
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return this.isVirtual();
- }
-
- protected OrmVirtualJoinTableRelationshipStrategy buildJoinTableStrategy() {
- return new GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromJoinTableRelationship(this);
- newRelationship.initializeFromJoinColumnRelationship(this);
- }
-
- public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
- specifiedRelationship.initializeFromVirtualJoinColumnRelationship(this);
- specifiedRelationship.initializeFromVirtualJoinTableRelationship(this);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmVirtualAssociationOverride getParent() {
- return (OrmVirtualAssociationOverride) super.getParent();
- }
-
- public OrmVirtualAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getContainer().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = this.getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isVirtual() {
- return true;
- }
-
- public RelationshipMapping getMapping() {
- return this.getAssociationOverride().getMapping();
- }
-
- public Relationship resolveOverriddenRelationship() {
- return this.getAssociationOverride().resolveOverriddenRelationship();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getAssociationOverride().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
deleted file mode 100644
index d85905fd19..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualNamedColumn;
-
-/**
- * <code>orm.xml</code> virtual primary key join column
- */
-public class GenericOrmVirtualPrimaryKeyJoinColumn
- extends AbstractOrmVirtualNamedColumn<ReadOnlyBaseJoinColumn.Owner, JavaPrimaryKeyJoinColumn>
- implements OrmVirtualPrimaryKeyJoinColumn
-{
- protected final JavaPrimaryKeyJoinColumn overriddenColumn;
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, ReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn overriddenColumn) {
- super(parent, owner);
- this.overriddenColumn = overriddenColumn;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
-
- this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- // ********** column **********
-
- @Override
- public JavaPrimaryKeyJoinColumn getOverriddenColumn() {
- return this.overriddenColumn;
- }
-
- public boolean isDefault() {
- return this.owner.joinColumnIsDefault(this);
- }
-
-
- // ********** referenced column name **********
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- protected void setSpecifiedReferencedColumnName(String name) {
- String old = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = name;
- this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildSpecifiedReferencedColumnName() {
- return this.getOverriddenColumn().getSpecifiedReferencedColumnName();
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String name) {
- String old = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = name;
- this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultReferencedColumnName() {
- return this.buildDefaultName();
- }
-
-
- // ********** misc **********
-
- public String getTable() {
- return this.owner.getDefaultTableName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
deleted file mode 100644
index f7ee1413b1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
-
-public class GenericOrmVirtualUniqueConstraint
- extends AbstractOrmReadOnlyUniqueConstraint
- implements OrmVirtualUniqueConstraint
-{
- protected final UniqueConstraint overriddenUniqueConstraint;
-
-
- public GenericOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint) {
- super(parent);
- this.overriddenUniqueConstraint = overriddenUniqueConstraint;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.syncColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public UniqueConstraint getOverriddenUniqueConstraint() {
- return this.overriddenUniqueConstraint;
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.overriddenUniqueConstraint.getColumnNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
deleted file mode 100644
index e9d9575c61..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * JPA <code>orm.xml</code> file.
- */
-public class GenericOrmXml
- extends AbstractOrmXmlContextNode
- implements OrmXml
-{
- /**
- * If the XML resource's content type changes, the mapping file
- * ref will throw out its current mapping file.
- */
- protected final JpaXmlResource xmlResource; // never null
-
- /**
- * The resource type will only change if the XML file's version changes
- * (since, if the content type changes, we get garbage-collected).
- */
- protected JptResourceType resourceType;
-
- /**
- * Cache the <code>orm.xml</code> definition alongside the resource type.
- * (The definition is determined by the resource type.)
- */
- protected OrmXmlDefinition definition;
-
- /**
- * The root element of the <code>orm.xml</code> file.
- */
- protected EntityMappings root;
-
-
- public GenericOrmXml(MappingFileRef parent, JpaXmlResource xmlResource) {
- super(parent);
- this.checkXmlResource(xmlResource);
- this.xmlResource = xmlResource;
- this.resourceType = xmlResource.getResourceType();
- this.definition = this.buildDefinition();
-
- XmlEntityMappings xmlEntityMappings = (XmlEntityMappings) xmlResource.getRootObject();
- if (xmlEntityMappings != null) {
- this.root = this.buildRoot(xmlEntityMappings);
- }
- }
-
-
- // ********** synchronize/update **********
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#synchronizeWithResourceModel()
- */
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- XmlEntityMappings oldXmlEntityMappings = (this.root == null) ? null : this.root.getXmlEntityMappings();
- XmlEntityMappings newXmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject();
- JptResourceType newResourceType = this.xmlResource.getResourceType();
-
- // If the old and new XML entity mappings are different instances,
- // we scrap the old context entity mappings and rebuild.
- // (This can happen when the resource model changes drastically,
- // such as a CVS checkout or an edit reversion.)
- if ((oldXmlEntityMappings != newXmlEntityMappings) ||
- (newXmlEntityMappings == null) ||
- this.valuesAreDifferent(this.resourceType, newResourceType)
- ) {
- if (this.root != null) {
- this.unregisterRootStructureNode();
- this.root.dispose();
- this.setRoot(null);
- }
- }
-
- this.resourceType = newResourceType;
- this.definition = this.buildDefinition();
-
- if (newXmlEntityMappings != null) {
- if (this.root == null) {
- this.setRoot(this.buildRoot(newXmlEntityMappings));
- } else {
- // the context entity mappings already holds the XML entity mappings
- this.root.synchronizeWithResourceModel();
- }
- }
- }
-
- @Override
- public void update() {
- super.update();
- if (this.root != null) {
- this.root.update();
- // this will happen redundantly - need to hold JpaFile?
- this.registerRootStructureNode();
- }
- }
-
-
- // ********** resource type/definition **********
-
- @Override
- public JptResourceType getResourceType() {
- return this.resourceType;
- }
-
- @Override
- public OrmXmlDefinition getMappingFileDefinition() {
- return this.definition;
- }
-
- protected OrmXmlDefinition buildDefinition() {
- return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.resourceType);
- }
-
-
- // ********** root **********
-
- public EntityMappings getRoot() {
- return this.root;
- }
-
- protected void setRoot(EntityMappings root) {
- EntityMappings old = this.root;
- this.root = root;
- this.firePropertyChanged(ROOT_PROPERTY, old, root);
- }
-
- protected EntityMappings buildRoot(XmlEntityMappings xmlEntityMappings) {
- return this.getContextNodeFactory().buildEntityMappings(this, xmlEntityMappings);
- }
-
-
- // ********** misc **********
-
- protected void checkXmlResource(JpaXmlResource resource) {
- if (resource == null) {
- throw new NullPointerException();
- }
- if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
- throw new IllegalArgumentException("Content type is not 'mapping file': " + resource); //$NON-NLS-1$
- }
- }
-
- @Override
- public MappingFileRef getParent() {
- return (MappingFileRef) super.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.xmlResource.getFile();
- }
-
- protected JpaFile getJpaFile() {
- return this.getJpaFile(this.xmlResource.getFile());
- }
-
- public boolean isIn(IFolder folder) {
- IResource member = folder.findMember(this.xmlResource.getFile().getName());
- IFile file = this.xmlResource.getFile();
- return Tools.valuesAreEqual(member, file);
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- // isn't actually displayed, so needs no details page
- return null;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- if ((this.root != null) && this.root.containsOffset(textOffset)) {
- return this.root.getStructureNode(textOffset);
- }
- return this;
- }
-
- // never actually selected
- public TextRange getSelectionTextRange() {
- return TextRange.Empty.instance();
- }
-
- public void dispose() {
- if (this.root != null) {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- this.unregisterRootStructureNode();
- }
- this.root.dispose();
- }
- }
-
- // TODO hold the JpaFile?
- protected void registerRootStructureNode() {
- this.getJpaFile().addRootStructureNode(this.xmlResource, this.root);
- }
-
- protected void unregisterRootStructureNode() {
- this.getJpaFile().removeRootStructureNode(this.xmlResource, this.root);
- }
-
-
- // ********** MappingFile implementation **********
-
- public JpaXmlResource getXmlResource() {
- return this.xmlResource;
- }
-
- public OrmPersistentType getPersistentType(String name) {
- return (this.root == null) ? null : this.root.getPersistentType(name);
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- /**
- * All <code>orm.xml</code> mapping files must be able to generate a static metamodel
- * because 1.0 <code>orm.xml</code> files can be referenced from 2.0
- * <code>persistence.xml</code>
- * files.
- */
- public Iterable<OrmPersistentType> getPersistentTypes() {
- return (this.root != null) ? this.root.getPersistentTypes() : EmptyIterable.<OrmPersistentType>instance();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
- return (this.root != null) ?
- this.root.createDeleteTypeEdits(type) :
- EmptyIterable.<DeleteEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return (this.root != null) ?
- this.root.createRenameTypeEdits(originalType, newName) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return (this.root != null) ?
- this.root.createMoveTypeEdits(originalType, newPackage) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return (this.root != null) ?
- this.root.createRenamePackageEdits(originalPackage, newName) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.root != null) {
- this.root.validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- // since this is the entire file, point to the top of the file
- return TextRange.Empty.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
deleted file mode 100644
index 3a2dbdaa5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-
-public class GenericOrmXmlDefinition
- extends AbstractOrmXmlDefinition
-{
- // singleton
- private static final OrmXmlDefinition INSTANCE = new GenericOrmXmlDefinition();
-
- /**
- * Return the singleton
- */
- public static OrmXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericOrmXmlDefinition() {
- super();
- }
-
- public JptResourceType getResourceType() {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
-
- public EFactory getResourceNodeFactory() {
- return OrmFactory.eINSTANCE;
- }
-
- @Override
- protected OrmXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericOrmXmlContextNodeFactory();
- }
-
- @Override
- protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see GenericJpaPlatformProvider
- */
- protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
- OrmEntityDefinition.instance(),
- OrmEmbeddableDefinition.instance(),
- OrmMappedSuperclassDefinition.instance()
- };
-
- @Override
- protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see GenericJpaPlatformProvider
- */
- protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] {
- OrmTransientMappingDefinition.instance(),
- OrmIdMappingDefinition.instance(),
- OrmVersionMappingDefinition.instance(),
- OrmBasicMappingDefinition.instance(),
- OrmEmbeddedMappingDefinition.instance(),
- OrmEmbeddedIdMappingDefinition.instance(),
- OrmManyToManyMappingDefinition.instance(),
- OrmManyToOneMappingDefinition.instance(),
- OrmOneToManyMappingDefinition.instance(),
- OrmOneToOneMappingDefinition.instance(),
- NullOrmAttributeMappingDefinition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
deleted file mode 100644
index 9915124912..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class NullOrmConverter
- extends AbstractOrmConverter
-{
- public NullOrmConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
- public void initialize() {
- // NOP
- }
-
- public Class<? extends Converter> getType() {
- return null;
- }
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return null;
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 986418a13c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Used by
- * {@link org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOneToManyRelationship#buildJoinColumnStrategy()}
- * in a JPA 1.0 project.
- */
-public class NullOrmJoinColumnRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmJoinColumnRelationshipStrategy
-{
- public NullOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
- super(parent);
- }
-
-
- // ********** join columns **********
-
- public ListIterator<OrmJoinColumn> joinColumns() {
- return EmptyListIterator.<OrmJoinColumn>instance();
- }
-
- public int joinColumnsSize() {
- return 0;
- }
-
-
- // ********** specified join columns **********
-
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return EmptyListIterator.<OrmJoinColumn>instance();
- }
-
- public int specifiedJoinColumnsSize() {
- return 0;
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return false;
- }
-
- public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn() {
- throw new UnsupportedOperationException();
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- throw new UnsupportedOperationException();
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** default join column **********
-
- public OrmJoinColumn getDefaultJoinColumn() {
- return null;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
- public String getColumnTableNotValidDescription() {
- return null;
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmJoinColumnRelationship getParent() {
- return (OrmJoinColumnRelationship) super.getParent();
- }
-
- public OrmJoinColumnRelationship getRelationship() {
- return this.getParent();
- }
-
- public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
- // NOP
- }
-
- public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
- // NOP
- }
-
- public void addStrategy() {
- // NOP
- }
-
- public void removeStrategy() {
- // NOP
- }
-
- public boolean isTargetForeignKey() {
- return false;
- }
-
- public TypeMapping getRelationshipTarget() {
- return null;
- }
-
- public String getTableName() {
- return null;
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return true;
- }
-
- public Table resolveDbTable(String tableName) {
- return null;
- }
-
- public TypeMapping getRelationshipSource() {
- return this.getRelationshipMapping().getTypeMapping();
- }
-
- protected RelationshipMapping getRelationshipMapping() {
- return this.getRelationship().getMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
deleted file mode 100644
index 1cba7cb9d6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
-
-/**
- * This will be used in cases where Java-supported attribute mapping types
- * are not supported by the particular version of the <code>orm.xml</code>
- * file. For example, EclipseLink supports variable 1:1 mappings, but the
- * generic <code>orm.xml</code> file does not.
- */
-public class UnsupportedOrmAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
- public UnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- //this ends up returning the java attribute mapping key
- return this.xmlAttributeMapping.getMappingKey();
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}

Back to the top