package com.ejie.m62fb.control.registroVPP;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ejie.m62fb.model.ElementoAd;
import com.ejie.m62fb.service.registroVPP.ElementoAdService;

/**
 * ElementoAdController.
 * 
XXXX
 */
@Controller
@RequestMapping(value = "/elementoAd")
public class ElementoAdController {

	private static final Logger logger = LoggerFactory
			.getLogger(ElementoAdController.class);

	@Autowired
	private ElementoAdService elementoAdService;

	/**
	 * Operacion CRUD Read. Devuelve el bean correspondiente al identificador
	 * indicado.
	 * 
	 * @param idElemReg
	 *            Integer
	 * @return elementoAd Objeto correspondiente al identificador indicado.
	 */
	@RequestMapping(value = "/{idElemReg}", method = RequestMethod.GET)
	public @ResponseBody
	ElementoAd get(@PathVariable Integer idElemReg) {
		ElementoAd elementoAd = new ElementoAd(idElemReg);
		elementoAd = this.elementoAdService.find(elementoAd);
		ElementoAdController.logger
				.info("[GET - findBy_PK] : Obtener ElementoAd por PK");
		return elementoAd;
	}
}