com.force.sdk.jpa.schema
Class ForceSchemaWriter

java.lang.Object
  extended by com.force.sdk.jpa.schema.ForceAsyncResultProcessor
      extended by com.force.sdk.jpa.schema.ForceSchemaWriter

public class ForceSchemaWriter
extends ForceAsyncResultProcessor

Writes schema to Force.com database using the metadata API. It can be used to create or delete objects/fields

Author:
Fiaz Hossain

Field Summary
 
Fields inherited from class com.force.sdk.jpa.schema.ForceAsyncResultProcessor
LOGGER
 
Constructor Summary
ForceSchemaWriter(SchemaDeleteProperty deleteProperty)
          Create a schema writer for generating the deploy zip and using the metadata API to manipulate schema.
 
Method Summary
 void addCustomField(com.sforce.soap.metadata.CustomObject object, com.sforce.soap.metadata.CustomField field)
          add a custom field to the map which will be written to the package file later for deployment.
 void addCustomObject(com.sforce.soap.metadata.CustomObject object, org.datanucleus.metadata.AbstractClassMetaData cmd, ForceStoreManager storeManager, ForceMetaData fmd)
          Adds a custom object to the map of objects that will be created or deleted.
 void addCustomObject(com.sforce.soap.metadata.CustomObject object, boolean includeInPackageFile)
          This method is used by test cleanup.
 void write(ForceManagedConnection mconn)
          create the proper deploy zip and make the metadata API call.
 
Methods inherited from class com.force.sdk.jpa.schema.ForceAsyncResultProcessor
waitForAsyncResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForceSchemaWriter

public ForceSchemaWriter(SchemaDeleteProperty deleteProperty)
Create a schema writer for generating the deploy zip and using the metadata API to manipulate schema.

Parameters:
deleteProperty - whether this application has been started with a persistence.xml property that causes schema to be deleted rather than upserted, may also have purgeOnDeleteSchema set
Method Detail

addCustomObject

public void addCustomObject(com.sforce.soap.metadata.CustomObject object,
                            org.datanucleus.metadata.AbstractClassMetaData cmd,
                            ForceStoreManager storeManager,
                            ForceMetaData fmd)
Adds a custom object to the map of objects that will be created or deleted.

Parameters:
object - the CustomObject to write to the deploy file
cmd - the metadata of the JPA entity the CustomObject represents
storeManager - the store manager for entities
fmd - the Force.com specific metadata for this object

addCustomObject

public void addCustomObject(com.sforce.soap.metadata.CustomObject object,
                            boolean includeInPackageFile)
This method is used by test cleanup. Use addCustomObject(com.sforce.soap.metadata.CustomObject, org.datanucleus.metadata.AbstractClassMetaData, com.force.sdk.jpa.ForceStoreManager, com.force.sdk.jpa.table.ForceMetaData) if you're intending to use schemaCreation. includeInPackageFile can be true or false depending on the table metadata.

Parameters:
object - the object to be included in schema creation or deletion
includeInPackageFile - whether the package.xml or destructiveChanges.xml file should include this object

addCustomField

public void addCustomField(com.sforce.soap.metadata.CustomObject object,
                           com.sforce.soap.metadata.CustomField field)
add a custom field to the map which will be written to the package file later for deployment.

Parameters:
object - the custom object this field belongs to
field - the CustomField object that will be upserted or deleted

write

public void write(ForceManagedConnection mconn)
           throws Exception
create the proper deploy zip and make the metadata API call.

Parameters:
mconn - the metdata API connection
Throws:
Exception - thrown if something goes wrong during the schema write


Copyright © 2011. All Rights Reserved.