<commit_before>package br.com.erudio.entrypoint.v1;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;

import br.com.erudio.model.City;
import br.com.erudio.repository.interfaces.ICityRepository;

@Controller
@Secured("ROLE_USER")
@Api(value = "city", description = "Exposes endpoints of service City.")
@RequestMapping("/api/v1/city")
class CityEntryPoint {

	@Autowired
    private ICityRepository cityRepository;
    
	@RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "POST", value = "Saving a city")
	public @ResponseBody City save(@RequestBody City city) {
		return cityRepository.save(city);
	}

	@RequestMapping(method = RequestMethod.PUT)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "PUT", value = "Updating a city")
	public @ResponseBody City update(@RequestBody City city) {
		return cityRepository.update(city);
	}
    
	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "DELETE", value = "Deleting a city by id")
    public @ResponseBody ResponseEntity<Void> delete(@PathVariable Integer id) {
		cityRepository.deleteById(id);
		return new ResponseEntity<Void>(HttpStatus.OK);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	@ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find a city by id")
	public @ResponseBody City findById(@PathVariable Integer id) {
		return cityRepository.findById(id);
	}
	
	@RequestMapping(value = "/findByName/{name}", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find a city by name")
    public @ResponseBody City findCityByName(@PathVariable String name) {
        return cityRepository.findByName(name);
    }
    
	@RequestMapping(value = "/findAll", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find all cities")
    public @ResponseBody List<City> findAll() {
        return cityRepository.findAll();
    }
}<commit_msg>Adding parser VO to Entity for CityEntryPoint<commit_after>package br.com.erudio.entrypoint.v1;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;

import br.com.erudio.converter.ObjectParser;
import br.com.erudio.model.City;
import br.com.erudio.repository.interfaces.ICityRepository;
import br.com.erudio.vo.CityVO;

@Controller
@Secured("ROLE_USER")
@Api(value = "city", description = "Exposes endpoints of service City.")
@RequestMapping("/api/v1/city")
class CityEntryPoint {

	@Autowired
    private ICityRepository cityRepository;
    
	@RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "POST", value = "Saving a city")
	public @ResponseBody CityVO save(@RequestBody CityVO city) {
		City savedCity = cityRepository.save(ObjectParser.parseObjectInputToObjectOutput(city, City.class));
		return ObjectParser.parseObjectInputToObjectOutput(savedCity, CityVO.class);
	}

	@RequestMapping(method = RequestMethod.PUT)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "PUT", value = "Updating a city")
	public @ResponseBody CityVO update(@RequestBody CityVO city) {
		City updatedCity = cityRepository.update(ObjectParser.parseObjectInputToObjectOutput(city, City.class));
		return ObjectParser.parseObjectInputToObjectOutput(updatedCity, CityVO.class);
	}
    
	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "DELETE", value = "Deleting a city by id")
    public @ResponseBody ResponseEntity<Void> delete(@PathVariable Integer id) {
		cityRepository.deleteById(id);
		return new ResponseEntity<Void>(HttpStatus.OK);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	@ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find a city by id")
	public @ResponseBody CityVO findById(@PathVariable Integer id) {
		City city = cityRepository.findById(id);
		return ObjectParser.parseObjectInputToObjectOutput(city, CityVO.class);
	}
	
	@RequestMapping(value = "/findByName/{name}", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find a city by name")
    public @ResponseBody CityVO findCityVOByName(@PathVariable String name) {
        City city = cityRepository.findByName(name);
		return ObjectParser.parseObjectInputToObjectOutput(city, CityVO.class);
    }
    
	@RequestMapping(value = "/findAll", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.OK)
	@ApiOperation(httpMethod = "GET", value = "Find all cities")
    public @ResponseBody List<CityVO> findAll() {
        List<City> allCities = cityRepository.findAll();
		return ObjectParser.parserListObjectInputToObjectOutput(allCities, CityVO.class);
    }
}
{'fraction_non_alphanumeric': 0.11455884657577182, 'fraction_numerical': 0.0006268609935746748, 'mean_word_length': 5.832976445396145, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '827048', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1848, 'n_words': 378}