|
|
@@ -1,118 +0,0 @@
|
|
|
-package es.uv.saic.service;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collector;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import es.uv.saic.domain.Organ;
|
|
|
-import es.uv.saic.domain.OrganRepository;
|
|
|
-import es.uv.saic.dto.OrganDTO;
|
|
|
-
|
|
|
-
|
|
|
-@Service
|
|
|
-public class OrganService {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private OrganRepository organRepository;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public Organ findByID(String tlugar, Integer lugar) {
|
|
|
- return this.organRepository.findByTlugarLugar(tlugar, lugar);
|
|
|
- }
|
|
|
-
|
|
|
- public Organ findByRuct(Integer ruct) {
|
|
|
- return this.organRepository.findByRuct(ruct);
|
|
|
- }
|
|
|
-
|
|
|
- public OrganDTO findByRuctDTO(Integer ruct) {
|
|
|
- return this.organRepository.findByRuctDTO(ruct);
|
|
|
- }
|
|
|
-
|
|
|
- public boolean exists(String tlugar, Integer lugar){
|
|
|
- List<Integer> o = this.organRepository.exists(tlugar, lugar);
|
|
|
- if(o == null){
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(o.isEmpty()){
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> findAll(){
|
|
|
- return this.organRepository.findAll();
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> findCurrentCentres(){
|
|
|
- return this.organRepository.findCurrentCentres();
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> findTitulacionsByCentre(List<Integer> centres){
|
|
|
- List<Integer> titulation_ids = this.organRepository.findTitulacionsByCentre(centres);
|
|
|
- List<Organ> titulations = new ArrayList<Organ>();
|
|
|
- for(Integer id : titulation_ids) {
|
|
|
- Organ o = this.organRepository.findSupervisableByTitulacio(id);
|
|
|
- if(o != null) {
|
|
|
- titulations.add(o);
|
|
|
- }
|
|
|
- }
|
|
|
- return titulations;
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getTitulacions(){
|
|
|
- return this.organRepository.findAllTitulacions();
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getCentres(){
|
|
|
- return this.organRepository.findAllCentres();
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getActiveCentres(){
|
|
|
- return this.organRepository.findAllActiveCentres();
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getTitulacionsByCentre(Integer centre){
|
|
|
- return this.organRepository.findActiveTitulacionsByCentre(centre);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getUsuariTitulacions(String usuari){
|
|
|
- return this.organRepository.findTitulacionsByUsuari(usuari);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getUsuariCentres(String usuari){
|
|
|
- return this.organRepository.findCentresByUsuari(usuari);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getTitulacionsByCentres(List<Organ> centres){
|
|
|
- List<Integer> c_list = new ArrayList<Integer>();
|
|
|
- for(Organ o : centres) {
|
|
|
- c_list.add(o.getId().getLugar());
|
|
|
- }
|
|
|
- return this.organRepository.findAllTitulacionsByCentres(c_list);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> getTitulacionsByTypeCentre(Integer centre, Integer type){
|
|
|
- return this.organRepository.findActiveTitulacionsByTypeCentre(centre, type);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Organ> findActiveTitulacionsByCentreTambit(Integer centre, String tambit){
|
|
|
- return this.organRepository.findActiveTitulacionsByCentreTambit(centre, tambit);
|
|
|
- }
|
|
|
-
|
|
|
- public List<Integer> getEquivalents(Integer lugar, String tlugar){
|
|
|
- return this.organRepository.getEquivalents(lugar, tlugar);
|
|
|
- }
|
|
|
-
|
|
|
- public List<OrganDTO> findAllTitulacionsWithCentre() {
|
|
|
-
|
|
|
- return this.organRepository.findAllTitulacionsWithCentre()
|
|
|
- .stream().map(OrganDTO::new).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|