Accela SDK for Android  V3.0
 All Classes Functions Variables Pages
com.accela.mobile.AMRequest Class Reference

Classes

enum  HTTPMethod
 
enum  RequestType
 

Public Member Functions

 AMRequest (AccelaMobile accelaMobile, String serviceURL, RequestParams params, HTTPMethod httpMethod)
 
void setIsSynchronous (Boolean isSynchronous)
 
void setHttpHeader (HashMap< String, String > httpHeaders)
 
Boolean isLoading ()
 
void waitUntilFinished ()
 
void cancelRequest ()
 
Boolean isCancelled ()
 
JSONObject fetch (RequestParams paramData)
 
AMRequest sendRequest (RequestParams paramData, AMRequestDelegate requestDelegate)
 
AMRequest sendRequest (RequestParams data, Map< String, String > attachments, AMRequestDelegate requestDelegate)
 
AMRequest uploadAttachment (Map< String, String > attachmentInfo, AMRequestDelegate requestDelegate)
 
AMRequest downloadAttachment (String localFile, AMRequestDelegate requestDelegate)
 
String getTag ()
 
void setTag (String tag)
 
String getServiceURL ()
 
HTTPMethod getHttpMethod ()
 
RequestType getRequestType ()
 
void setRequestType (RequestType requestType)
 
AccelaMobile getAccelaMobile ()
 
void setAccelaMobile (AccelaMobile accelaMobile)
 
AsyncHttpClient getAsyncHttpClient ()
 
SyncHttpClient getSyncHttpClient ()
 
RequestParams getUrlParams ()
 
RequestParams getPostParams ()
 
String getAmDownloadDestinationPath ()
 
String getAmUploadDestinationPath ()
 
ProgressDialog getRequestWaitingView ()
 
void setOwnerView (ViewGroup ownerView, String labelText)
 
void setProgressLabelText (String labelText)
 

Static Protected Attributes

static final String HEADER_X_ACCELA_TRACEID = "x-accela-traceid"
 
static final String HEADER_X_ACCELA_RESP_MESSAGE = "x-accela-resp-message"
 

Detailed Description

 Accela Amobile
 File: AMRequest.java
 Accela, Inc.
 Copyright (C): 2013
 Description:
 AccelaMobile Request object, used to process HTTP/HTTPS requests.
 Notes:
 Revision History

   @since 1.0
 

Constructor & Destructor Documentation

com.accela.mobile.AMRequest.AMRequest ( AccelaMobile  accelaMobile,
String  serviceURL,
RequestParams  params,
HTTPMethod  httpMethod 
)
inline

Constructor with the given parameters.

Parameters
accelaMobileThe AccelaMobile instance which create this request.
serviceURLThe service's full path(including server host).
paramsThe collection of URL parameters which will be added to URL with & symbol.
httpMethodOne of HTTP method such as GET, POST, PUT or DELETE.
Returns
An initialized AMRequest instance.
Since
1.0

Member Function Documentation

void com.accela.mobile.AMRequest.cancelRequest ( )
inline

Cancel the current request.

Returns
Void.
Since
1.0
AMRequest com.accela.mobile.AMRequest.downloadAttachment ( String  localFile,
AMRequestDelegate  requestDelegate 
)
inline

Download a binary file as an asynchronous operation or synchronous operation. That depends on the value of isSynchronous boolean variable.

Parameters
localFileThe local file path with which the downloaded file will be created.
requestDelegateThe delegate for asynchronous request, or null for synchronous request. Note this parameter is used only for asynchronous request (this.isSynchronous = false).
Returns
The AMRequest object corresponding to this API call.
Since
1.0
JSONObject com.accela.mobile.AMRequest.fetch ( RequestParams  paramData)
inline

Synchronously send a request identified by the Accela Mobile Cloud API endpoint with the given data using an HTTP POST method.

Parameters
paramDataThe content sent with the corresponding request.
Returns
The resulting object is a JSON object if succeed; otherwise, null.
Since
1.0
AccelaMobile com.accela.mobile.AMRequest.getAccelaMobile ( )
inline
Get the value of property accelaMobile.
Returns
The value of property accelaMobile.
@since 3.0
String com.accela.mobile.AMRequest.getAmDownloadDestinationPath ( )
inline

Get the value of property amDownloadDestinationPath.

Returns
The value of property amDownloadDestinationPath.
Since
1.0
String com.accela.mobile.AMRequest.getAmUploadDestinationPath ( )
inline

Get the value of property amUploadDestinationPath.

Returns
The value of property amUploadDestinationPath.
Since
1.0
AsyncHttpClient com.accela.mobile.AMRequest.getAsyncHttpClient ( )
inline
Get the value of property asyncHttpClient.
Returns
The value of property asyncHttpClient.
@since 1.0
HTTPMethod com.accela.mobile.AMRequest.getHttpMethod ( )
inline
Get the value of property httpMethod.
Returns
The value of property httpMethod.
@since 3.0
RequestParams com.accela.mobile.AMRequest.getPostParams ( )
inline

Get the value of property postParams.

Returns
The value of property postParams.
Since
3.0
RequestType com.accela.mobile.AMRequest.getRequestType ( )
inline
Get the value of property requestType.
Returns
The value of property requestType.
@since 3.0
ProgressDialog com.accela.mobile.AMRequest.getRequestWaitingView ( )
inline

Get the value of property requestWaitingView.

Returns
The value of property requestWaitingView.
Since
1.0
String com.accela.mobile.AMRequest.getServiceURL ( )
inline
Get the value of property serviceURL.
Returns
The value of property serviceURL.
@since 3.0
SyncHttpClient com.accela.mobile.AMRequest.getSyncHttpClient ( )
inline

Get the value of property syncHttpClient.

Returns
The value of property syncHttpClient.
Since
1.0
String com.accela.mobile.AMRequest.getTag ( )
inline
Get the value of property tag.
Returns
The value of property tag.
@since 3.0
RequestParams com.accela.mobile.AMRequest.getUrlParams ( )
inline

Get the value of property urlParams.

Returns
The value of property urlParams.
Since
3.0
Boolean com.accela.mobile.AMRequest.isCancelled ( )
inline

Cancel the current request.

Returns
Void.
Since
3.0
Boolean com.accela.mobile.AMRequest.isLoading ( )
inline

Indicates whether the request is in progress.

Returns
true when this request is in progress; otherwise, false.
Since
1.0
AMRequest com.accela.mobile.AMRequest.sendRequest ( RequestParams  paramData,
AMRequestDelegate  requestDelegate 
)
inline

Makes a request to the Accela Mobile Cloud API endpoint with the given data using an HTTP POST method as an asynchronous operation.

Parameters
paramDataThe content sent with the corresponding request.
requestDelegateThe request's delegate.
Returns
The AMRequest object corresponding to this API call.
Since
1.0
AMRequest com.accela.mobile.AMRequest.sendRequest ( RequestParams  data,
Map< String, String >  attachments,
AMRequestDelegate  requestDelegate 
)
inline

Makes an asynchronous request using an HTTP POST method to upload multiple attachments.

Parameters
dataThe content sent with the corresponding request.
attachmentsThe attachments to be uploaded in the request. Values mapping: Key => File Path.
requestDelegateThe request's delegate.
Returns
The AMRequest object corresponding to this API call.
Since
3.0
void com.accela.mobile.AMRequest.setAccelaMobile ( AccelaMobile  accelaMobile)
inline
Set the value of property accelaMobile.

@param accelaMobile The new value to be assigned.
Returns
Void.
@since 3.0
void com.accela.mobile.AMRequest.setHttpHeader ( HashMap< String, String >  httpHeaders)
inline

Set HTTP / HTTPS headers for the current request.

Parameters
httpHeadersPairs of header key and value.
Returns
Void.
Since
3.0
void com.accela.mobile.AMRequest.setIsSynchronous ( Boolean  isSynchronous)
inline

Set value for property isSynchronous.

Parameters
isSynchronoustrue or false
Returns
Void.
Since
3.0
void com.accela.mobile.AMRequest.setOwnerView ( ViewGroup  ownerView,
String  labelText 
)
inline

Show a waiting indicator in the specified view.

Note: This method sets holder view for the current request and then show a progress dialog in it. 1.In asynchronous request, please call this method in the request delegate's onStart() method, then dismiss the progress dialog in the request delegate's onSuccess() method or onFailure() method. 2.In synchronous request, please call this method just before the code line which sends out the request, then dismiss the progress dialog after that code line.

Parameters
ownerViewThe view which presents the waiting view.
labelTextThe message which is displayed in the waiting view.
Returns
Void.
Since
1.0
void com.accela.mobile.AMRequest.setProgressLabelText ( String  labelText)
inline

Set message content in the waiting indicator view.

Parameters
labelTextThe message text to be assigned.
Returns
Void.
Since
3.0
void com.accela.mobile.AMRequest.setRequestType ( RequestType  requestType)
inline
Set the value of property requestType.

@param requestType The new value to be assigned.
Returns
Void.
@since 3.0
void com.accela.mobile.AMRequest.setTag ( String  tag)
inline
Set the value of property tag.

@param tag The new tag to be assigned.
Returns
The value of property tag.
@since 3.1
AMRequest com.accela.mobile.AMRequest.uploadAttachment ( Map< String, String >  attachmentInfo,
AMRequestDelegate  requestDelegate 
)
inline

Uploads a binary file represented as an asynchronous operation or synchronous operation. That depends on the value of isSynchronous boolean variable.

Parameters
attachmentInfoThe collection of file's information. Note there should be two keys named "fileName" and "localPath".
requestDelegateThe delegate for asynchronous request, or null for synchronous request. Note this parameter is used only for asynchronous request (this.isSynchronous = false).
Returns
The AMRequest object corresponding to this API call.
Since
1.0
void com.accela.mobile.AMRequest.waitUntilFinished ( )
inline

Wait until the current request is finished.

Returns
Void.
Since
3.0

Member Data Documentation

final String com.accela.mobile.AMRequest.HEADER_X_ACCELA_RESP_MESSAGE = "x-accela-resp-message"
staticprotected

Response Message header name in HTTP/HTTPS response headers.

Since
3.0
final String com.accela.mobile.AMRequest.HEADER_X_ACCELA_TRACEID = "x-accela-traceid"
staticprotected

Trace ID header name in HTTP/HTTPS response headers.

Since
3.0

The documentation for this class was generated from the following file: