Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-11-30 21:26:16 +0000
committerkmoore2009-11-30 21:26:16 +0000
commit9ac6c0c203d67f0379580a0e1f9ea47b136a9df1 (patch)
tree08e3e6159f0d480582d3c4bc390c789796a9392f /jpa/plugins/org.eclipse.jpt.core/src
parenteb863b66a85f27cd6086df30daf670e8e9ef905c (diff)
downloadwebtools.dali-9ac6c0c203d67f0379580a0e1f9ea47b136a9df1.tar.gz
webtools.dali-9ac6c0c203d67f0379580a0e1f9ea47b136a9df1.tar.xz
webtools.dali-9ac6c0c203d67f0379580a0e1f9ea47b136a9df1.zip
258515 - OrderColumn support in both orm and java
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/MultiRelationshipMapping.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Orderable.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaOrderable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmMultiRelationshipMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmOrderable.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OrderColumn2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/Orderable2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderColumn2_0.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderable2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderColumn2_0.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderable2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java3
38 files changed, 1540 insertions, 386 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
index 465d64738e..6105576a9b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
@@ -52,6 +52,7 @@ import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
import org.eclipse.jpt.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.core.context.java.JavaOrderable;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
@@ -219,6 +220,8 @@ public interface JpaFactory
JavaConverter buildJavaNullConverter(JavaAttributeMapping parent);
+ JavaOrderable buildJavaOrderable(JavaAttributeMapping parent);
+
AssociationOverrideAnnotation buildJavaVirtualAssociationOverrideAnnotation(JavaResourcePersistentMember jrpm, String name, JoiningStrategy joiningStrategy);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/MultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/MultiRelationshipMapping.java
index d30e9e22ab..8951694012 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/MultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/MultiRelationshipMapping.java
@@ -25,24 +25,7 @@ public interface MultiRelationshipMapping
{
FetchType DEFAULT_FETCH_TYPE = FetchType.LAZY;
- String getOrderBy();
-
- String getSpecifiedOrderBy();
- void setSpecifiedOrderBy(String orderBy);
- String SPECIFIED_ORDER_BY_PROPERTY = "specifiedOrderBy"; //$NON-NLS-1$
-
- boolean isNoOrdering();
- void setNoOrdering(boolean noOrdering);
- String NO_ORDERING_PROPERTY = "noOrdering"; //$NON-NLS-1$
-
- boolean isPkOrdering();
- void setPkOrdering(boolean pkOrdering);
- String PK_ORDERING_PROPERTY = "pkOrdering"; //$NON-NLS-1$
-
- boolean isCustomOrdering();
- void setCustomOrdering(boolean customOrdering);
- String CUSTOM_ORDERING_PROPERTY = "customOrdering"; //$NON-NLS-1$
-
+ Orderable getOrderable();
String getMapKey();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Orderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Orderable.java
new file mode 100644
index 0000000000..bcda6e9969
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Orderable.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.core.context;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mappings support ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface Orderable
+ extends JpaContextNode
+{
+
+ String getSpecifiedOrderBy();
+ void setSpecifiedOrderBy(String orderBy);
+ String SPECIFIED_ORDER_BY_PROPERTY = "specifiedOrderBy"; //$NON-NLS-1$
+
+ boolean isNoOrdering();
+ void setNoOrdering(boolean noOrdering);
+ String NO_ORDERING_PROPERTY = "noOrdering"; //$NON-NLS-1$
+
+ boolean isPkOrdering();
+ void setPkOrdering(boolean pkOrdering);
+ String PK_ORDERING_PROPERTY = "pkOrdering"; //$NON-NLS-1$
+
+ boolean isCustomOrdering();
+ void setCustomOrdering(boolean customOrdering);
+ String CUSTOM_ORDERING_PROPERTY = "customOrdering"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaOrderable.java
new file mode 100644
index 0000000000..da50bc56ae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaOrderable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.context.java;
+
+import org.eclipse.jpt.core.context.Orderable;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaOrderable
+ extends Orderable, JavaJpaContextNode
+{
+
+ void initialize();
+
+ void update();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmMultiRelationshipMapping.java
index 336feedc63..9b0edb56a0 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmMultiRelationshipMapping.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.context.orm;
import org.eclipse.jpt.core.context.MultiRelationshipMapping;
+import org.eclipse.jpt.core.resource.orm.AbstractXmlMultiRelationshipMapping;
/**
* ORM multi-valued (1:m, m:m) relationship mapping.
@@ -23,5 +24,8 @@ import org.eclipse.jpt.core.context.MultiRelationshipMapping;
public interface OrmMultiRelationshipMapping
extends OrmRelationshipMapping, MultiRelationshipMapping
{
+ AbstractXmlMultiRelationshipMapping getResourceAttributeMapping();
+
+
// nothing yet
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmOrderable.java
new file mode 100644
index 0000000000..9cdcd8a74f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmOrderable.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.context.orm;
+
+import org.eclipse.jpt.core.context.Orderable;
+import org.eclipse.jpt.core.context.XmlContextNode;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmOrderable extends Orderable, XmlContextNode
+{
+ void update();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
index c7b25a4ff9..9e853469c7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmXmlContextNodeFactory.java
@@ -164,6 +164,7 @@ public interface OrmXmlContextNodeFactory extends XmlContextNodeFactory
OrmConverter buildOrmNullConverter(OrmAttributeMapping parent);
+ OrmOrderable buildOrmOrderable(OrmAttributeMapping parent);
// ********** ORM Virtual Resource Model **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
index 10dce416bf..452979a45d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
@@ -51,10 +51,12 @@ import org.eclipse.jpt.core.context.java.JavaLobConverter;
import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
import org.eclipse.jpt.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.core.context.java.JavaOrderable;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
@@ -105,6 +107,7 @@ import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNullAttributeM
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNullConverter;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToManyMapping;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOrderable;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentAttribute;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentType;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn;
@@ -122,6 +125,7 @@ import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaAssociationOverri
import org.eclipse.jpt.core.internal.jpa1.context.java.VirtualAssociationOverride1_0Annotation;
import org.eclipse.jpt.core.internal.jpa2.NullMetamodelSynchronizer;
import org.eclipse.jpt.core.internal.jpa2.NullPersistentTypeMetamodelSynchronizer;
+import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaCacheable2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaDerivedId2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaMapsId2_0;
@@ -136,6 +140,8 @@ import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
@@ -370,6 +376,10 @@ public abstract class AbstractJpaFactory
return new GenericJavaNullConverter(parent);
}
+ public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
+ return new GenericJavaOrderable(parent);
+ }
+
public JavaDerivedId2_0 buildJavaDerivedId(JavaSingleRelationshipMapping2_0 parent) {
return new NullJavaDerivedId2_0(parent);
}
@@ -389,4 +399,9 @@ public abstract class AbstractJpaFactory
public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) {
return new NullJavaOrphanRemoval2_0(parent);
}
+
+ public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) {
+ return new GenericJavaOrderColumn2_0(parent, owner);
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
index b32ba33c35..438aa8caa9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
@@ -13,14 +13,17 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.FetchType;
+import org.eclipse.jpt.core.context.Orderable;
import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
+import org.eclipse.jpt.core.context.java.JavaOrderable;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.ArrayTools;
@@ -34,6 +37,8 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
extends AbstractJavaRelationshipMapping<T>
implements JavaMultiRelationshipMapping
{
+ protected final JavaOrderable orderable;
+
protected String specifiedOrderBy = null;
protected boolean noOrdering = false;
protected boolean pkOrdering = false;
@@ -47,19 +52,20 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) {
super(parent);
+ this.orderable = getJpaFactory().buildJavaOrderable(this);
}
@Override
protected void initialize() {
super.initialize();
- this.initializeOrderBy();
+ this.orderable.initialize();
this.initializeMapKey();
}
@Override
protected void update() {
super.update();
- this.updateOrderBy();
+ this.orderable.update();
this.updateMapKey();
}
@@ -67,12 +73,19 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
@Override
protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
+ String[] annotationNames = ArrayTools.addAll(
super.buildSupportingAnnotationNames(),
JPA.JOIN_TABLE,
JPA.MAP_KEY,
- JPA.ORDER_BY
- );
+ JPA.ORDER_BY);
+
+ if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
+ annotationNames = ArrayTools.addAll(
+ annotationNames,
+ JPA2_0.ORDER_COLUMN);
+ }
+
+ return annotationNames;
}
// ********** AbstractJavaRelationshipMapping implementation **********
@@ -83,173 +96,10 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
}
- // ********** order by **********
-
- public String getOrderBy() {
- if (this.noOrdering) {
- return null;
- }
- if (this.pkOrdering) {
- return this.getTargetEntityIdAttributeName();
- }
- if (this.customOrdering) {
- return this.specifiedOrderBy;
- }
- throw new IllegalStateException("unknown ordering"); //$NON-NLS-1$
- }
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (orderBy == null) {
- if (orderByAnnotation != null) {
- this.removeOrderByAnnotation();
- }
- } else {
- if (orderByAnnotation == null) {
- orderByAnnotation = this.addOrderByAnnotation();
- }
- orderByAnnotation.setValue(orderBy);
- }
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void initializeOrderBy() {
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (orderByAnnotation == null) {
- this.noOrdering = true;
- } else {
- this.specifiedOrderBy = orderByAnnotation.getValue();
- if (this.specifiedOrderBy == null) {
- this.pkOrdering = true;
- } else {
- this.customOrdering = true;
- }
- }
- }
-
- protected void updateOrderBy() {
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (orderByAnnotation == null) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- } else {
- String ob = orderByAnnotation.getValue();
- this.setSpecifiedOrderBy_(ob);
- this.setNoOrdering_(false);
- this.setPkOrdering_(ob == null);
- this.setCustomOrdering_(ob != null);
- }
- }
-
- protected OrderByAnnotation getOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected OrderByAnnotation addOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeOrderByAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
-
- // ********** no ordering **********
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- if (noOrdering) {
- if (this.getOrderByAnnotation() != null) {
- this.removeOrderByAnnotation();
- }
- } else {
- // the 'noOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setNoOrdering_(boolean)
- }
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
-
- // ********** pk ordering **********
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (pkOrdering) {
- if (orderByAnnotation == null) {
- this.addOrderByAnnotation();
- } else {
- orderByAnnotation.setValue(null);
- }
- } else {
- // the 'pkOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setPkOrdering_(boolean)
- }
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
-
- // ********** custom ordering **********
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- public void setCustomOrdering(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- if (customOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- } else {
- // the 'customOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setCustomOrdering_(boolean)
- }
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
+ // ********** ordering **********
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ public Orderable getOrderable() {
+ return this.orderable;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
index 62fba6ee5b..de4f1b730a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
@@ -157,7 +157,9 @@ public abstract class AbstractJavaNamedColumn<T extends NamedColumnAnnotation> e
/**
* Return the name of the column's table.
*/
- protected abstract String getTableName();
+ protected String getTableName() {
+ return this.getOwner().getTypeMapping().getPrimaryTableName();
+ }
public boolean isResolved() {
return this.getDbColumn() != null;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
index f3759a1479..6a6e880986 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
@@ -70,9 +70,7 @@ public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends
if (this.valuesAreDifferent(oldSpecifiedTable, newSpecifiedTable)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setTable(newSpecifiedTable);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedTable != null) {
addResourceColumn();
@@ -152,9 +150,7 @@ public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends
if (this.valuesAreDifferent(oldSpecifiedNullable, newSpecifiedNullable)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setNullable(newSpecifiedNullable);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedNullable != null) {
addResourceColumn();
@@ -188,9 +184,7 @@ public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends
if (this.valuesAreDifferent(oldSpecifiedInsertable, newSpecifiedInsertable)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setInsertable(newSpecifiedInsertable);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedInsertable != null) {
addResourceColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index e97434f4b8..75db97ac5c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -14,7 +14,9 @@ import java.util.Iterator;
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.MultiRelationshipMapping;
+import org.eclipse.jpt.core.context.Orderable;
import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
+import org.eclipse.jpt.core.context.orm.OrmOrderable;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.internal.context.MappingTools;
import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
@@ -29,27 +31,23 @@ public abstract class AbstractOrmMultiRelationshipMapping<T extends AbstractXmlM
extends AbstractOrmRelationshipMapping<T>
implements OrmMultiRelationshipMapping
{
- protected String specifiedOrderBy;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
+ protected final OrmOrderable orderable;
+
protected String specifiedMapKey;
protected boolean noMapKey = false;
protected boolean pkMapKey = false;
protected boolean customMapKey = false;
-
protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, T resourceMapping) {
super(parent, resourceMapping);
- this.initializeOrderBy();
+ this.orderable = getXmlContextNodeFactory().buildOrmOrderable(this);
this.initializeMapKey();
}
@Override
public void update() {
super.update();
- this.updateOrderBy();
+ this.orderable.update();
this.updateMapKey();
}
@@ -64,133 +62,9 @@ public abstract class AbstractOrmMultiRelationshipMapping<T extends AbstractXmlM
// **************** order by ***********************************************
-
- public String getOrderBy() {
- if (this.noOrdering) {
- return null;
- }
- if (this.pkOrdering) {
- return this.getTargetEntityIdAttributeName();
- }
- if (this.customOrdering) {
- return this.specifiedOrderBy;
- }
- throw new IllegalStateException("unknown ordering"); //$NON-NLS-1$
- }
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.resourceAttributeMapping.setOrderBy(orderBy);
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
- protected void initializeOrderBy() {
- this.specifiedOrderBy = this.getXmlOrderBy();
- if (this.specifiedOrderBy == null) {
- this.noOrdering = true;
- } else if (this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
- this.pkOrdering = true;
- } else {
- this.customOrdering = true;
- }
- }
-
- protected void updateOrderBy() {
- this.setSpecifiedOrderBy_(this.getXmlOrderBy());
- if (this.specifiedOrderBy == null) {
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- } else if (this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
- this.setNoOrdering_(false);
- this.setPkOrdering_(true);
- this.setCustomOrdering_(false);
- } else {
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(true);
- }
- }
-
- protected String getXmlOrderBy() {
- return this.resourceAttributeMapping.getOrderBy();
- }
-
-
- // **************** no ordering ***********************************************
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- if (noOrdering) {
- this.resourceAttributeMapping.setOrderBy(null);
- }
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
-
- // **************** pk ordering ***********************************************
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- if (pkOrdering) {
- this.resourceAttributeMapping.setOrderBy(""); //$NON-NLS-1$
- }
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
-
- // **************** custom ordering ***********************************************
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- public void setCustomOrdering(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- if (customOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- }
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ public Orderable getOrderable() {
+ return this.orderable;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
index e837621c99..3adc4a367c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
@@ -50,6 +50,12 @@ public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> e
protected abstract void addResourceColumn();
+ protected void removeResourceColumnIfFeaturesUnset() {
+ if (this.getResourceColumn().isUnset()) {
+ removeResourceColumn();
+ }
+ }
+
public Owner getOwner() {
return this.owner;
}
@@ -67,10 +73,8 @@ public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> e
this.specifiedName = newSpecifiedName;
if (this.attributeValueHasChanged(oldSpecifiedName, newSpecifiedName)) {
if (this.getResourceColumn() != null) {
- this.getResourceColumn().setName(newSpecifiedName);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.getResourceColumn().setName(newSpecifiedName);
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedName != null) {
addResourceColumn();
@@ -105,10 +109,8 @@ public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> e
this.columnDefinition = newColumnDefinition;
if (this.attributeValueHasChanged(oldColumnDefinition, newColumnDefinition)) {
if (this.getResourceColumn() != null) {
- this.getResourceColumn().setColumnDefinition(newColumnDefinition);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.getResourceColumn().setColumnDefinition(newColumnDefinition);
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newColumnDefinition != null) {
addResourceColumn();
@@ -133,7 +135,9 @@ public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> e
return getOwner().getDbTable(this.getOwningTableName());
}
- protected abstract String getOwningTableName();
+ protected String getOwningTableName() {
+ return this.getOwner().getTypeMapping().getPrimaryTableName();
+ }
public boolean isResolved() {
return getDbColumn() != null;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
index 69a960cb7c..10e6b6046e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
@@ -51,10 +51,12 @@ import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
+import org.eclipse.jpt.core.context.orm.OrmOrderable;
import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
@@ -104,6 +106,7 @@ import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNullAttributeMap
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNullConverter;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
+import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOrderable;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentType;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn;
@@ -121,6 +124,7 @@ import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXml;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericPersistenceUnitDefaults;
import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericPersistenceUnitMetadata;
import org.eclipse.jpt.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
+import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmOrderColumn2_0;
import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmDerivedId2_0;
import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmMapsId2_0;
@@ -132,6 +136,8 @@ import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
@@ -373,6 +379,14 @@ public abstract class AbstractOrmXmlContextNodeFactory implements OrmXml2_0Conte
return new GenericOrmNullConverter(parent);
}
+ public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
+ return new GenericOrmOrderable(parent);
+ }
+
+ public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmNamedColumn.Owner owner) {
+ return new GenericOrmOrderColumn2_0(parent, owner);
+ }
+
public OrmDerivedId2_0 buildOrmDerivedId(
OrmSingleRelationshipMapping2_0 parent, XmlDerivedId_2_0 resource) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java
index 2b7791f4a6..1d5ebe08a4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java
@@ -12,12 +12,14 @@ package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.resource.orm.CascadeType;
import org.eclipse.jpt.core.resource.orm.FetchType;
import org.eclipse.jpt.core.resource.orm.MapKey;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
import org.eclipse.jpt.core.utility.TextRange;
/**
@@ -158,7 +160,7 @@ public class VirtualXmlManyToMany
if (this.isOrmMetadataComplete()) {
return null;
}
- return this.javaAttributeMapping.getSpecifiedOrderBy();
+ return this.javaAttributeMapping.getOrderable().getSpecifiedOrderBy();
}
@Override
@@ -167,6 +169,16 @@ public class VirtualXmlManyToMany
}
@Override
+ public XmlOrderColumn getOrderColumn() {
+ if (((Orderable2_0) this.javaAttributeMapping.getOrderable()).isOrderColumnOrdering()) {
+ return new VirtualXmlOrderColumn(
+ ((Orderable2_0) this.javaAttributeMapping.getOrderable()).getOrderColumn(),
+ this.ormTypeMapping.isMetadataComplete());
+ }
+ return null;
+ }
+
+ @Override
public TextRange getMappedByTextRange() {
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java
index f9bd7a321f..2a97d19ae5 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java
@@ -12,12 +12,14 @@ package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
import org.eclipse.jpt.core.resource.orm.CascadeType;
import org.eclipse.jpt.core.resource.orm.FetchType;
import org.eclipse.jpt.core.resource.orm.MapKey;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
import org.eclipse.jpt.core.utility.TextRange;
/**
@@ -171,7 +173,7 @@ public class VirtualXmlOneToMany
if (this.isOrmMetadataComplete()) {
return null;
}
- return this.javaAttributeMapping.getSpecifiedOrderBy();
+ return this.javaAttributeMapping.getOrderable().getSpecifiedOrderBy();
}
@Override
@@ -180,6 +182,16 @@ public class VirtualXmlOneToMany
}
@Override
+ public XmlOrderColumn getOrderColumn() {
+ if (((Orderable2_0) this.javaAttributeMapping.getOrderable()).isOrderColumnOrdering()) {
+ return new VirtualXmlOrderColumn(
+ ((Orderable2_0) this.javaAttributeMapping.getOrderable()).getOrderColumn(),
+ this.ormTypeMapping.isMetadataComplete());
+ }
+ return null;
+ }
+
+ @Override
public TextRange getMappedByTextRange() {
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java
new file mode 100644
index 0000000000..28081bc7d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.internal.context.orm;
+
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class VirtualXmlOrderColumn extends XmlOrderColumn
+{
+ protected OrderColumn2_0 javaOrderColumn;
+
+ protected boolean metadataComplete;
+
+ public VirtualXmlOrderColumn(OrderColumn2_0 javaOrderColumn, boolean metadataComplete) {
+ super();
+ this.javaOrderColumn = javaOrderColumn;
+ this.metadataComplete = metadataComplete;
+ }
+
+ @Override
+ public String getColumnDefinition() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaOrderColumn.getColumnDefinition();
+ }
+
+ @Override
+ public void setColumnDefinition(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ @Override
+ public Boolean getInsertable() {
+ if (this.metadataComplete) {
+ return Boolean.valueOf(this.javaOrderColumn.isDefaultInsertable());
+ }
+ return Boolean.valueOf(this.javaOrderColumn.isInsertable());
+ }
+
+ @Override
+ public void setInsertable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ @Override
+ public String getName() {
+ if (this.metadataComplete) {
+ return this.javaOrderColumn.getDefaultName();
+ }
+ return this.javaOrderColumn.getName();
+ }
+
+ @Override
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+
+ @Override
+ public Boolean getNullable() {
+ if (this.metadataComplete) {
+ return Boolean.valueOf(this.javaOrderColumn.isDefaultNullable());
+ }
+ return Boolean.valueOf(this.javaOrderColumn.isNullable());
+ }
+
+ @Override
+ public void setNullable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ @Override
+ public Boolean getUpdatable() {
+ if (this.metadataComplete) {
+ return Boolean.valueOf(this.javaOrderColumn.isDefaultUpdatable());
+ }
+ return Boolean.valueOf(this.javaOrderColumn.isUpdatable());
+ }
+
+ @Override
+ public void setUpdatable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
+ }
+
+ @Override
+ public TextRange getNameTextRange() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
index b82342c7ef..389e9cd197 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
@@ -53,10 +53,6 @@ public class GenericJavaDiscriminatorColumn extends AbstractJavaNamedColumn<Disc
return (JavaDiscriminatorColumn.Owner) super.getOwner();
}
- protected JavaEntity getJavaEntity() {
- return (JavaEntity) super.getParent();
- }
-
public boolean isResourceSpecified() {
return getResourceColumn().isSpecified();
}
@@ -134,11 +130,6 @@ public class GenericJavaDiscriminatorColumn extends AbstractJavaNamedColumn<Disc
this.specifiedLength = newSpecifiedLength;
firePropertyChanged(DiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
}
-
- @Override
- protected String getTableName() {
- return getJavaEntity().getPrimaryTableName();
- }
public TextRange getValidationTextRange(CompilationUnit astRoot) {
TextRange textRange = getResourceColumn().getTextRange(astRoot);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
new file mode 100644
index 0000000000..d36965ff79
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.db.Table;
+import org.eclipse.jpt.utility.Filter;
+
+
+public class GenericJavaOrderable
+ extends AbstractJavaJpaContextNode
+ implements JavaOrderable2_0
+{
+ protected String specifiedOrderBy = null;
+ protected boolean noOrdering = false;
+ protected boolean pkOrdering = false;
+ protected boolean customOrdering = false;
+
+ protected boolean orderColumnOrdering = false;
+ protected final JavaOrderColumn2_0 orderColumn;
+
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+
+ public GenericJavaOrderable(JavaAttributeMapping parent) {
+ super(parent);
+ this.orderColumn = ((JpaFactory2_0) getJpaFactory()).buildJavaOrderColumn(this, this);
+ }
+
+ public void initialize() {
+ this.initializeOrdering();
+ }
+
+ public void update() {
+ this.updateOrdering();
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ protected JavaPersistentAttribute getPersistentAttribute() {
+ return getParent().getPersistentAttribute();
+ }
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getPersistentAttribute().getResourcePersistentAttribute();
+ }
+
+
+ // ********** JavaBaseColumn.Owner implementation **********
+
+ public Table getDbTable(String tableName) {
+ return this.getTypeMapping().getDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
+ }
+
+ public TypeMapping getTypeMapping() {
+ return getPersistentAttribute().getTypeMapping();
+ }
+
+ // ********** order by **********
+
+ public String getSpecifiedOrderBy() {
+ return this.specifiedOrderBy;
+ }
+
+ public void setSpecifiedOrderBy(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ if (orderBy == null) {
+ if (orderByAnnotation != null) {
+ this.removeOrderByAnnotation();
+ }
+ } else {
+ if (orderByAnnotation == null) {
+ orderByAnnotation = this.addOrderByAnnotation();
+ }
+ orderByAnnotation.setValue(orderBy);
+ }
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected void setSpecifiedOrderBy_(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected void initializeOrdering() {
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
+ if (orderByAnnotation == null && orderColumnAnnotation == null) {
+ this.noOrdering = true;
+ } else if (orderByAnnotation != null){
+ this.specifiedOrderBy = orderByAnnotation.getValue();
+ if (this.specifiedOrderBy == null) {
+ this.pkOrdering = true;
+ } else {
+ this.customOrdering = true;
+ }
+ } else {
+ this.orderColumnOrdering = true;
+ this.orderColumn.initialize(orderColumnAnnotation);
+ }
+ }
+
+ protected void updateOrdering() {
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
+ if (orderByAnnotation == null && orderColumnAnnotation == null) {
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(true);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+ } else if (orderByAnnotation != null) {
+ String ob = orderByAnnotation.getValue();
+ this.setSpecifiedOrderBy_(ob);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(ob == null);
+ this.setCustomOrdering_(ob != null);
+ this.setOrderColumnOrdering_(false);
+ } else {
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(true);
+ this.orderColumn.update(orderColumnAnnotation);
+ }
+ }
+
+ protected OrderByAnnotation getOrderByAnnotation() {
+ return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+ protected OrderByAnnotation addOrderByAnnotation() {
+ return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeOrderByAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** no ordering **********
+
+ public boolean isNoOrdering() {
+ return this.noOrdering;
+ }
+
+ public void setNoOrdering(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ if (noOrdering) {
+ if (this.getOrderByAnnotation() != null) {
+ this.removeOrderByAnnotation();
+ }
+ if (this.getOrderColumnAnnotation() != null) {
+ this.removeOrderColumnAnnotation();
+ }
+ } else {
+ // the 'noOrdering' flag is cleared as a
+ // side-effect of setting the other flags,
+ // via a call to #setNoOrdering_(boolean)
+ }
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+ protected void setNoOrdering_(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+
+ // ********** pk ordering **********
+
+ public boolean isPkOrdering() {
+ return this.pkOrdering;
+ }
+
+ public void setPkOrdering(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ if (pkOrdering) {
+ if (orderByAnnotation == null) {
+ this.addOrderByAnnotation();
+ } else {
+ orderByAnnotation.setValue(null);
+ }
+ } else {
+ // the 'pkOrdering' flag is cleared as a
+ // side-effect of setting the other flags,
+ // via a call to #setPkOrdering_(boolean)
+ }
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+ protected void setPkOrdering_(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+
+ // ********** custom ordering **********
+
+ public boolean isCustomOrdering() {
+ return this.customOrdering;
+ }
+
+ public void setCustomOrdering(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ if (customOrdering) {
+ this.setSpecifiedOrderBy(""); //$NON-NLS-1$
+ } else {
+ // the 'customOrdering' flag is cleared as a
+ // side-effect of setting the other flags,
+ // via a call to #setCustomOrdering_(boolean)
+ }
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ protected void setCustomOrdering_(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ // ********** order column 2.0 **********
+
+ public boolean isOrderColumnOrdering() {
+ return this.orderColumnOrdering;
+ }
+
+ public void setOrderColumnOrdering(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
+ if (orderColumnOrdering) {
+ if (orderColumnAnnotation == null) {
+ this.addOrderColumnAnnotation();
+ }
+ this.removeOrderByAnnotation();
+ } else {
+ removeOrderColumnAnnotation();
+ }
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ public JavaOrderColumn2_0 getOrderColumn() {
+ return this.orderColumn;
+ }
+
+ protected OrderColumn2_0Annotation getOrderColumnAnnotation() {
+ return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected OrderColumn2_0Annotation addOrderColumnAnnotation() {
+ return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeOrderColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getOrderColumn().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getOrderByAnnotationTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+
+ protected TextRange getOrderByAnnotationTextRange(CompilationUnit astRoot) {
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ return (orderByAnnotation == null) ? null : orderByAnnotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
index 23b3ada09b..bdc14fcb28 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
@@ -93,11 +93,6 @@ public class GenericJavaPrimaryKeyJoinColumn extends AbstractJavaNamedColumn<Pri
return getOwner().isVirtual(this);
}
- @Override
- protected String getTableName() {
- return this.getOwner().getTypeMapping().getPrimaryTableName();
- }
-
public Column getReferencedDbColumn() {
Table table = this.getReferencedColumnDbTable();
return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
index b3fbae1658..ef90cfc1df 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
@@ -57,9 +57,7 @@ public class GenericOrmColumn extends AbstractOrmBaseColumn<XmlColumn> implement
if (this.valuesAreDifferent(oldSpecifiedLength, newSpecifiedLength)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setLength(newSpecifiedLength);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedLength != null) {
addResourceColumn();
@@ -93,9 +91,7 @@ public class GenericOrmColumn extends AbstractOrmBaseColumn<XmlColumn> implement
if (this.valuesAreDifferent(oldSpecifiedPrecision, newSpecifiedPrecision)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setPrecision(newSpecifiedPrecision);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedPrecision != null) {
addResourceColumn();
@@ -129,9 +125,7 @@ public class GenericOrmColumn extends AbstractOrmBaseColumn<XmlColumn> implement
if (this.valuesAreDifferent(oldSpecifiedScale, newSpecifiedScale)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setScale(newSpecifiedScale);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedScale != null) {
addResourceColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
index f646db22c1..ab4649463a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
@@ -71,9 +71,7 @@ public class GenericOrmDiscriminatorColumn extends AbstractOrmNamedColumn<XmlDis
if (oldDiscriminatorType != newSpecifiedDiscriminatorType) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setDiscriminatorType(DiscriminatorType.toOrmResourceModel(newSpecifiedDiscriminatorType));
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedDiscriminatorType != null) {
addResourceColumn();
@@ -113,9 +111,7 @@ public class GenericOrmDiscriminatorColumn extends AbstractOrmNamedColumn<XmlDis
if (this.valuesAreDifferent(oldSpecifiedLength, newSpecifiedLength)) {
if (this.getResourceColumn() != null) {
this.getResourceColumn().setLength(newSpecifiedLength);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
+ this.removeResourceColumnIfFeaturesUnset();
}
else if (newSpecifiedLength != null) {
addResourceColumn();
@@ -130,12 +126,6 @@ public class GenericOrmDiscriminatorColumn extends AbstractOrmNamedColumn<XmlDis
this.specifiedLength = newSpecifiedLength;
firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
}
-
- @Override
- protected String getOwningTableName() {
- return this.getOwner().getTypeMapping().getPrimaryTableName();
- }
-
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
new file mode 100644
index 0000000000..0a8801b6d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 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.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
+import org.eclipse.jpt.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
+import org.eclipse.jpt.core.resource.orm.XmlOrderable;
+import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrderable_2_0;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.db.Table;
+
+/**
+ * ORM multi-relationship (m:m, 1:m) mapping
+ */
+public class GenericOrmOrderable
+ extends AbstractOrmXmlContextNode
+ implements OrmOrderable2_0
+{
+ protected String specifiedOrderBy;
+ protected boolean noOrdering = false;
+ protected boolean pkOrdering = false;
+ protected boolean customOrdering = false;
+
+ protected boolean orderColumnOrdering = false;
+ protected final OrmOrderColumn2_0 orderColumn;
+
+
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+
+ public GenericOrmOrderable(OrmAttributeMapping parent) {
+ super(parent);
+ this.orderColumn = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmOrderColumn(this, this);
+ this.initializeOrdering();
+ }
+
+ public void update() {
+ this.updateOrdering();
+ }
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return getParent().getPersistentAttribute();
+ }
+
+ protected XmlOrderable getResourceOrderable() {
+ return (XmlOrderable) getParent().getResourceAttributeMapping();
+ }
+
+ // **************** order by ***********************************************
+
+ public String getSpecifiedOrderBy() {
+ return this.specifiedOrderBy;
+ }
+
+ public void setSpecifiedOrderBy(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ this.getResourceOrderable().setOrderBy(orderBy);
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected void setSpecifiedOrderBy_(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected void initializeOrdering() {
+ this.specifiedOrderBy = this.getXmlOrderBy();
+ XmlOrderColumn resourceOrderColumn = getXmlOrderColumn();
+ if (this.specifiedOrderBy == null && resourceOrderColumn == null) {
+ this.noOrdering = true;
+ } else if (this.specifiedOrderBy != null && this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
+ this.pkOrdering = true;
+ } else if (resourceOrderColumn == null) {
+ this.customOrdering = true;
+ } else {
+ this.orderColumnOrdering = true;
+ }
+ }
+
+ protected void updateOrdering() {
+ this.setSpecifiedOrderBy_(this.getXmlOrderBy());
+ XmlOrderColumn resourceOrderColumn = getXmlOrderColumn();
+ if (this.specifiedOrderBy == null && resourceOrderColumn == null) {
+ this.setNoOrdering_(true);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+ } else if (this.specifiedOrderBy != null && this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(true);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+ } else if (resourceOrderColumn == null){
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(true);
+ this.setOrderColumnOrdering_(false);
+ } else {
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(true);
+ }
+ this.orderColumn.update(this.getResourceOrderable());
+ }
+
+ protected String getXmlOrderBy() {
+ return this.getResourceOrderable().getOrderBy();
+ }
+
+ protected XmlOrderColumn getXmlOrderColumn() {
+ return ((XmlOrderable_2_0) this.getResourceOrderable()).getOrderColumn();
+ }
+
+ // **************** no ordering ***********************************************
+
+ public boolean isNoOrdering() {
+ return this.noOrdering;
+ }
+
+ public void setNoOrdering(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ if (noOrdering) {
+ this.getResourceOrderable().setOrderBy(null);
+ this.removeXmlOrderColumn();
+ }
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+ protected void setNoOrdering_(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+
+ // **************** pk ordering ***********************************************
+
+ public boolean isPkOrdering() {
+ return this.pkOrdering;
+ }
+
+ public void setPkOrdering(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ if (pkOrdering) {
+ this.getResourceOrderable().setOrderBy(""); //$NON-NLS-1$
+ this.removeXmlOrderColumn();
+ }
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+ protected void setPkOrdering_(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+
+ // **************** custom ordering ***********************************************
+
+ public boolean isCustomOrdering() {
+ return this.customOrdering;
+ }
+
+ public void setCustomOrdering(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ if (customOrdering) {
+ this.setSpecifiedOrderBy(""); //$NON-NLS-1$
+ this.removeXmlOrderColumn();
+ }
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ protected void setCustomOrdering_(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ // **************** order column ordering ***********************************************
+
+ public boolean isOrderColumnOrdering() {
+ return this.orderColumnOrdering;
+ }
+
+ public void setOrderColumnOrdering(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ if (orderColumnOrdering) {
+ this.getResourceOrderable().setOrderBy(null);
+ addXmlOrderColumn();
+ }
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ public OrmOrderColumn2_0 getOrderColumn() {
+ return this.orderColumn;
+ }
+
+ protected void addXmlOrderColumn() {
+ ((XmlOrderable_2_0) getResourceOrderable()).setOrderColumn(OrmFactory.eINSTANCE.createXmlOrderColumn());
+ }
+
+ protected void removeXmlOrderColumn() {
+ ((XmlOrderable_2_0) getResourceOrderable()).setOrderColumn(null);
+ }
+
+
+ // ********** OrderColumn OrmBaseColumn.Owner implementation **********
+
+ public Table getDbTable(String tableName) {
+ return this.getTypeMapping().getDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
+ }
+
+ public TypeMapping getTypeMapping() {
+ return getPersistentAttribute().getTypeMapping();
+ }
+
+
+ public TextRange getValidationTextRange() {
+ return getResourceOrderable().getValidationTextRange();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
index b469580539..191a210112 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
@@ -100,11 +100,6 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
return getOwner().getReferencedColumnDbTable();
}
- @Override
- protected String getOwningTableName() {
- return this.getOwner().getTypeMapping().getPrimaryTableName();
- }
-
public boolean isReferencedColumnResolved() {
return getReferencedDbColumn() != null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
new file mode 100644
index 0000000000..0f8a5e5e34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+
+
+public class GenericJavaOrderColumn2_0
+ extends AbstractJavaNamedColumn<OrderColumn2_0Annotation>
+ implements JavaOrderColumn2_0
+{
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+ protected JavaResourcePersistentMember persistenceResource;
+
+
+ public GenericJavaOrderColumn2_0(JavaJpaContextNode parent, JavaNamedColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public void initialize(OrderColumn2_0Annotation column) {
+ super.initialize(column);
+ this.specifiedNullable = this.getResourceNullable(column);
+ this.specifiedInsertable = this.getResourceInsertable(column);
+ this.specifiedUpdatable = this.getResourceUpdatable(column);
+ }
+
+ public boolean isNullable() {
+ return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
+ }
+
+ public boolean isDefaultNullable() {
+ return BaseColumn.DEFAULT_NULLABLE;
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ this.getResourceColumn().setNullable(newSpecifiedNullable);
+ firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ public boolean isInsertable() {
+ return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
+ }
+
+ public boolean isDefaultInsertable() {
+ return BaseColumn.DEFAULT_INSERTABLE;
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ this.getResourceColumn().setInsertable(newSpecifiedInsertable);
+ firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ public boolean isUpdatable() {
+ return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return BaseColumn.DEFAULT_UPDATABLE;
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
+ firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = getResourceColumn().getTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
+ }
+
+ @Override
+ public void update(OrderColumn2_0Annotation column) {
+ super.update(column);
+ this.setSpecifiedNullable_(this.getResourceNullable(column));
+ this.setSpecifiedInsertable_(this.getResourceInsertable(column));
+ this.setSpecifiedUpdatable_(this.getResourceUpdatable(column));
+ }
+
+ protected Boolean getResourceNullable(OrderColumn2_0Annotation column) {
+ return column.getNullable();
+ }
+
+ protected Boolean getResourceInsertable(OrderColumn2_0Annotation column) {
+ return column.getInsertable();
+ }
+
+ protected Boolean getResourceUpdatable(OrderColumn2_0Annotation column) {
+ return column.getUpdatable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
new file mode 100644
index 0000000000..864252f7ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.core.context.BaseColumn;
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
+import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrderable_2_0;
+import org.eclipse.jpt.core.utility.TextRange;
+
+
+public class GenericOrmOrderColumn2_0
+ extends AbstractOrmNamedColumn<XmlOrderColumn>
+ implements OrmOrderColumn2_0
+{
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+ protected XmlOrderable_2_0 xmlOrderable;
+
+ public GenericOrmOrderColumn2_0(OrmOrderable2_0 parent, OrmNamedColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public XmlOrderColumn getResourceColumn() {
+ return this.xmlOrderable.getOrderColumn();
+ }
+
+ @Override
+ protected void addResourceColumn() {
+ this.xmlOrderable.setOrderColumn(OrmFactory.eINSTANCE.createXmlOrderColumn());
+ }
+
+ @Override
+ protected void removeResourceColumn() {
+ this.xmlOrderable.setOrderColumn(null);
+ }
+
+ public boolean isResourceSpecified() {
+ return getResourceColumn() != null;
+ }
+
+ @Override
+ protected void removeResourceColumnIfFeaturesUnset() {
+ //override to do nothing
+ //don't want to remove the order-column element if it's features are all set to null
+ }
+
+ public boolean isNullable() {
+ return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
+ }
+
+ public boolean isDefaultNullable() {
+ return BaseColumn.DEFAULT_NULLABLE;
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ if (this.valuesAreDifferent(oldSpecifiedNullable, newSpecifiedNullable)) {
+ if (this.getResourceColumn() != null) {
+ this.getResourceColumn().setNullable(newSpecifiedNullable);
+ this.removeResourceColumnIfFeaturesUnset();
+ }
+ else if (newSpecifiedNullable != null) {
+ addResourceColumn();
+ getResourceColumn().setNullable(newSpecifiedNullable);
+ }
+ }
+ firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ public boolean isInsertable() {
+ return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
+ }
+
+ public boolean isDefaultInsertable() {
+ return BaseColumn.DEFAULT_INSERTABLE;
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ if (this.valuesAreDifferent(oldSpecifiedInsertable, newSpecifiedInsertable)) {
+ if (this.getResourceColumn() != null) {
+ this.getResourceColumn().setInsertable(newSpecifiedInsertable);
+ this.removeResourceColumnIfFeaturesUnset();
+ }
+ else if (newSpecifiedInsertable != null) {
+ addResourceColumn();
+ getResourceColumn().setInsertable(newSpecifiedInsertable);
+ }
+ }
+ firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ public boolean isUpdatable() {
+ return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return BaseColumn.DEFAULT_UPDATABLE;
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ if (this.valuesAreDifferent(oldSpecifiedUpdatable, newSpecifiedUpdatable)) {
+ if (this.getResourceColumn() != null) {
+ this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
+ this.removeResourceColumnIfFeaturesUnset();
+ }
+ else if (newSpecifiedUpdatable != null) {
+ addResourceColumn();
+ getResourceColumn().setUpdatable(newSpecifiedUpdatable);
+ }
+ }
+ firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ public void initialize(XmlOrderable_2_0 xmlOrderable) {
+ this.xmlOrderable = xmlOrderable;
+ this.initialize(this.getResourceColumn());
+ }
+
+ public void update(XmlOrderable_2_0 xmlOrderable) {
+ this.xmlOrderable = xmlOrderable;
+ this.update(this.getResourceColumn());
+ }
+
+ @Override
+ protected void initialize(XmlOrderColumn column) {
+ super.initialize(column);
+ this.specifiedNullable = this.getResourceNullable(column);
+ this.specifiedUpdatable = this.getResourceUpdatable(column);
+ this.specifiedInsertable = this.getResourceInsertable(column);
+ }
+
+ @Override
+ protected void update(XmlOrderColumn column) {
+ super.update(column);
+ setSpecifiedNullable_(this.getResourceNullable(column));
+ setSpecifiedUpdatable_(this.getResourceUpdatable(column));
+ setSpecifiedInsertable_(this.getResourceInsertable(column));
+ }
+
+ protected Boolean getResourceNullable(XmlOrderColumn column) {
+ return column == null ? null : column.getNullable();
+ }
+
+ protected Boolean getResourceUpdatable(XmlOrderColumn column) {
+ return column == null ? null : column.getUpdatable();
+ }
+
+
+ protected Boolean getResourceInsertable(XmlOrderColumn column) {
+ return column == null ? null : column.getInsertable();
+ }
+
+ @Override
+ public TextRange getValidationTextRange() {
+ TextRange textRange = getResourceColumn().getValidationTextRange();
+ return (textRange != null) ? textRange : this.getOwner().getValidationTextRange();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java
index 1681648379..8a7fcac676 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java
@@ -20,6 +20,7 @@ import org.eclipse.jpt.core.resource.orm.MapKey;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
import org.eclipse.jpt.core.utility.TextRange;
/**
@@ -142,6 +143,11 @@ public class VirtualXmlManyToMany2_0 extends XmlManyToMany
}
@Override
+ public XmlOrderColumn getOrderColumn() {
+ return this.virtualXmlManyToMany.getOrderColumn();
+ }
+
+ @Override
public TextRange getMappedByTextRange() {
return this.virtualXmlManyToMany.getMappedByTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java
index 7fc508e126..cce837f50d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java
@@ -23,6 +23,7 @@ import org.eclipse.jpt.core.resource.orm.MapKey;
import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
+import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
import org.eclipse.jpt.core.utility.TextRange;
/**
@@ -160,6 +161,11 @@ public class VirtualXmlOneToMany2_0 extends XmlOneToMany
}
@Override
+ public XmlOrderColumn getOrderColumn() {
+ return this.virtualXmlOneToMany.getOrderColumn();
+ }
+
+ @Override
public TextRange getMappedByTextRange() {
return this.virtualXmlOneToMany.getMappedByTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
index ef5a9cd4b3..86cb77d662 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
@@ -11,6 +11,8 @@ package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedColumnAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
@@ -79,6 +81,16 @@ public class SourceOrderColumn2_0Annotation
this.setUpdatable(this.buildUpdatable(astRoot));
}
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName, false);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(this.daa, elementName, false, BooleanExpressionConverter.instance());
+ }
+
public String getAnnotationName() {
return ANNOTATION_NAME;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
index 639b03f8ca..76e30cf024 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
@@ -56,7 +56,7 @@ public abstract class SourceNamedColumnAnnotation
this.columnDefinitionAdapter = this.buildShortCircuitElementAdapter(this.columnDefinitionDeclarationAdapter);
}
- DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
+ protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
index 12835510ca..0cd9c0cac3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
@@ -13,6 +13,7 @@ import org.eclipse.jpt.core.JpaFactory;
import org.eclipse.jpt.core.context.AssociationOverrideContainer;
import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
@@ -20,6 +21,8 @@ import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
@@ -59,4 +62,6 @@ public interface JpaFactory2_0
JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent);
JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent);
+
+ JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OrderColumn2_0.java
new file mode 100644
index 0000000000..77f8d03e0c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/OrderColumn2_0.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context;
+
+import org.eclipse.jpt.core.context.NamedColumn;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrderColumn2_0 extends NamedColumn
+{
+
+ boolean isNullable();
+
+ boolean isDefaultNullable();
+ String DEFAULT_NULLABLE_PROPERTY = "defaultNullable"; //$NON-NLS-1$
+ boolean DEFAULT_NULLABLE = true;
+ Boolean getSpecifiedNullable();
+ void setSpecifiedNullable(Boolean newSpecifiedNullable);
+ String SPECIFIED_NULLABLE_PROPERTY = "specifiedNullable"; //$NON-NLS-1$
+
+
+ boolean isInsertable();
+
+ boolean isDefaultInsertable();
+ String DEFAULT_INSERTABLE_PROPERTY = "defaultInsertable"; //$NON-NLS-1$
+ boolean DEFAULT_INSERTABLE = true;
+ Boolean getSpecifiedInsertable();
+ void setSpecifiedInsertable(Boolean newSpecifiedInsertable);
+ String SPECIFIED_INSERTABLE_PROPERTY = "specifiedInsertable"; //$NON-NLS-1$
+
+
+ boolean isUpdatable();
+
+ boolean isDefaultUpdatable();
+ String DEFAULT_UPDATABLE_PROPERTY = "defaultUpdatable"; //$NON-NLS-1$
+ boolean DEFAULT_UPDATABLE = true;
+ Boolean getSpecifiedUpdatable();
+ void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/Orderable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/Orderable2_0.java
new file mode 100644
index 0000000000..baaf377ac6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/Orderable2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context;
+
+import org.eclipse.jpt.core.context.Orderable;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mappings support ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface Orderable2_0
+ extends Orderable
+{
+
+ boolean isOrderColumnOrdering();
+ void setOrderColumnOrdering(boolean orderColumn);
+ String ORDER_COLUMN_ORDERING_PROPERTY = "orderColumnOrdering"; //$NON-NLS-1$
+
+ OrderColumn2_0 getOrderColumn();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderColumn2_0.java
new file mode 100644
index 0000000000..334dccce7a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderColumn2_0.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaOrderColumn2_0
+ extends
+ OrderColumn2_0,
+ JavaNamedColumn
+{
+ void initialize(OrderColumn2_0Annotation resourceColumn);
+
+ /**
+ * Update the JavaColumn context model object to match the ColumnAnnotation
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update(OrderColumn2_0Annotation resourceColumn);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderable2_0.java
new file mode 100644
index 0000000000..21acdcd086
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaOrderable2_0.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.core.context.java.JavaOrderable;
+import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
+
+/**
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaOrderable2_0
+ extends Orderable2_0, JavaOrderable, JavaNamedColumn.Owner
+{
+ JavaOrderColumn2_0 getOrderColumn();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderColumn2_0.java
new file mode 100644
index 0000000000..e1d75cf3e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderColumn2_0.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrderable_2_0;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmOrderColumn2_0
+ extends
+ OrderColumn2_0,
+ OrmNamedColumn
+{
+ void initialize(XmlOrderable_2_0 orderable);
+
+ /**
+ * Update the OrmOrderColumn2_0 context model object to match the XmlOrderable2_0
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update(XmlOrderable_2_0 orderable);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderable2_0.java
new file mode 100644
index 0000000000..c250f9164b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmOrderable2_0.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.jpa2.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
+
+/**
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmOrderable2_0
+ extends Orderable2_0, OrmOrderable, OrmNamedColumn.Owner
+{
+ OrmOrderColumn2_0 getOrderColumn();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
index ce351c0245..9714788329 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.jpa2.context.orm;
import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
@@ -45,4 +46,6 @@ public interface OrmXml2_0ContextNodeFactory extends OrmXmlContextNodeFactory
OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent, XmlCacheable_2_0 resource);
OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent, XmlOrphanRemovable_2_0 resource);
+
+ OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmNamedColumn.Owner owner);
}

Back to the top