package com.ejie.m62fb.service.registroVPP;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;

import com.ejie.m62fb.dao.registroVPP.PromocionDao;
import com.ejie.m62fb.model.Promocion;
import com.ejie.m62fb.model.direccion.Direccion;
import com.ejie.x38.dto.JQGridRequestDto;
import com.ejie.x38.dto.Pagination;

import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * PromocionServiceImpl generated by UDA, 24-oct-2012 16:55:00.
 * 
XXXX
 */

@Service(value = "promocionService")
public class PromocionServiceImpl implements PromocionService {

	@Autowired
	private PromocionDao promocionDao;

	/**
	 * Finds a single row in the Promocion table.
	 * 
	 * @param promocion
	 *            Promocion
	 * @return Promocion
	 */
@PreAuthorize("hasPermission('PROMOCION_SERVICE','SecureService','read')")
	public Promocion find(Promocion promocion) {
		return (Promocion) this.promocionDao.find(promocion);
	}

	/**
	 * Finds rows in the Promocion table using like.
	 * 
	 * @param promocion
	 *            Promocion
	 * @param pagination
	 *            Pagination
	 * @param startsWith
	 *            Boolean
	 * @return List
	 */
@PreAuthorize("hasPermission('PROMOCION_SERVICE','SecureService','read')")
	public List<Promocion> findAllLike(Promocion promocion
			, JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		return (List<Promocion>) this.promocionDao.findAllLike(
				promocion, jqGridRequestDto, startsWith);
	}
	public List<Promocion> buscarPromocionPorExpedYEmplazamiento(Promocion promocion,
			Direccion direccion) throws SQLException{
		return (List<Promocion>) this.promocionDao.buscarPromocionPorExpedYEmplazamiento(
				promocion,direccion );
	}
}
