AddressController.java
@PostMapping("/")
	@ApiOperation(value = "Inserts a new address into the database", response = Address.class)
	@ApiResponses(value = {
			@ApiResponse(code = 200, message = "The new address"),
			@ApiResponse(code = 400, message = "Address already exists"),
			@ApiResponse(code = 500, message = "Backend error")})
	public ResponseEntity insertAddress(@RequestBody Address address) {
		try {
			BackendHelper helper = new BackendHelper();
			boolean exists = helper.exisits(conn, address);
			if(!exists) {
				Address newAddress = addressHelper.insert(conn, address); //Inserts a new address
				if(newAddress.equals(address)) { //Makes sure the user passed address and the returned address are the same
					return new ResponseEntity<Address>(newAddress, HttpStatus.OK); //Returns the new address
				}else {
					throw new AddressException(HttpStatus.INTERNAL_SERVER_ERROR, bundle.getString("address_not_created"));
				}
			}else {
				throw new AddressException(HttpStatus.BAD_REQUEST, bundle.getString("address_exists"));
			}
		}catch(AddressException e) {
			e.printStackTrace();
			return new ResponseEntity<String>(e.getMessage(), e.getHttp());
		}
	}
/**
	 * Inserts a new address into the database
	 * @param address New address to be added
	 * @return New address added
	 */
Inserts a new address into the database
@param address New address to be added
@return New address added
Inserts a new address into the database @param address New address to be added @return New address added
@PostMapping("/")
	@ApiOperation(value = "Inserts a new address into the database", response = Address.class)
	@ApiResponses(value = {
			@ApiResponse(code = 200, message = "The new address"),
			@ApiResponse(code = 400, message = "Address already exists"),
			@ApiResponse(code = 500, message = "Backend error")})
	public ResponseEntity insertAddress(@RequestBody Address address) {
		try {
			BackendHelper helper = new BackendHelper();
			boolean exists = helper.exisits(conn, address);
			if(!exists) {
				Address newAddress = addressHelper.insert(conn, address); 
				if(newAddress.equals(address)) { 
					return new ResponseEntity<Address>(newAddress, HttpStatus.OK); 
				}else {
					throw new AddressException(HttpStatus.INTERNAL_SERVER_ERROR, bundle.getString("address_not_created"));
				}
			}else {
				throw new AddressException(HttpStatus.BAD_REQUEST, bundle.getString("address_exists"));
			}
		}catch(AddressException e) {
			e.printStackTrace();
			return new ResponseEntity<String>(e.getMessage(), e.getHttp());
		}
	}
@ PostMapping ( "/" ) @ ApiOperation ( value = "Inserts a new address into the database" , response = Address . class ) @ ApiResponses ( value = { @ ApiResponse ( code = 200 , message = "The new address" ) , @ ApiResponse ( code = 400 , message = "Address already exists" ) , @ ApiResponse ( code = 500 , message = "Backend error" ) } ) public ResponseEntity insertAddress ( @ RequestBody Address address ) { try { BackendHelper helper = new BackendHelper ( ) ; boolean exists = helper . exisits ( conn , address ) ; if ( ! exists ) { Address newAddress = addressHelper . insert ( conn , address ) ; if ( newAddress . equals ( address ) ) { return new ResponseEntity < Address > ( newAddress , HttpStatus . OK ) ; } else { throw new AddressException ( HttpStatus . INTERNAL_SERVER_ERROR , bundle . getString ( "address_not_created" ) ) ; } } else { throw new AddressException ( HttpStatus . BAD_REQUEST , bundle . getString ( "address_exists" ) ) ; } } catch ( AddressException e ) { e . printStackTrace ( ) ; return new ResponseEntity < String > ( e . getMessage ( ) , e . getHttp ( ) ) ; } }
Inserts a new address into the database
 @param address New address to be added
 @return New address added
Inserts a new address into the database @param address New address to be added @return New address added
//Inserts a new address //Makes sure the user passed address and the returned address are the same //Returns the new address