Class 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)
    • 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:
        run in interface java.lang.Runnable
      • getTaskIdentifier

        public java.lang.String getTaskIdentifier()
        Description copied from interface: TaskRunnable
        Return a string that identify this task
        Specified by:
        getTaskIdentifier in interface TaskRunnable
        Returns:
      • getPropertyParameterKey

        protected java.lang.String getPropertyParameterKey()
        Description copied from class: BatchWebservice
        Get property parameter key to add parameter to the get chain
        Specified by:
        getPropertyParameterKey in class BatchWebservice
        Returns:
        property key or null if no property is wanted for this webservice
      • getURLSorterPatternParameterKey

        protected java.lang.String getURLSorterPatternParameterKey()
        Description copied from class: Webservice
        Return the parameter key to get the URL sorter pattern
        Specified by:
        getURLSorterPatternParameterKey in class Webservice
        Returns:
        key of the parameter or null if no sortor is wanted
      • getCryptorTypeParameterKey

        protected java.lang.String getCryptorTypeParameterKey()
        Description copied from class: Webservice
        Return the type of the get cryptor wanted for this webservice
        Specified by:
        getCryptorTypeParameterKey in class Webservice
        Returns:
        type or null if no encryption is wanted
      • getPostCryptorTypeParameterKey

        protected java.lang.String getPostCryptorTypeParameterKey()
        Description copied from class: Webservice
        Return the type of the post cryptor wanted for this webservice
        Specified by:
        getPostCryptorTypeParameterKey in class Webservice
        Returns:
        type or null if no encryption is wanted
      • getReadCryptorTypeParameterKey

        protected java.lang.String getReadCryptorTypeParameterKey()
        Description copied from class: Webservice
        Return the type of the read cryptor wanted for this webservice
        Specified by:
        getReadCryptorTypeParameterKey in class Webservice
        Returns:
        type or null if no encryption is wanted
      • getSpecificConnectTimeoutKey

        protected java.lang.String getSpecificConnectTimeoutKey()
        Description copied from class: Webservice
        Return the Parameters key to search specific connect timeout for this webservice
        Specified by:
        getSpecificConnectTimeoutKey in class Webservice
        Returns:
        key if we need specific value, null otherwise
      • getSpecificReadTimeoutKey

        protected java.lang.String getSpecificReadTimeoutKey()
        Description copied from class: Webservice
        Return the Parameters key to search specific read timeout for this webservice
        Specified by:
        getSpecificReadTimeoutKey in class Webservice
        Returns:
        key if we need specific value, null otherwise
      • getSpecificRetryCountKey

        protected java.lang.String getSpecificRetryCountKey()
        Description copied from class: Webservice
        Return the Parameters key to search specific number of retry for this webservice
        Specified by:
        getSpecificRetryCountKey in class Webservice
        Returns:
        key if we need specific value, 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:
        JSONException
        java.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