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