package de.fu_berlin.cdv.chasingpictures.api;

import android.content.Context;
import android.location.Location;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

import de.fu_berlin.cdv.chasingpictures.R;
import de.fu_berlin.cdv.chasingpictures.security.Access;

/**
 * @author Simon Kalt
 */
public class LocationRequest extends ApiRequest<PlacesApiResult> {

    private final Location location;

    public LocationRequest(Context context, Location location) {
        super(context, R.string.api_path_location_request);
        this.location = location;
    }

    @Override
    protected ResponseEntity<PlacesApiResult> send() {
        HttpEntity<Object> httpEntity = new HttpEntity<>(headers);

        Map<String, Double> queryParameters = new HashMap<>(2);
        queryParameters.put("latitude", location.getLatitude());
        queryParameters.put("longitude", location.getLongitude());

        return restTemplate.exchange(
                apiUri,
                HttpMethod.GET,
                httpEntity,
                PlacesApiResult.class,
                queryParameters);
    }

    public RestTemplate getRestTemplate() {
        return restTemplate;
    }
}

@@ -105,16 +105,59 @@
 ocation;
+%0Aimport android.support.annotation.NonNull;
 %0A%0Aimport
@@ -631,16 +631,28 @@
 sult%3E %7B%0A
+    @NonNull
 %0A    pri
@@ -725,16 +725,25 @@
 context,
+ @NonNull
  Locatio
@@ -930,76 +930,8 @@
 ) %7B%0A
-        HttpEntity%3CObject%3E httpEntity = new HttpEntity%3C%3E(headers);%0A%0A
     
@@ -1233,17 +1233,21 @@
         
-h
+new H
 ttpEntit
@@ -1247,16 +1247,27 @@
 tpEntity
+%3C%3E(headers)
 ,%0A      
@@ -1330,16 +1330,25 @@
 rameters
+%0A        
 );%0A    %7D
@@ -1353,23 +1353,16 @@
  %7D%0A%0A    
-public 
 RestTemp

Clean up LocationRequest