com.force.sdk.jpa
Class ForcePersistenceHandler

java.lang.Object
  extended by org.datanucleus.store.AbstractPersistenceHandler
      extended by com.force.sdk.jpa.ForcePersistenceHandler
All Implemented Interfaces:
org.datanucleus.store.StorePersistenceHandler

public class ForcePersistenceHandler
extends org.datanucleus.store.AbstractPersistenceHandler

Persistence handler that handles all CRUD operations and translates them into SOQL calls.

Author:
Fiaz Hossain

Field Summary
protected  ForceStoreManager storeManager
           
 
Constructor Summary
ForcePersistenceHandler(org.datanucleus.store.StoreManager storeManager)
          create the persistence handler that will be used for all API operations.
 
Method Summary
static void checkForErrors(com.sforce.soap.partner.DeleteResult[] results)
          checks for errors in a delete call and handles the results properly.
static void checkForRecycleBinErrors(com.sforce.soap.partner.EmptyRecycleBinResult[] results)
          checks for errors in an empty recycle bin call.
 void close()
           
 void createObjects(Collection<com.sforce.soap.partner.sobject.SObject> objects, Collection<org.datanucleus.store.ObjectProvider> objectProviders, org.datanucleus.store.ExecutionContext ec)
          This method is used for AllOrNothing operations.
 void deleteObject(org.datanucleus.store.ObjectProvider op)
          Deletes a persistent object from the datastore.
 void deleteObjects(String[] objects, org.datanucleus.store.ExecutionContext ec)
          This method is used for AllOrNothing operations.
 void fetchObject(org.datanucleus.store.ObjectProvider op, int[] fieldNumbers)
          Fetches a persistent object from the database.
 Object findObject(org.datanucleus.store.ExecutionContext ectx, Object id)
           
 void insertObject(org.datanucleus.store.ObjectProvider op)
          Inserts a persistent object into the database.
 void locateObject(org.datanucleus.store.ObjectProvider op)
          Locates this object in the datastore.
 void updateObject(org.datanucleus.store.ObjectProvider op, int[] fieldNumbers)
          Updates a persistent object in the datastore.
 void updateObjects(com.sforce.soap.partner.sobject.SObject[] objects, Calendar[] versions, org.datanucleus.store.ExecutionContext ec)
          This method is used for AllOrNothing operations.
 
Methods inherited from class org.datanucleus.store.AbstractPersistenceHandler
batchEnd, batchStart, findObjects, locateObjects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storeManager

protected final ForceStoreManager storeManager
Constructor Detail

ForcePersistenceHandler

public ForcePersistenceHandler(org.datanucleus.store.StoreManager storeManager)
create the persistence handler that will be used for all API operations.

Parameters:
storeManager - the store manager
Method Detail

close

public void close()

deleteObject

public void deleteObject(org.datanucleus.store.ObjectProvider op)
Deletes a persistent object from the datastore.

Parameters:
op - The ObjectProvider of the object to be deleted.

fetchObject

public void fetchObject(org.datanucleus.store.ObjectProvider op,
                        int[] fieldNumbers)
Fetches a persistent object from the database.

Parameters:
op - The ObjectProvider of the object to be fetched.
fieldNumbers - The numbers of the fields to be fetched.

findObject

public Object findObject(org.datanucleus.store.ExecutionContext ectx,
                         Object id)

insertObject

public void insertObject(org.datanucleus.store.ObjectProvider op)
Inserts a persistent object into the database.

Parameters:
op - The ObjectProvider of the object to be inserted.
Throws:
org.datanucleus.exceptions.NucleusDataStoreException - when an error occurs in the datastore communication

locateObject

public void locateObject(org.datanucleus.store.ObjectProvider op)
Locates this object in the datastore.

Parameters:
op - The ObjectProvider for the object to be found

updateObject

public void updateObject(org.datanucleus.store.ObjectProvider op,
                         int[] fieldNumbers)
Updates a persistent object in the datastore.

Parameters:
op - The ObjectProvider of the object to be updated.
fieldNumbers - The numbers of the fields to be updated.

createObjects

public void createObjects(Collection<com.sforce.soap.partner.sobject.SObject> objects,
                          Collection<org.datanucleus.store.ObjectProvider> objectProviders,
                          org.datanucleus.store.ExecutionContext ec)
This method is used for AllOrNothing operations.

Parameters:
objects - the objects to be created
objectProviders - the object providers for each object
ec - the execution context for this transaction

updateObjects

public void updateObjects(com.sforce.soap.partner.sobject.SObject[] objects,
                          Calendar[] versions,
                          org.datanucleus.store.ExecutionContext ec)
This method is used for AllOrNothing operations.

Parameters:
objects - the objects to be updated
versions - the versions corresponding with each object for if-modified-before checks
ec - the execution context of this transaction

deleteObjects

public void deleteObjects(String[] objects,
                          org.datanucleus.store.ExecutionContext ec)
This method is used for AllOrNothing operations.

Parameters:
objects - the objects to be deleted
ec - the execution context for this transaction

checkForErrors

public static void checkForErrors(com.sforce.soap.partner.DeleteResult[] results)
checks for errors in a delete call and handles the results properly.

Parameters:
results - the results from the delete API call

checkForRecycleBinErrors

public static void checkForRecycleBinErrors(com.sforce.soap.partner.EmptyRecycleBinResult[] results)
checks for errors in an empty recycle bin call.

Parameters:
results - the results from the empty recycle bin API call


Copyright © 2011. All Rights Reserved.