package es.uv.saic.service;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import es.uv.saic.domain.Datasource;
import es.uv.saic.domain.DatasourceRepository;

@Service
public class DatasourceService {

    @Autowired
	private DatasourceRepository dr;

    public List<Datasource> findAll(){
        return dr.findAll();
    }

    public Datasource findById(Integer id){
        Optional<Datasource> d = this.dr.findById(id);
        if(d.isPresent()){
            return d.get();
        }
        return null;
    }

}
