package com.ejie.m62fb.service;

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

import java.util.ArrayList;
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.M62fbr44s0s00;

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

@Service(value = "m62fbr44s0s00Service")
public class M62fbr44s0s00ServiceImpl implements M62fbr44s0s00Service {

	@Autowired
	private M62fbr44s0s00Dao m62fbr44s0s00Dao;

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

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

	/**
	 * Finds a single row in the M62fbr44s0s00 table.
	 * 
	 * @param m62fbr44s0s00
	 *            M62fbr44s0s00
	 * @return M62fbr44s0s00
	 */
	public M62fbr44s0s00 find(M62fbr44s0s00 m62fbr44s0s00) {
		return (M62fbr44s0s00) this.m62fbr44s0s00Dao.find(m62fbr44s0s00);
	}

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

	/**
	 * Counts rows in the M62fbr44s0s00 table.
	 * 
	 * @param m62fbr44s0s00
	 *            M62fbr44s0s00
	 * @return Long
	 */
	public Long findAllCount(M62fbr44s0s00 m62fbr44s0s00) {
		return this.m62fbr44s0s00Dao.findAllCount(m62fbr44s0s00);
	}

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

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

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

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

	/**
	 * Actualiza una lista de incidencias de la tabla Incidencias, los campos
	 * que no se hayan informado nulos
	 * 
	 * @param viviendasList
	 *            ArrayList
	 * @return
	 */
	@Transactional(rollbackFor = Throwable.class)
	public void addIncMasivaViv(ArrayList<M62fbr44s0s00> viviendasList) {
		for (M62fbr44s0s00 viviendasAux : viviendasList) {
			this.m62fbr44s0s00Dao.addIncMasivaViv(viviendasAux);
		}
	}

	/**
	 * Counts rows in the valViviendasSel.
	 * 
	 * @param listadoVivs
	 *            String
	 * @return Long
	 */
	public Long valViviendasSel(String listadoVivs) {
		return this.m62fbr44s0s00Dao.valViviendasSel(listadoVivs);
	}

}
