Package com.batch.android
Class LocalCampaignsWebservice
- java.lang.Object
-
- com.batch.android.core.Webservice
-
- com.batch.android.BatchWebservice
-
- com.batch.android.LocalCampaignsWebservice
-
- All Implemented Interfaces:
TaskRunnable,java.lang.Runnable
public class LocalCampaignsWebservice extends BatchWebservice implements TaskRunnable
Webservice to ask the server for all type of local campaigns (be in-app or notification)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.batch.android.core.Webservice
Webservice.RequestType, Webservice.WebserviceError
-
-
Field Summary
Fields Modifier and Type Field Description protected WebserviceMetricswebserviceMetrics-
Fields inherited from class com.batch.android.BatchWebservice
lastFailureCause, retryCount
-
Fields inherited from class com.batch.android.core.Webservice
applicationContext, headers, isDowngradedCipher
-
-
Constructor Summary
Constructors Constructor Description LocalCampaignsWebservice(android.content.Context context, LocalCampaignsWebserviceListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetCryptorModeParameterKey()Return the parameter key for the cryptor modeprotected java.lang.StringgetCryptorTypeParameterKey()Return the type of the get cryptor wanted for this webserviceprotected java.lang.StringgetPostCryptorTypeParameterKey()Return the type of the post cryptor wanted for this webserviceprotected PostDataProvider<JSONObject>getPostDataProvider()Return the POST body you want to add to the requestprotected java.lang.StringgetPropertyParameterKey()Get property parameter key to add parameter to the get chainprotected java.util.List<Query>getQueries()Get the queries to executeprotected java.lang.StringgetReadCryptorTypeParameterKey()Return the type of the read cryptor wanted for this webserviceprotected <T extends Response>
TgetResponseFor(java.lang.Class<T> clazz, QueryType type)retrieve the response for the given type and paramsprotected java.lang.StringgetSpecificConnectTimeoutKey()Return theParameterskey to search specific connect timeout for this webserviceprotected java.lang.StringgetSpecificReadTimeoutKey()Return theParameterskey to search specific read timeout for this webserviceprotected java.lang.StringgetSpecificRetryCountKey()Return theParameterskey to search specific number of retry for this webservicejava.lang.StringgetTaskIdentifier()Return a string that identify this taskprotected java.lang.StringgetURLSorterPatternParameterKey()Return the parameter key to get the URL sorter patternprotected voidparseResponse(JSONObject jsonResponse)Parse the given response to handle parameters, i and queriesvoidrun()-
Methods inherited from class com.batch.android.BatchWebservice
addDefaultHeaders, handleParameters, handleServerID, onRetry
-
Methods inherited from class com.batch.android.core.Webservice
addBatchApiKey, addDefaultParameters, addGetParameter, addHeaders, addParameters, addRequestSignatures, buildConnection, buildParameters, buildURL, canBypassOptOut, encode, executeRequest, formatDate, getBasicJsonResponseBody, getHeaders, getParameters, getResponseErrorCause, getSignatureBody, getStandardResponseBodyIfValid, isResponseValid
-
-
-
-
Field Detail
-
webserviceMetrics
protected WebserviceMetrics webserviceMetrics
-
-
Constructor Detail
-
LocalCampaignsWebservice
public LocalCampaignsWebservice(android.content.Context context, LocalCampaignsWebserviceListener listener) throws java.net.MalformedURLException- Throws:
java.net.MalformedURLException
-
-
Method Detail
-
getQueries
protected java.util.List<Query> getQueries()
Get the queries to execute- Returns:
- a list of queries, will throw an exception if null or empty
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
getTaskIdentifier
public java.lang.String getTaskIdentifier()
Description copied from interface:TaskRunnableReturn a string that identify this task- Specified by:
getTaskIdentifierin interfaceTaskRunnable- Returns:
-
getPropertyParameterKey
protected java.lang.String getPropertyParameterKey()
Description copied from class:BatchWebserviceGet property parameter key to add parameter to the get chain- Specified by:
getPropertyParameterKeyin classBatchWebservice- Returns:
- property key or null if no property is wanted for this webservice
-
getURLSorterPatternParameterKey
protected java.lang.String getURLSorterPatternParameterKey()
Description copied from class:WebserviceReturn the parameter key to get the URL sorter pattern- Specified by:
getURLSorterPatternParameterKeyin classWebservice- Returns:
- key of the parameter or null if no sortor is wanted
-
getCryptorTypeParameterKey
protected java.lang.String getCryptorTypeParameterKey()
Description copied from class:WebserviceReturn the type of the get cryptor wanted for this webservice- Specified by:
getCryptorTypeParameterKeyin classWebservice- Returns:
- type or null if no encryption is wanted
-
getCryptorModeParameterKey
protected java.lang.String getCryptorModeParameterKey()
Description copied from class:WebserviceReturn the parameter key for the cryptor mode- Specified by:
getCryptorModeParameterKeyin classWebservice- Returns:
- param key or null if no mode is provided (
URLBuilder.CryptorMode.ALLwill be used)
-
getPostCryptorTypeParameterKey
protected java.lang.String getPostCryptorTypeParameterKey()
Description copied from class:WebserviceReturn the type of the post cryptor wanted for this webservice- Specified by:
getPostCryptorTypeParameterKeyin classWebservice- Returns:
- type or null if no encryption is wanted
-
getReadCryptorTypeParameterKey
protected java.lang.String getReadCryptorTypeParameterKey()
Description copied from class:WebserviceReturn the type of the read cryptor wanted for this webservice- Specified by:
getReadCryptorTypeParameterKeyin classWebservice- Returns:
- type or null if no encryption is wanted
-
getSpecificConnectTimeoutKey
protected java.lang.String getSpecificConnectTimeoutKey()
Description copied from class:WebserviceReturn theParameterskey to search specific connect timeout for this webservice- Specified by:
getSpecificConnectTimeoutKeyin classWebservice- Returns:
- key if we need specific value, null otherwise
-
getSpecificReadTimeoutKey
protected java.lang.String getSpecificReadTimeoutKey()
Description copied from class:WebserviceReturn theParameterskey to search specific read timeout for this webservice- Specified by:
getSpecificReadTimeoutKeyin classWebservice- Returns:
- key if we need specific value, null otherwise
-
getSpecificRetryCountKey
protected java.lang.String getSpecificRetryCountKey()
Description copied from class:WebserviceReturn theParameterskey to search specific number of retry for this webservice- Specified by:
getSpecificRetryCountKeyin classWebservice- Returns:
- key if we need specific value, null otherwise
-
getPostDataProvider
protected PostDataProvider<JSONObject> getPostDataProvider()
Description copied from class:WebserviceReturn the POST body you want to add to the request- Overrides:
getPostDataProviderin classBatchWebservice- Returns:
- the post data provider if any, null otherwise
-
parseResponse
protected void parseResponse(JSONObject jsonResponse) throws JSONException, java.lang.IllegalStateException
Parse the given response to handle parameters, i and queries- Parameters:
jsonResponse-- Throws:
JSONExceptionjava.lang.IllegalStateException
-
getResponseFor
protected <T extends Response> T getResponseFor(java.lang.Class<T> clazz, QueryType type) throws java.lang.ClassCastException
retrieve the response for the given type and params- Parameters:
clazz- the output class (must be correct, exception thrown otherwise)type- type of response wanted- Returns:
- a response if found, null otherwise
- Throws:
java.lang.ClassCastException- if the given clazz is not of the right type
-
-