1 2 12 package com.versant.core.jdo.sco.detached; 13 14 import com.versant.core.jdo.VersantPersistenceManager; 15 import com.versant.core.jdo.VersantStateManager; 16 import com.versant.core.common.VersantFieldMetaData; 17 import com.versant.core.common.Utils; 18 import com.versant.core.jdo.sco.CollectionData; 19 import com.versant.core.jdo.sco.VersantSCOCollectionFactory; 20 import com.versant.core.jdo.sco.VersantSimpleSCO; 21 import com.versant.core.metadata.FieldMetaData; 22 import com.versant.core.common.BindingSupportImpl; 23 24 import javax.jdo.spi.PersistenceCapable; 25 import java.io.Serializable ; 26 import java.util.Collection ; 27 28 public class DetachSCOVectorFactory implements VersantSCOCollectionFactory, 29 Serializable { 30 31 37 public VersantSimpleSCO createSCOCollection(PersistenceCapable owner, 38 VersantPersistenceManager pm, VersantStateManager stateManager, 39 VersantFieldMetaData fmd, CollectionData collectionData) { 40 int n = collectionData.valueCount; 41 Object [] originalData = new Object [n]; 42 originalData = Utils.getObjectsById(collectionData.values, 43 collectionData.valueCount, pm, (FieldMetaData) fmd, 44 fmd.isElementTypePC()); 45 return new DetachSCOVector(owner, stateManager, fmd, originalData); 46 } 47 48 51 public VersantSimpleSCO createSCOCollection(PersistenceCapable owner, 52 VersantPersistenceManager pm, VersantStateManager stateManager, 53 VersantFieldMetaData fmd, Collection collection) { 54 return new DetachSCOVector(owner, stateManager, fmd, collection.toArray()); 55 } 56 57 58 } 59 | Popular Tags |