Projects >> open311-android >>f4e47da1ac9adf237b70c0bfab6cad1f9bb7f5d1

Chunk
Conflicting content
	 */
	public static JSONArray postServiceRequest(JSONObject data) {
		List pairs = new ArrayList();
<<<<<<< HEAD
		for (Map.Entry entry : data.entrySet()) {
			pairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
		}
		if (mJurisdiction != null) {
			pairs.add(new BasicNameValuePair(JURISDICTION, mJurisdiction));
		}
		if (mApiKey != null) {
			pairs.add(new BasicNameValuePair(API_KEY, mApiKey));
		}
		
		HttpPost  request  = new HttpPost(mBaseUrl + "/requests." + mFormat);
		JSONArray response = null;
		try {
			request.setEntity(new UrlEncodedFormEntity(pairs));
			HttpResponse r = mClient.execute(request);
			String str = EntityUtils.toString(r.getEntity());
			Log.i("Open311 EntityUtils.toString", str);
			Open311Parser oparser= new Open311Parser(mFormat);
			response = oparser.parseRequests(str);
			//response = new JSONArray(str);
=======
        if (mJurisdiction != null) {
            pairs.add(new BasicNameValuePair(JURISDICTION, mJurisdiction));
        }
        if (mApiKey != null) {
            pairs.add(new BasicNameValuePair(API_KEY, mApiKey));
        }
        
        Iteratorkeys = data.keys();
        while (keys.hasNext()) {
            String key = (String)keys.next();
            Object o;
            try {
                o = data.get(key);
                if (key.equals(MEDIA)) {
                    // TODO create an image bytestream for media
                }
                else if (o instanceof JSONArray) {
                    // MultiValueSelect
                    // TODO create entries for each of the chosen values 
                }
                else {
                    // TODO just add the value to pairs.
                }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        
		HttpPost  request  = new HttpPost(mBaseUrl + "/requests.json");
		JSONArray response = null;
		try {
			request.setEntity(new UrlEncodedFormEntity(pairs));
			HttpResponse r = getClient().execute(request);
			response = new JSONArray(EntityUtils.toString(r.getEntity()));
>>>>>>> 1f9828b9ad2e1c4034320caa75736e75d71292b5
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
Solution content
	 */
	public static JSONArray postServiceRequest(JSONObject data) {
		List pairs = new ArrayList();
        if (mJurisdiction != null) {
            pairs.add(new BasicNameValuePair(JURISDICTION, mJurisdiction));
        }
        if (mApiKey != null) {
            pairs.add(new BasicNameValuePair(API_KEY, mApiKey));
        }
        
        Iteratorkeys = data.keys();
        while (keys.hasNext()) {
            String key = (String)keys.next();
            Object o;
            try {
                o = data.get(key);
                if (key.equals(MEDIA)) {
                    // TODO create an image bytestream for media
                }
                else if (o instanceof JSONArray) {
                    // MultiValueSelect
                    // TODO create entries for each of the chosen values 
                }
                else {
                    // TODO just add the value to pairs.
                }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
       
		
		HttpPost  request  = new HttpPost(mBaseUrl + "/requests." + mFormat);
		JSONArray response = null;
		try {
			request.setEntity(new UrlEncodedFormEntity(pairs));
			HttpResponse r = getClient().execute(request);
			String str = EntityUtils.toString(r.getEntity());
			Log.i("Open311 EntityUtils.toString", str);
			Open311Parser oparser= new Open311Parser(mFormat);
			response = oparser.parseRequests(str);
			//response = new JSONArray(EntityUtils.toString(r.getEntity()));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
File
Open311.java
Developer's decision
Manual
Kind of conflict
Comment
For statement
If statement
Method invocation
Try statement
Variable
While statement