Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 9275 invoked from network); 21 Jul 2005 14:33:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jul 2005 14:33:52 -0000 Received: (qmail 43939 invoked by uid 500); 21 Jul 2005 14:33:52 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 43924 invoked by uid 99); 21 Jul 2005 14:33:52 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 21 Jul 2005 07:33:41 -0700 Received: (qmail 9238 invoked by uid 65534); 21 Jul 2005 14:33:39 -0000 Message-ID: <20050721143339.9237.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: jdo-commits@db.apache.org From: mbo@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 StateManagerImpl 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