-
Notifications
You must be signed in to change notification settings - Fork 2
Responsebuilder
cketcham edited this page Jul 18, 2012
·
3 revisions
Response builder class which makes it easy to create the response and send it. More information on how the json data should be structured can be found on the wiki
Constructor Summary | |
---|---|
ResponseBuilder()
|
|
ResponseBuilder(java.lang.String campaignUrn,
java.lang.String campaignCreationTimestamp)
|
Method Summary | |
---|---|
ResponseBuilder |
clear()
Clear all data from this response |
ResponseBuilder |
setCampaign(java.lang.String campaignUrn,
java.lang.String campaignCreationTimestamp)
Campaign Urn and creation timestamp to specify the campaign |
ResponseBuilder |
setData(java.lang.String data)
Set the response data. |
ResponseBuilder |
setUploadPriority(int uploadPriority)
Upload Priority |
ResponseBuilder |
withLocation(Location location,
java.lang.String timezone,
java.lang.String status)
Location that this response was taken |
ResponseBuilder |
withLocation(long time,
java.lang.String timezone,
double latitude,
double longitude,
float accuracy,
java.lang.String provider,
java.lang.String status)
Location that this response was taken |
ResponseBuilder |
withResponses(java.lang.String responses)
A JSON array composed of JSON object prompt responses and/or JSON object repeatable set responses. |
ResponseBuilder |
withSurveyId(java.lang.String surveyId)
A string defining a survey in the campaign's associated configuration file at the XPath /surveys/survey/id |
ResponseBuilder |
withSurveyKey(java.lang.String surveyKey)
A UUID unique to this survey response. |
ResponseBuilder |
withSurveyLaunchContext(long launchTime,
java.lang.String launchTimezone,
java.lang.String... activeTriggers)
Values which describes the survey's launch context. |
ResponseBuilder |
withSurveyLaunchContext(java.lang.String surveyLaunchContext)
A JSON object with variable properties that describes the survey's launch context. |
ResponseBuilder |
withTime(long time,
java.lang.String timezone)
A long specifying the survey completion time by the number of milliseconds since the UNIX epoch and the timezone ID for the timezone of the device when this survey was taken. |
void |
write(ProbeWriter writer)
|
Constructor Detail |
---|
public ResponseBuilder()
public ResponseBuilder(java.lang.String campaignUrn, java.lang.String campaignCreationTimestamp)
Method Detail |
---|
public ResponseBuilder setCampaign(java.lang.String campaignUrn, java.lang.String campaignCreationTimestamp)
- Campaign Urn and creation timestamp to specify the campaign
-
-
- Parameters:
-
campaignUrn
- -
campaignCreationTimestamp
-
- Returns:
public ResponseBuilder setUploadPriority(int uploadPriority)
- Upload Priority
-
-
- Parameters:
-
uploadPriority
- - Returns:
public ResponseBuilder setData(java.lang.String data)
- Set the response data. This data will be ignored on write if response
data other than the campaignUrn, campaignCreationTimestamp, and
uploadPriority is specified
-
-
- Parameters:
-
data
- - Returns:
public ResponseBuilder withSurveyKey(java.lang.String surveyKey)
- A UUID unique to this survey response.
-
-
- Parameters:
-
surveyKey
- - Returns:
public ResponseBuilder withTime(long time, java.lang.String timezone)
- A long specifying the survey completion time by the number of
milliseconds since the UNIX epoch and the timezone ID for the timezone of
the device when this survey was taken.
-
-
- Parameters:
-
time
- -
timezone
-
- Returns:
public ResponseBuilder withLocation(Location location, java.lang.String timezone, java.lang.String status)
- Location that this response was taken
-
-
- Parameters:
-
location
- -
timezone
- -
status:
- A string describing location status. Must be one of: unavailable, valid, inaccurate, stale. If the status is unavailable, it is an error to send a location object.
- Returns:
public ResponseBuilder withLocation(long time, java.lang.String timezone, double latitude, double longitude, float accuracy, java.lang.String provider, java.lang.String status)
- Location that this response was taken
-
-
- Parameters:
-
time
- -
timezone
- -
latitude
- -
longitude
- -
accuracy
- -
provider
- -
status:
- A string describing location status. Must be one of: unavailable, valid, inaccurate, stale. If the status is unavailable, it is an error to send a location object.
- Returns:
public ResponseBuilder withSurveyId(java.lang.String surveyId)
- A string defining a survey in the campaign's associated configuration
file at the XPath /surveys/survey/id
-
-
- Parameters:
-
surveyId
- - Returns:
public ResponseBuilder withSurveyLaunchContext(java.lang.String surveyLaunchContext)
- A JSON object with variable properties that describes the survey's launch
context.
-
-
- Parameters:
-
surveyLaunchContext
- - Returns:
public ResponseBuilder withSurveyLaunchContext(long launchTime, java.lang.String launchTimezone, java.lang.String... activeTriggers)
- Values which describes the survey's launch context.
-
-
- Parameters:
-
launchTime
- -
launchTimezone
- -
activeTriggers
-
- Returns:
- Throws:
JSONException
public ResponseBuilder withResponses(java.lang.String responses)
- A JSON array composed of JSON object prompt responses and/or JSON object
repeatable set responses.
-
-
- Parameters:
-
responses
- - Returns:
public ResponseBuilder clear()
- Clear all data from this response
-
-
- Returns:
public void write(ProbeWriter writer) throws RemoteException
RemoteException