db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r220093 - /incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java
Date Thu, 21 Jul 2005 14:33:38 GMT
Author: mbo
Date: Thu Jul 21 07:33:38 2005
New Revision: 220093

URL: http://svn.apache.org/viewcvs?rev=220093&view=rev
Log:
Renamed StateManagerImpl method initializePC to initializePCInfo and introduced new method
initializePC that creates a new PC instance with key field copied from ObjectId

Modified:
    incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java

Modified: incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java?rev=220093&r1=220092&r2=220093&view=diff
==============================================================================
--- incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java
(original)
+++ incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/state/StateManagerImpl.java
Thu Jul 21 07:33:38 2005
@@ -227,7 +227,7 @@
         myPC = pc;
         myPCClass = pc.getClass();
         initializePM(pm);
-        initializePC();
+        initializePCInfo();
     }
 
     /** Constructs a new <code>StateManagerImpl</code> when requested
@@ -250,17 +250,10 @@
         myPCClass = clazz; 
 
         if (uoid == null) { // Requested by the store.
-            initializePC();
-            if (srm.isMediationRequiredToCopyOid()) {
-                myPC = jdoImplHelper.newInstance (myPCClass, this);
-                srm.copyKeyFieldsFromObjectId(this, myPCClass);
-            } else {
-                myPC = jdoImplHelper.newInstance (myPCClass, this, ioid);
-            }
-            markPKFieldsAsLoaded();
+            initializePC(srm);
 
         } else if (srm.hasActualPCClass(ioid)){
-            initializePC();
+            initializePCInfo();
             myPC = jdoImplHelper.newInstance (myPCClass, this, uoid);
             markPKFieldsAsLoaded();
 
@@ -280,9 +273,9 @@
 
     /** Initialize PC Class information.
      */
-    private void initializePC() {
+    private void initializePCInfo() {
         if (debugging())
-            debug("initializePC"); // NOI18N
+            debug("initializePCInfo"); // NOI18N
 
         jdoClass = javaModelFactory.getJavaType(myPCClass).getJDOClass();
 
@@ -659,12 +652,7 @@
                 debug("setPCClass " + myLC + " for: " + pcClass); // NOI18N
 
             myPCClass = pcClass; 
-            initializePC();
-
-            myPC = jdoImplHelper.newInstance (myPCClass, this);
-            StoreManager srm = myPM.getStoreManager();
-            srm.copyKeyFieldsFromObjectId(this, myPCClass);
-            markPKFieldsAsLoaded();
+            initializePC(myPM.getStoreManager());
         }
     }
 
@@ -1494,6 +1482,20 @@
     private void fetch(StoreManager srm, int[] fetchFields) {
         srm.fetch(this, fetchFields);
     }
+
+    /**
+     * Create a new PC instance with key fields copied from objectId
+     */
+    private void initializePC(StoreManager srm) {
+        initializePCInfo();
+        if(srm.isMediationRequiredToCopyOid()) {
+            myPC = jdoImplHelper.newInstance (myPCClass, this);
+            srm.copyKeyFieldsFromObjectId(this, myPCClass);
+        } else {
+            myPC = jdoImplHelper.newInstance (myPCClass, this, objectId);
+        }
+        markPKFieldsAsLoaded();
+    }	
 
     /**
     * Helper method to define the list of fields to be loaded



Mime
View raw message