Revision: 5359
http://datanucleus.svn.sourceforge.net/datanucleus/?rev=5359&view=rev
Author: andy_jefferson
Date: 2009-03-02 11:28:49 +0000 (Mon, 02 Mar 2009)
Log Message:
-----------
Use MapMetadata.getMapType instead of local variable. Javadocs
Modified Paths:
--------------
platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/AbstractMapStore.java
platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapKeySetStore.java
platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapValueSetStore.java
platform/core/trunk/src/java/org/datanucleus/store/scostore/MapStore.java
Modified: platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/AbstractMapStore.java
===================================================================
--- platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/AbstractMapStore.java 2009-03-02 11:23:52 UTC (rev 5358)
+++ platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/AbstractMapStore.java 2009-03-02 11:28:49 UTC (rev 5359)
@@ -99,10 +99,12 @@
protected final DatastoreIdentifier elmIdentifier;
protected final AbstractMapStoreSpecialization specialization;
+
/**
* Constructor.
* @param storeMgr Manager for the store
- **/
+ * @param specialization Specialisation for this datastore
+ */
public AbstractMapStore(StoreManager storeMgr, AbstractMapStoreSpecialization specialization)
{
super(storeMgr);
Modified: platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapKeySetStore.java
===================================================================
--- platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapKeySetStore.java 2009-03-02 11:23:52 UTC (rev 5358)
+++ platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapKeySetStore.java 2009-03-02 11:28:49 UTC (rev 5359)
@@ -27,6 +27,7 @@
import org.datanucleus.exceptions.NucleusUserException;
import org.datanucleus.metadata.AbstractMemberMetaData;
import org.datanucleus.metadata.DiscriminatorStrategy;
+import org.datanucleus.metadata.MapMetaData.MapType;
import org.datanucleus.store.mapped.DatastoreClass;
import org.datanucleus.store.mapped.DatastoreContainerObject;
import org.datanucleus.store.mapped.DatastoreIdentifier;
@@ -59,18 +60,6 @@
{
private DatastoreIdentifier valueIdentifier;
- /** Indicator for a map that is managed by a join table. */
- protected static final int MAP_TYPE_JOIN = 0;
-
- /** Indicator for a map that is managed by storing the key as a field in the value. */
- protected static final int MAP_TYPE_KEY_IN_VALUE = 1;
-
- /** Indicator for a map that is managed by storing the value as a field in the key. */
- protected static final int MAP_TYPE_VALUE_IN_KEY = 2;
-
- /** Type of map being managed by this key store. */
- protected final int mapType;
-
/**
* Constructor where a join table is used to store the map relation.
* @param mapTable The table for the map (join table)
@@ -88,7 +77,6 @@
this.containerTable = mapTable;
this.ownerMemberMetaData = ownerMmd;
- this.mapType = MAP_TYPE_JOIN;
this.ownerMapping = ownerMapping;
this.elementMapping = keyMapping;
@@ -114,14 +102,6 @@
this.ownerMapping = ownerMapping;
this.elementMapping = keyMapping;
this.ownerMemberMetaData = ownerMmd;
- if (ownerMmd.getValueMetaData() != null && ownerMmd.getValueMetaData().getMappedBy() != null)
- {
- this.mapType = MAP_TYPE_VALUE_IN_KEY;
- }
- else
- {
- this.mapType = MAP_TYPE_KEY_IN_VALUE;
- }
initialize(clr);
}
@@ -166,6 +146,7 @@
final ClassLoaderResolver clr = ownerSM.getObjectManager().getClassLoaderResolver();
final Class elementCls = clr.classForName(elementType);
QueryExpression stmt = null;
+ MapType mapType = getOwnerMemberMetaData().getMap().getMapType();
if (emd != null && emd.getDiscriminatorStrategy() != null &&
emd.getDiscriminatorStrategy() != DiscriminatorStrategy.NONE && containerTable instanceof DatastoreClass)
{
@@ -197,14 +178,14 @@
else
{
// Join to key table if this is join table, or value table
- boolean sourceJoin = (mapType == MAP_TYPE_JOIN || mapType == MAP_TYPE_KEY_IN_VALUE);
+ boolean sourceJoin = (mapType == MapType.MAP_TYPE_JOIN || mapType == MapType.MAP_TYPE_KEY_IN_VALUE);
stmt = storeMgr.newUnionIteratorStatement(clr, elementCls, true, elementCls, elementMapping,
containerTable, sourceJoin, null, true, false).getQueryStatement(null);
}
// Apply condition on owner field to filter by owner
- if (mapType == MAP_TYPE_JOIN || storeMgr.getMappedTypeManager().isSupportedMappedType(elementType) ||
- mapType == MAP_TYPE_VALUE_IN_KEY)
+ if (mapType == MapType.MAP_TYPE_JOIN || storeMgr.getMappedTypeManager().isSupportedMappedType(elementType) ||
+ mapType == MapType.MAP_TYPE_VALUE_IN_KEY)
{
// SCO cases/primitiveKeys just provide the owner id on their table
ScalarExpression ownerExpr = ownerMapping.newScalarExpression(stmt, stmt.getMainTableExpression());
Modified: platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapValueSetStore.java
===================================================================
--- platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapValueSetStore.java 2009-03-02 11:23:52 UTC (rev 5358)
+++ platform/core/trunk/src/java/org/datanucleus/store/mapped/scostore/MapValueSetStore.java 2009-03-02 11:28:49 UTC (rev 5359)
@@ -62,8 +62,9 @@
* @param valueMapping the value mapping
* @param specialization the specialization
*/
- public MapValueSetStore(DatastoreContainerObject mapTable, MapStore mapStore, ClassLoaderResolver clr, JavaTypeMapping ownerMapping,
- JavaTypeMapping keyMapping, JavaTypeMapping valueMapping, AbstractSetStoreSpecialization specialization)
+ public MapValueSetStore(DatastoreContainerObject mapTable, MapStore mapStore, ClassLoaderResolver clr,
+ JavaTypeMapping ownerMapping, JavaTypeMapping keyMapping, JavaTypeMapping valueMapping,
+ AbstractSetStoreSpecialization specialization)
{
super(mapTable.getStoreManager(), clr, specialization);
@@ -98,11 +99,9 @@
this.containerTable = valueTable;
this.ownerMemberMetaData = fmd;
-
this.ownerMapping = ownerMapping;
this.keyMapping = null;
this.elementMapping = valueMapping;
-
this.mapStore = mapStore;
initialize(clr);
Modified: platform/core/trunk/src/java/org/datanucleus/store/scostore/MapStore.java
===================================================================
--- platform/core/trunk/src/java/org/datanucleus/store/scostore/MapStore.java 2009-03-02 11:23:52 UTC (rev 5358)
+++ platform/core/trunk/src/java/org/datanucleus/store/scostore/MapStore.java 2009-03-02 11:28:49 UTC (rev 5359)
@@ -15,8 +15,6 @@
Contributors:
2003 Andy Jefferson - coding standards
2004 Andy Jefferson - added query methods and comments
-2004 Erik Bengtson - added joinKeysValuesTo
-2004 Erik Bengtson - added joinKeysToGet
...
**********************************************************************/
package org.datanucleus.store.scostore;
@@ -30,40 +28,38 @@
*/
public interface MapStore extends Store
{
- // --------------------------- Accessor Methods ----------------------------
-
/**
- * Accessor for the key type in the collection.
+ * Accessor for the key type in the map.
* @return The key type.
- **/
+ */
String getKeyType();
/**
- * Accessor for the value type in the collection.
+ * Accessor for the value type in the map.
* @return The value type.
- **/
+ */
String getValueType();
/**
- * Accessor for whether the keys are embedded
+ * Accessor for whether the keys are embedded.
* @return Whether we have embedded keys
*/
boolean keysAreEmbedded();
/**
- * Accessor for whether the keys are serialised
+ * Accessor for whether the keys are serialised.
* @return Whether we have serialised keys
*/
boolean keysAreSerialised();
/**
- * Accessor for whether the values are embedded
+ * Accessor for whether the values are embedded.
* @return Whether we have embedded values
*/
boolean valuesAreEmbedded();
/**
- * Accessor for whether the values are serialised
+ * Accessor for whether the values are serialised.
* @return Whether we have serialised values
*/
boolean valuesAreSerialised();
@@ -75,7 +71,7 @@
* @param ownerSM State Manager for the Map.
* @param value The value to check
* @return Whether it is contained.
- **/
+ */
boolean containsValue(StateManager ownerSM, Object value);
/**
@@ -83,7 +79,7 @@
* @param ownerSM State Manager for the Map.
* @param key The key to check
* @return Whether it is contained.
- **/
+ */
boolean containsKey(StateManager ownerSM, Object key);
/**
@@ -91,7 +87,7 @@
* @param ownerSM State Manager for the Map.
* @param key Key for the value.
* @return Value for this key.
- **/
+ */
Object get(StateManager ownerSM, Object key);
/**
@@ -100,14 +96,14 @@
* @param key The key.
* @param value The value.
* @return Value that was previously against this key.
- **/
+ */
Object put(StateManager ownerSM, Object key, Object value);
/**
* Method to add a map of values to the Map.
* @param ownerSM State Manager for the Map.
* @param m The map to add.
- **/
+ */
void putAll(StateManager ownerSM, Map m);
/**
@@ -115,35 +111,35 @@
* @param ownerSM State Manager for the Map.
* @param key Key whose value is to be removed.
* @return Value that was removed.
- **/
+ */
Object remove(StateManager ownerSM, Object key);
/**
- * Method to clear the collection.
- * @param ownerSM State Manager for the collection.
- **/
+ * Method to clear the map.
+ * @param ownerSM State Manager for the map.
+ */
void clear(StateManager ownerSM);
/**
* Accessor for the keys in the Map.
* @return Keys for the Map.
- **/
+ */
SetStore keySetStore();
/**
* Accessor for the values in the Map.
* @return Values for the Map.
- **/
+ */
SetStore valueSetStore();
/**
* Accessor for the entry set for the Map.
* @return Entry set for the Map.
- **/
+ */
SetStore entrySetStore();
/**
- * Method to update en embedded key in the collection.
+ * Method to update en embedded key in the map.
* @param sm State Manager of the owner
* @param key The element
* @param fieldNumber Field to update in the key
@@ -153,7 +149,7 @@
boolean updateEmbeddedKey(StateManager sm, Object key, int fieldNumber, Object newValue);
/**
- * Method to update en embedded value in the collection.
+ * Method to update en embedded value in the map.
* @param sm State Manager of the owner
* @param value The element
* @param fieldNumber Field to update in the value
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|