BicepBuddyApp/src/main/java/Matching/MatchController.java
@SuppressWarnings("unchecked")
	public static void updateMatch(Match m) {
		Master.appLogger.info(":: Match updated with id " + m.getId());
		// Create the Post JSON
		JSONObject patchMatchJSON = new JSONObject();
		patchMatchJSON.put("status", m.getStatus().ordinal());
		
		// Open the Connection
		HttpPatch request = new HttpPatch(baseUrl + m.getId());
		
		try {
			// Set headers
			request.addHeader("content-type", "application/json");
			
			// Attach Body
			StringEntity params = new StringEntity(patchMatchJSON.toJSONString());
			request.setEntity(params);
			
			// Execute the request
			HttpResponse response = httpClient.execute(request);
			
			// Get the Respose Back
			if(response.getStatusLine().getStatusCode() == 200) {
				// Success!
				System.out.println("Match Updated");
			} else {
				System.err.println("Failed to Update a Match! Maybe invalid id?");
			}
			
			
		} catch(Exception e) {
			e.printStackTrace();
		} finally {
			request.releaseConnection();
		}
		
	}
/**
	 * Update match.
	 * Update an Existing Match in the DB
	 *
	 * @param m the m
	 */
Update match.
Update an Existing Match in the DB

@param m the m
Update match . Update an Existing Match in the DB @param m the m
@SuppressWarnings("unchecked")
	public static void updateMatch(Match m) {
		Master.appLogger.info(":: Match updated with id " + m.getId());
		JSONObject patchMatchJSON = new JSONObject();
		patchMatchJSON.put("status", m.getStatus().ordinal());
		HttpPatch request = new HttpPatch(baseUrl + m.getId());
		try {
			request.addHeader("content-type", "application/json");
			StringEntity params = new StringEntity(patchMatchJSON.toJSONString());
			request.setEntity(params);
			HttpResponse response = httpClient.execute(request);
			if(response.getStatusLine().getStatusCode() == 200) {
				System.out.println("Match Updated");
			} else {
				System.err.println("Failed to Update a Match! Maybe invalid id?");
			}
		} catch(Exception e) {
			e.printStackTrace();
		} finally {
			request.releaseConnection();
		}
	}
@ SuppressWarnings ( "unchecked" ) public static void updateMatch ( Match m ) { Master . appLogger . info ( ":: Match updated with id " + m . getId ( ) ) ; JSONObject patchMatchJSON = new JSONObject ( ) ; patchMatchJSON . put ( "status" , m . getStatus ( ) . ordinal ( ) ) ; HttpPatch request = new HttpPatch ( baseUrl + m . getId ( ) ) ; try { request . addHeader ( "content-type" , "application/json" ) ; StringEntity params = new StringEntity ( patchMatchJSON . toJSONString ( ) ) ; request . setEntity ( params ) ; HttpResponse response = httpClient . execute ( request ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) == 200 ) { System . out . println ( "Match Updated" ) ; } else { System . err . println ( "Failed to Update a Match! Maybe invalid id?" ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { request . releaseConnection ( ) ; } }
Update match.
Update match .
// Create the Post JSON // Open the Connection // Set headers // Attach Body // Execute the request // Get the Respose Back // Success!