org.codeforamerica.open311.facade.data.operations
Class POSTServiceRequestData

java.lang.Object
  extended by org.codeforamerica.open311.facade.data.operations.POSTServiceRequestData

public class POSTServiceRequestData
extends Object

Contains all the necessary data to add a new service request to the server. It allows to add some optional arguments through the method chaining (setters).

Author:
Santiago MunĂ­n

Constructor Summary
POSTServiceRequestData(String serviceCode, float latitude, float longitude, List<Attribute> attributes)
          Builds a POST service request data object from a lat & long location value.
POSTServiceRequestData(String serviceCode, long addressId, List<Attribute> attributes)
          Builds a POST service request data object from an address_id location value.
POSTServiceRequestData(String serviceCode, String address, List<Attribute> attributes)
          Builds a POST service request data object from an address location value.
 
Method Summary
 List<Attribute> getAttributes()
          Obtains the attributes related to the object.
 Map<String,String> getBodyRequestParameters()
          Builds a map containing all the arguments.
 POSTServiceRequestData setAccountId(long accountId)
          Sets an account_id.
 POSTServiceRequestData setAddress(String address)
          Sets an address parameter.
 POSTServiceRequestData setAddressId(long addressId)
          Sets an address_id parameter.
 POSTServiceRequestData setDescription(String description)
          Sets a description.
 POSTServiceRequestData setDeviceId(String deviceId)
          Sets a device_id.
 POSTServiceRequestData setEmail(String email)
          Sets an email.
 POSTServiceRequestData setFirstName(String firstName)
          Sets the first_name.
 POSTServiceRequestData setLastName(String lastName)
          Sets the last_name.
 POSTServiceRequestData setLatLong(float latitude, float longitude)
          Sets a (latitude, longitude) coordinates.
 POSTServiceRequestData setMediaUrl(String mediaUrl)
          Sets a media URL.
 POSTServiceRequestData setPhone(String phone)
          Sets the phone.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POSTServiceRequestData

public POSTServiceRequestData(String serviceCode,
                              float latitude,
                              float longitude,
                              List<Attribute> attributes)
Builds a POST service request data object from a lat & long location value.

Parameters:
serviceCode - Code of the service related to the request.
latitude - Latitude using the (WGS84) projection.
longitude - Longitude using the (WGS84) projection.
attributes - List of attributes.

POSTServiceRequestData

public POSTServiceRequestData(String serviceCode,
                              String address,
                              List<Attribute> attributes)
Builds a POST service request data object from an address location value.

Parameters:
serviceCode - Code of the service related to the request.
address - Human-readable address.
attributes - List of attributes.

POSTServiceRequestData

public POSTServiceRequestData(String serviceCode,
                              long addressId,
                              List<Attribute> attributes)
Builds a POST service request data object from an address_id location value.

Parameters:
serviceCode - Code of the service related to the request.
addressId - The internal address ID used by a jurisdiction's master address repository or other addressing system.
attributes - List of attributes.
Method Detail

setLatLong

public POSTServiceRequestData setLatLong(float latitude,
                                         float longitude)
Sets a (latitude, longitude) coordinates.

Parameters:
latitude - Latitude using the (WGS84) projection.
longitude - Longitude using the (WGS84) projection.
Returns:
Same instance with the new parameter added.

setAddress

public POSTServiceRequestData setAddress(String address)
Sets an address parameter.

Parameters:
address - Human-readable address.
Returns:
Same instance with the new parameter added.

setAddressId

public POSTServiceRequestData setAddressId(long addressId)
Sets an address_id parameter.

Parameters:
addressId - The internal address ID used by a jurisdiction's master address repository or other addressing system.
Returns:
Same instance with the new parameter added.

setEmail

public POSTServiceRequestData setEmail(String email)
Sets an email.

Parameters:
email - The email address of the person submitting the request. It requires a correct email syntax.
Returns:
Same instance with the new parameter added.

setDeviceId

public POSTServiceRequestData setDeviceId(String deviceId)
Sets a device_id.

Parameters:
deviceId - The unique device ID of the device submitting the request. This is usually only used for mobile devices. Android devices can use TelephonyManager.getDeviceId() and iPhones can use [UIDevice currentDevice].uniqueIdentifier.
Returns:
Same instance with the new parameter added.

setAccountId

public POSTServiceRequestData setAccountId(long accountId)
Sets an account_id.

Parameters:
accountId - The unique ID for the user account of the person submitting the request.
Returns:
Same instance with the new parameter added.

setFirstName

public POSTServiceRequestData setFirstName(String firstName)
Sets the first_name.

Parameters:
firstName - The given name of the person submitting the request.
Returns:
Same instance with the new parameter added.

setLastName

public POSTServiceRequestData setLastName(String lastName)
Sets the last_name.

Parameters:
lastName - The family name of the person submitting the request .
Returns:
Same instance with the new parameter added.

setPhone

public POSTServiceRequestData setPhone(String phone)
Sets the phone.

Parameters:
phone - The phone number of the person submitting the request.
Returns:
Same instance with the new parameter added.

setDescription

public POSTServiceRequestData setDescription(String description)
Sets a description.

Parameters:
description - A full description of the request or report being submitted. This may contain line breaks, but not HTML or code. Otherwise, this is free form text limited to 4,000 characters.
Returns:
Same instance with the new parameter added.

setMediaUrl

public POSTServiceRequestData setMediaUrl(String mediaUrl)
Sets a media URL.

Parameters:
mediaUrl - A URL to media associated with the request, eg an image.
Returns:
Same instance with the new parameter added.

getBodyRequestParameters

public Map<String,String> getBodyRequestParameters()
Builds a map containing all the arguments.

Returns:
List of pairs (key, value) with the required arguments.

getAttributes

public List<Attribute> getAttributes()
Obtains the attributes related to the object.

Returns:
A copy of the inner attribute list.


Copyright © 2013 Code for America. All Rights Reserved.