package com.ejie.ab04b.service;
import com.ejie.ab04b.dao.VosalanOs4Os6Dao;
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.VosalanOs4Os6;

/**
 * VosalanOs4Os6ServiceImpl generated by UDA, 16-jun-2017 13:27:17.
 * @author UDA
 */

@Service(value = "vosalanOs4Os6Service")
public class VosalanOs4Os6ServiceImpl implements VosalanOs4Os6Service {

	@Autowired
	private VosalanOs4Os6Dao vosalanOs4Os6Dao;

	/**
	 * Inserts a single row in the VosalanOs4Os6 table.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *  VosalanOs4Os6
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 * @return the vosalan os 4 os 6
	 */
	@Transactional(rollbackFor = Throwable.class)
	public VosalanOs4Os6 add(VosalanOs4Os6 vosalanOs4Os6) {
		return this.vosalanOs4Os6Dao.add(vosalanOs4Os6);
	}

	/**
	 * Updates a single row in the VosalanOs4Os6 table.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *  VosalanOs4Os6
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 * @return the vosalan os 4 os 6
	 */
	@Transactional(rollbackFor = Throwable.class)
	public VosalanOs4Os6 update(VosalanOs4Os6 vosalanOs4Os6) {
		return this.vosalanOs4Os6Dao.update(vosalanOs4Os6);
	 }

	/**
	 * Finds a single row in the VosalanOs4Os6 table.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *  VosalanOs4Os6
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 * @return the vosalan os 4 os 6
	 */
	public VosalanOs4Os6 find(VosalanOs4Os6 vosalanOs4Os6) {
		return (VosalanOs4Os6) this.vosalanOs4Os6Dao.find(vosalanOs4Os6);
	}
	
	/**
	 * Deletes a single row in the VosalanOs4Os6 table.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 */
	@Transactional(rollbackFor = Throwable.class)
	public void remove(VosalanOs4Os6 vosalanOs4Os6) {
		this.vosalanOs4Os6Dao.remove(vosalanOs4Os6);
	}

	/**
	 * Finds a list of rows in the VosalanOs4Os6 table.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *  jqGridRequestDto JQGridRequestDto
	 *  List<VosalanOs4Os6>
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 * @param jqGridRequestDto the jq grid request dto
	 * @return the list
	 */
	public List<VosalanOs4Os6> findAll(VosalanOs4Os6 vosalanOs4Os6, JQGridRequestDto jqGridRequestDto){
		return (List<VosalanOs4Os6>) this.vosalanOs4Os6Dao.findAll(vosalanOs4Os6, jqGridRequestDto);
	}
    
	/**
	 * Finds rows in the VosalanOs4Os6 table using like.
	 * 
	 *  vosalanOs4Os6 VosalanOs4Os6
	 *  jqGridRequestDto JQGridRequestDto
	 *  startsWith Boolean	 
	 *  List<VosalanOs4Os6>
	 *
	 * @param vosalanOs4Os6 the vosalan os 4 os 6
	 * @param jqGridRequestDto the jq grid request dto
	 * @param startsWith the starts with
	 * @return the list
	 */
	public List<VosalanOs4Os6> findAllLike(VosalanOs4Os6 vosalanOs4Os6, JQGridRequestDto jqGridRequestDto, Boolean startsWith){
		return (List<VosalanOs4Os6>) this.vosalanOs4Os6Dao.findAllLike(vosalanOs4Os6, jqGridRequestDto, startsWith);
	}

	/*
	 * OPERACIONES RUP_TABLE
	 */
	 
	/**
	 * Removes rows from the VosalanOs4Os6 table.
	 * 
	 *  filterVosalanOs4Os6 VosalanOs4Os6
	 *  jqGridRequestDto JQGridRequestDto
	 *  startsWith Boolean
	 *
	 * @param filterVosalanOs4Os6 the filter vosalan os 4 os 6
	 * @param jqGridRequestDto the jq grid request dto
	 * @param startsWith the starts with
	 */	
	public void removeMultiple(VosalanOs4Os6 filterVosalanOs4Os6, JQGridRequestDto jqGridRequestDto,  Boolean startsWith){
		this.vosalanOs4Os6Dao.removeMultiple(filterVosalanOs4Os6, jqGridRequestDto, startsWith);
	}
        
	/**
	 * Filter method in the VosalanOs4Os6 table.
	 * 
	 *  filterVosalanOs4Os6 VosalanOs4Os6
	 *  jqGridRequestDto JQGridRequestDto
	 *  startsWith Boolean
	 *  JQGridResponseDto<VosalanOs4Os6>
	 *
	 * @param filterVosalanOs4Os6 the filter vosalan os 4 os 6
	 * @param jqGridRequestDto the jq grid request dto
	 * @param startsWith the starts with
	 * @return the JQ grid response dto
	 */	
	public JQGridResponseDto< VosalanOs4Os6> filter(VosalanOs4Os6 filterVosalanOs4Os6, JQGridRequestDto jqGridRequestDto,  Boolean startsWith){
		List<VosalanOs4Os6> listaVosalanOs4Os6 =  this.vosalanOs4Os6Dao.findAllLike(filterVosalanOs4Os6, jqGridRequestDto, false);
		Long recordNum =  this.vosalanOs4Os6Dao.findAllLikeCount(filterVosalanOs4Os6 != null ? filterVosalanOs4Os6: new VosalanOs4Os6 (),false);
		if (jqGridRequestDto.getMultiselection().getSelectedIds()!=null){
			List< TableRowDto< VosalanOs4Os6>> reorderSelection = this.vosalanOs4Os6Dao.reorderSelection(filterVosalanOs4Os6, jqGridRequestDto, startsWith);
			return new JQGridResponseDto<VosalanOs4Os6>(jqGridRequestDto, recordNum, listaVosalanOs4Os6, reorderSelection);
		}
		return new JQGridResponseDto<VosalanOs4Os6>(jqGridRequestDto, recordNum, listaVosalanOs4Os6);   
	}
    
    /**
     * Searches rows in the VosalanOs4Os6 table.
     * 
     *  filterVosalanOs4Os6 VosalanOs4Os6
     *  searchVosalanOs4Os6 VosalanOs4Os6
     *  jqGridRequestDto JQGridRequestDto
     *  startsWith Boolean
     *  List<TableRowDto<VosalanOs4Os6>>
     *
     * @param filterVosalanOs4Os6 the filter vosalan os 4 os 6
     * @param searchVosalanOs4Os6 the search vosalan os 4 os 6
     * @param jqGridRequestDto the jq grid request dto
     * @param startsWith the starts with
     * @return the list
     */	
    public List< TableRowDto< VosalanOs4Os6>> search(VosalanOs4Os6 filterVosalanOs4Os6, VosalanOs4Os6 searchVosalanOs4Os6, JQGridRequestDto jqGridRequestDto, Boolean startsWith){
		return this.vosalanOs4Os6Dao.search(filterVosalanOs4Os6, searchVosalanOs4Os6, jqGridRequestDto, startsWith);
	}
    
    /**
     * Reorder the selection made in VosalanOs4Os6 table.
     * 
     *  filterVosalanOs4Os6 VosalanOs4Os6
     *  jqGridRequestDto JQGridRequestDto
     *  startsWith Boolean
     *  Object
     *
     * @param filterVosalanOs4Os6 the filter vosalan os 4 os 6
     * @param jqGridRequestDto the jq grid request dto
     * @param startsWith the starts with
     * @return the object
     */	
    public Object reorderSelection(VosalanOs4Os6 filterVosalanOs4Os6, JQGridRequestDto jqGridRequestDto, Boolean startsWith){
		return this.vosalanOs4Os6Dao.reorderSelection(filterVosalanOs4Os6, jqGridRequestDto, startsWith);
	}
       
}

