package com.ejie.m62fb.service;

import com.ejie.m62fb.dao.M62fbr45s0s00Dao;
import com.ejie.x38.dto.Pagination;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ejie.m62fb.model.M62fbr45s0s00;

/**
 * M62fbr45s0s00ServiceImpl generated by UDA, 17-oct-2012 15:03:38.
 * 
XXXX
 */

@Service(value = "m62fbr45s0s00Service")
public class M62fbr45s0s00ServiceImpl implements M62fbr45s0s00Service {

	@Autowired
	private M62fbr45s0s00Dao m62fbr45s0s00Dao;

	/**
	 * Inserts a single row in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @return M62fbr45s0s00
	 */
	@Transactional(rollbackFor = Throwable.class)
	public M62fbr45s0s00 add(M62fbr45s0s00 m62fbr45s0s00) {
		return this.m62fbr45s0s00Dao.add(m62fbr45s0s00);
	}

	/**
	 * Updates a single row in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @return M62fbr45s0s00
	 */
	@Transactional(rollbackFor = Throwable.class)
	public M62fbr45s0s00 update(M62fbr45s0s00 m62fbr45s0s00) {
		return this.m62fbr45s0s00Dao.update(m62fbr45s0s00);
	}

	/**
	 * Finds a single row in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @return M62fbr45s0s00
	 */
	public M62fbr45s0s00 find(M62fbr45s0s00 m62fbr45s0s00) {
		return (M62fbr45s0s00) this.m62fbr45s0s00Dao.find(m62fbr45s0s00);
	}

	/**
	 * Finds a List of rows in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @param pagination
	 *            Pagination
	 * @return List
	 */
	public List<M62fbr45s0s00> findAll(M62fbr45s0s00 m62fbr45s0s00,
			Pagination pagination) {
		return (List<M62fbr45s0s00>) this.m62fbr45s0s00Dao.findAll(
				m62fbr45s0s00, pagination);
	}

	/**
	 * Counts rows in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @return Long
	 */
	public Long findAllCount(M62fbr45s0s00 m62fbr45s0s00) {
		return this.m62fbr45s0s00Dao.findAllCount(m62fbr45s0s00);
	}

	/**
	 * Finds rows in the M62fbr45s0s00 table using like.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @param pagination
	 *            Pagination
	 * @param startsWith
	 *            Boolean
	 * @return List
	 */
	public List<M62fbr45s0s00> findAllLike(M62fbr45s0s00 m62fbr45s0s00,
			Pagination pagination, Boolean startsWith) {
		return (List<M62fbr45s0s00>) this.m62fbr45s0s00Dao.findAllLike(
				m62fbr45s0s00, pagination, startsWith);
	}

	/**
	 * Counts rows in the M62fbr45s0s00 table using like.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @param startsWith
	 *            Boolean
	 * @return Long
	 */
	public Long findAllLikeCount(M62fbr45s0s00 m62fbr45s0s00, Boolean startsWith) {
		return this.m62fbr45s0s00Dao
				.findAllLikeCount(m62fbr45s0s00, startsWith);
	}

	/**
	 * Deletes a single row in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00
	 *            M62fbr45s0s00
	 * @return
	 */
	@Transactional(rollbackFor = Throwable.class)
	public void remove(M62fbr45s0s00 m62fbr45s0s00) {
		this.m62fbr45s0s00Dao.remove(m62fbr45s0s00);
	}

	/**
	 * Deletes multiple rows in the M62fbr45s0s00 table.
	 * 
	 * @param m62fbr45s0s00List
	 *            List
	 * @return
	 */
	@Transactional(rollbackFor = Throwable.class)
	public void removeMultiple(List<M62fbr45s0s00> m62fbr45s0s00List) {
		for (M62fbr45s0s00 m62fbr45s0s00Aux : m62fbr45s0s00List) {
			this.m62fbr45s0s00Dao.remove(m62fbr45s0s00Aux);
		}
	}

	/**
	 * Finds rows in the r45t0 table using like.
	 * 
	 * @param idM62r45t0_search
	 *            BigDecimal
	 * @param idPersona_search
	 *            BigDecimal
	 * @param codSitOferta_search
	 *            String
	 * @param fecOfertaDesde_search
	 *            Date
	 * @param fecOfertaHasta_search
	 *            Date
	 * @param fecFinalizacionDesde_search
	 *            Date
	 * @param fecFinalizacionHasta_search
	 *            Date
	 * @param fecDeclinacionDesde_search
	 *            Date
	 * @param fecDeclinacionHasta_search
	 *            Date
	 * @param fecAceptacionDesde_search
	 *            Date
	 * @param fecAceptacionHasta_search
	 *            Date
	 * @param pagination
	 *            Pagination
	 * @return List
	 */
	public List<M62fbr45s0s00> findAllPersonalizado(BigDecimal idR45,
			BigDecimal idPersona, String codSitOferta, Date fecOfertaDesde,
			Date fecOfertaHasta, Date fecFinalizacionDesde,
			Date fecFinalizacionHasta, Date fecDeclinacionDesde,
			Date fecDeclinacionHasta, Date fecAceptacionDesde,
			Date fecAceptacionHasta, Pagination pagination) {
		return (List<M62fbr45s0s00>) this.m62fbr45s0s00Dao
				.findAllPersonalizado(idR45, idPersona, codSitOferta,
						fecOfertaDesde, fecOfertaHasta, fecFinalizacionDesde,
						fecFinalizacionHasta, fecDeclinacionDesde,
						fecDeclinacionHasta, fecAceptacionDesde,
						fecAceptacionHasta, pagination);
	}

	/**
	 * Counts rows in the r45t0 .
	 * 
	 * @param idM62r45t0_search
	 *            Long
	 * @param idPersona_search
	 *            Long
	 * @param codSitOferta_search
	 *            String
	 * @param fecOfertaDesde_search
	 *            Date
	 * @param fecOfertaHasta_search
	 *            Date
	 * @param fecFinalizacionDesde_search
	 *            Date
	 * @param fecFinalizacionHasta_search
	 *            Date
	 * @param fecDeclinacionDesde_search
	 *            Date
	 * @param fecDeclinacionHasta_search
	 *            Date
	 * @param fecAceptacionDesde_search
	 *            Date
	 * @param fecAceptacionHasta_search
	 *            Date
	 * @return Long
	 */
	public Long findAllPersonalizadoCount(BigDecimal idR45,
			BigDecimal idPersona, String codSitOferta, Date fecOfertaDesde,
			Date fecOfertaHasta, Date fecFinalizacionDesde,
			Date fecFinalizacionHasta, Date fecDeclinacionDesde,
			Date fecDeclinacionHasta, Date fecAceptacionDesde,
			Date fecAceptacionHasta) {
		return (Long) this.m62fbr45s0s00Dao.findAllPersonalizadoCount(idR45,
				idPersona, codSitOferta, fecOfertaDesde, fecOfertaHasta,
				fecFinalizacionDesde, fecFinalizacionHasta,
				fecDeclinacionDesde, fecDeclinacionHasta, fecAceptacionDesde,
				fecAceptacionHasta);
	}

	/**
	 * Devuelve la descripción del adjudicatario.
	 * 
	 * @param idPersona
	 *            String
	 * @return
	 */
	public String getDescAdjudicatario(BigDecimal idPersona) {
		return (String) this.m62fbr45s0s00Dao.getDescAdjudicatario(idPersona);
	}

}
