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