Package org.teiid.salesforce
Class BaseSalesforceConnection<T extends SalesforceConfiguration,C extends com.sforce.ws.ConnectorConfig,P extends com.sforce.soap.partner.PartnerConnection>
- java.lang.Object
-
- org.teiid.salesforce.BaseSalesforceConnection<T,C,P>
-
- All Implemented Interfaces:
Connection
,SalesforceConnection
- Direct Known Subclasses:
SalesforceConnectionImpl
public abstract class BaseSalesforceConnection<T extends SalesforceConfiguration,C extends com.sforce.ws.ConnectorConfig,P extends com.sforce.soap.partner.PartnerConnection> extends Object implements SalesforceConnection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.translator.salesforce.SalesforceConnection
SalesforceConnection.BatchResultInfo, SalesforceConnection.BulkBatchResult
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseSalesforceConnection(P partnerConnection)
BaseSalesforceConnection(T salesforceConfig)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SalesforceConnection.BatchResultInfo
addBatch(String query, com.sforce.async.JobInfo job)
String
addBatch(List<com.sforce.async.SObject> payload, com.sforce.async.JobInfo job)
void
cancelBulkJob(com.sforce.async.JobInfo job)
void
close()
com.sforce.async.JobInfo
closeJob(String jobId)
int
create(DataPayload data)
com.sforce.async.JobInfo
createBulkJob(String objectName, com.sforce.async.OperationEnum operation, boolean usePkChunking)
protected abstract C
createConnectorConfig(T salesforceConfig)
int
delete(String[] ids)
SalesforceConnection.BulkBatchResult
getBatchQueryResults(String jobId, SalesforceConnection.BatchResultInfo info)
com.sforce.async.BatchResult[]
getBulkResults(com.sforce.async.JobInfo job, List<String> ids)
Long
getCardinality(String sobject)
DeletedResult
getDeleted(String objectName, Calendar startCalendar, Calendar endCalendar)
com.sforce.soap.partner.DescribeSObjectResult[]
getObjectMetaData(String... objectName)
com.sforce.soap.partner.DescribeGlobalResult
getObjects()
protected P
getPartnerConnection()
UpdatedResult
getUpdated(String objectType, Calendar startDate, Calendar endDate)
String
getVersion()
boolean
isAlive()
boolean
isValid()
protected abstract P
login(T salesforceConfig, C connectorConfig)
This method must log the user in and create the appropriatePartnerConnection
instancecom.sforce.soap.partner.QueryResult
query(String queryString, int batchSize, boolean queryAll)
com.sforce.soap.partner.QueryResult
queryMore(String queryLocator, int batchSize)
com.sforce.soap.partner.sobject.SObject[]
retrieve(String fieldList, String sObjectType, List<String> ids)
static com.sforce.soap.partner.sobject.SObject
toUpdateSObject(List<String> nullFields, DataPayload data)
int
update(List<DataPayload> updateDataList)
int
upsert(DataPayload data)
-
-
-
Constructor Detail
-
BaseSalesforceConnection
public BaseSalesforceConnection(T salesforceConfig) throws com.sforce.async.AsyncApiException, com.sforce.ws.ConnectionException
- Throws:
com.sforce.async.AsyncApiException
com.sforce.ws.ConnectionException
-
BaseSalesforceConnection
protected BaseSalesforceConnection(P partnerConnection)
-
-
Method Detail
-
createConnectorConfig
protected abstract C createConnectorConfig(T salesforceConfig) throws com.sforce.ws.ConnectionException
- Throws:
com.sforce.ws.ConnectionException
-
login
protected abstract P login(T salesforceConfig, C connectorConfig) throws com.sforce.async.AsyncApiException, com.sforce.ws.ConnectionException
This method must log the user in and create the appropriatePartnerConnection
instance- Parameters:
salesforceConfig
-- Throws:
com.sforce.async.AsyncApiException
com.sforce.ws.ConnectionException
-
getCardinality
public Long getCardinality(String sobject) throws TranslatorException
- Specified by:
getCardinality
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceSalesforceConnection
-
getPartnerConnection
protected P getPartnerConnection()
-
query
public com.sforce.soap.partner.QueryResult query(String queryString, int batchSize, boolean queryAll) throws TranslatorException
- Specified by:
query
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
queryMore
public com.sforce.soap.partner.QueryResult queryMore(String queryLocator, int batchSize) throws TranslatorException
- Specified by:
queryMore
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
delete
public int delete(String[] ids) throws TranslatorException
- Specified by:
delete
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
upsert
public int upsert(DataPayload data) throws TranslatorException
- Specified by:
upsert
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
create
public int create(DataPayload data) throws TranslatorException
- Specified by:
create
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
update
public int update(List<DataPayload> updateDataList) throws TranslatorException
- Specified by:
update
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
toUpdateSObject
public static com.sforce.soap.partner.sobject.SObject toUpdateSObject(List<String> nullFields, DataPayload data)
-
getUpdated
public UpdatedResult getUpdated(String objectType, Calendar startDate, Calendar endDate) throws TranslatorException
- Specified by:
getUpdated
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getDeleted
public DeletedResult getDeleted(String objectName, Calendar startCalendar, Calendar endCalendar) throws TranslatorException
- Specified by:
getDeleted
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
retrieve
public com.sforce.soap.partner.sobject.SObject[] retrieve(String fieldList, String sObjectType, List<String> ids) throws TranslatorException
- Specified by:
retrieve
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getObjects
public com.sforce.soap.partner.DescribeGlobalResult getObjects() throws TranslatorException
- Specified by:
getObjects
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getObjectMetaData
public com.sforce.soap.partner.DescribeSObjectResult[] getObjectMetaData(String... objectName) throws TranslatorException
- Specified by:
getObjectMetaData
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
close
public void close()
- Specified by:
close
in interfaceConnection
-
isAlive
public boolean isAlive()
-
createBulkJob
public com.sforce.async.JobInfo createBulkJob(String objectName, com.sforce.async.OperationEnum operation, boolean usePkChunking) throws TranslatorException
- Specified by:
createBulkJob
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
addBatch
public String addBatch(List<com.sforce.async.SObject> payload, com.sforce.async.JobInfo job) throws TranslatorException
- Specified by:
addBatch
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
addBatch
public SalesforceConnection.BatchResultInfo addBatch(String query, com.sforce.async.JobInfo job) throws TranslatorException
- Specified by:
addBatch
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getBatchQueryResults
public SalesforceConnection.BulkBatchResult getBatchQueryResults(String jobId, SalesforceConnection.BatchResultInfo info) throws TranslatorException
- Specified by:
getBatchQueryResults
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
closeJob
public com.sforce.async.JobInfo closeJob(String jobId) throws TranslatorException
- Specified by:
closeJob
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getBulkResults
public com.sforce.async.BatchResult[] getBulkResults(com.sforce.async.JobInfo job, List<String> ids) throws TranslatorException
- Specified by:
getBulkResults
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
cancelBulkJob
public void cancelBulkJob(com.sforce.async.JobInfo job) throws TranslatorException
- Specified by:
cancelBulkJob
in interfaceSalesforceConnection
- Throws:
TranslatorException
-
getVersion
public String getVersion()
- Specified by:
getVersion
in interfaceSalesforceConnection
-
-