package com.ejie.ab04b.service;

import com.ejie.ab04b.dao.RequerimientoAperturasDao;
import com.ejie.x38.dto.JQGridRequestDto;
import com.ejie.x38.dto.JQGridResponseDto;
import com.ejie.x38.dto.TableRowDto;
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.ab04b.model.RequerimientoAperturas;

/**
 * Ab0458s00ServiceImpl generated by UDA, 31-may-2017 9:30:50.
 * 
 * @author UDA
 */

@Service(value = "requerimientoAperturasServiceImpl")
public class RequerimientoAperturasServiceImpl implements
		RequerimientoAperturasService {

	@Autowired
	private RequerimientoAperturasDao ab0458s00Dao;

	/**
	 * Inserts a single row in the Ab0458s00 table.
	 * 
	 * ab0458s00 Ab0458s00 Ab0458s00
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 * @return the requerimiento aperturas
	 */
	@Transactional(rollbackFor = Throwable.class)
	public RequerimientoAperturas add(RequerimientoAperturas ab0458s00) {
		return this.ab0458s00Dao.add(ab0458s00);
	}

	/**
	 * Updates a single row in the Ab0458s00 table.
	 * 
	 * ab0458s00 Ab0458s00 Ab0458s00
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 * @return the requerimiento aperturas
	 */
	@Transactional(rollbackFor = Throwable.class)
	public RequerimientoAperturas update(RequerimientoAperturas ab0458s00) {
		return this.ab0458s00Dao.update(ab0458s00);
	}

	/**
	 * Finds a single row in the Ab0458s00 table.
	 * 
	 * ab0458s00 Ab0458s00 Ab0458s00
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 * @return the requerimiento aperturas
	 */
	public RequerimientoAperturas find(RequerimientoAperturas ab0458s00) {
		return (RequerimientoAperturas) this.ab0458s00Dao.find(ab0458s00);
	}

	/**
	 * Deletes a single row in the Ab0458s00 table.
	 * 
	 * ab0458s00 Ab0458s00
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 */
	@Transactional(rollbackFor = Throwable.class)
	public void remove(RequerimientoAperturas ab0458s00) {
		this.ab0458s00Dao.remove(ab0458s00);
	}

	/**
	 * Finds a list of rows in the Ab0458s00 table.
	 * 
	 * ab0458s00 Ab0458s00 jqGridRequestDto JQGridRequestDto List<Ab0458s00>
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @return the list
	 */
	public List<RequerimientoAperturas> findAll(
			RequerimientoAperturas ab0458s00, JQGridRequestDto jqGridRequestDto) {
		return (List<RequerimientoAperturas>) this.ab0458s00Dao.findAll(
				ab0458s00, jqGridRequestDto);
	}

	/**
	 * Finds rows in the Ab0458s00 table using like.
	 * 
	 * ab0458s00 Ab0458s00 jqGridRequestDto JQGridRequestDto startsWith Boolean
	 * List<Ab0458s00>
	 * 
	 * @param ab0458s00
	 *            the ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @param startsWith
	 *            the starts with
	 * @return the list
	 */
	public List<RequerimientoAperturas> findAllLike(
			RequerimientoAperturas ab0458s00,
			JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		return (List<RequerimientoAperturas>) this.ab0458s00Dao.findAllLike(
				ab0458s00, jqGridRequestDto, startsWith);
	}

	/*
	 * OPERACIONES RUP_TABLE
	 */

	/**
	 * Removes rows from the Ab0458s00 table.
	 * 
	 * filterAb0458s00 Ab0458s00 jqGridRequestDto JQGridRequestDto startsWith
	 * Boolean
	 * 
	 * @param filterAb0458s00
	 *            the filter ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @param startsWith
	 *            the starts with
	 */
	public void removeMultiple(RequerimientoAperturas filterAb0458s00,
			JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		this.ab0458s00Dao.removeMultiple(filterAb0458s00, jqGridRequestDto,
				startsWith);
	}

	/**
	 * Filter method in the Ab0458s00 table.
	 * 
	 * filterAb0458s00 Ab0458s00 jqGridRequestDto JQGridRequestDto startsWith
	 * Boolean JQGridResponseDto<Ab0458s00>
	 * 
	 * @param filterAb0458s00
	 *            the filter ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @param startsWith
	 *            the starts with
	 * @return the JQ grid response dto
	 */
	public JQGridResponseDto<RequerimientoAperturas> filter(
			RequerimientoAperturas filterAb0458s00,
			JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		List<RequerimientoAperturas> listaAb0458s00 = this.ab0458s00Dao
				.findAllLike(filterAb0458s00, jqGridRequestDto, false);
		Long recordNum = this.ab0458s00Dao.findAllLikeCount(
				filterAb0458s00 != null ? filterAb0458s00
						: new RequerimientoAperturas(), false);
		if (jqGridRequestDto.getMultiselection().getSelectedIds() != null) {
			List<TableRowDto<RequerimientoAperturas>> reorderSelection = this.ab0458s00Dao
					.reorderSelection(filterAb0458s00, jqGridRequestDto,
							startsWith);
			return new JQGridResponseDto<RequerimientoAperturas>(
					jqGridRequestDto, recordNum, listaAb0458s00,
					reorderSelection);
		}
		return new JQGridResponseDto<RequerimientoAperturas>(jqGridRequestDto,
				recordNum, listaAb0458s00);
	}

	/**
	 * Searches rows in the Ab0458s00 table.
	 * 
	 * filterAb0458s00 Ab0458s00 searchAb0458s00 Ab0458s00 jqGridRequestDto
	 * JQGridRequestDto startsWith Boolean List<TableRowDto<Ab0458s00>>
	 * 
	 * @param filterAb0458s00
	 *            the filter ab 0458 s 00
	 * @param searchAb0458s00
	 *            the search ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @param startsWith
	 *            the starts with
	 * @return the list
	 */
	public List<TableRowDto<RequerimientoAperturas>> search(
			RequerimientoAperturas filterAb0458s00,
			RequerimientoAperturas searchAb0458s00,
			JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		return this.ab0458s00Dao.search(filterAb0458s00, searchAb0458s00,
				jqGridRequestDto, startsWith);
	}

	/**
	 * Reorder the selection made in Ab0458s00 table.
	 * 
	 * filterAb0458s00 Ab0458s00 jqGridRequestDto JQGridRequestDto startsWith
	 * Boolean Object
	 * 
	 * @param filterAb0458s00
	 *            the filter ab 0458 s 00
	 * @param jqGridRequestDto
	 *            the jq grid request dto
	 * @param startsWith
	 *            the starts with
	 * @return the object
	 */
	public Object reorderSelection(RequerimientoAperturas filterAb0458s00,
			JQGridRequestDto jqGridRequestDto, Boolean startsWith) {
		return this.ab0458s00Dao.reorderSelection(filterAb0458s00,
				jqGridRequestDto, startsWith);
	}

	/**
	 * removePorTarea
	 * 
	 * @param idTarea
	 *            Long
	 */
	@Override
	public void removePorTarea(Long idTarea) {
		this.ab0458s00Dao.removePorTarea(idTarea);
	}

}
