DriverRegistroServiziDB_scopeDriver.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */



  20. package org.openspcoop2.core.registry.driver.db;

  21. import java.sql.Connection;
  22. import java.sql.Date;
  23. import java.sql.PreparedStatement;
  24. import java.sql.ResultSet;
  25. import java.sql.SQLException;
  26. import java.sql.Timestamp;
  27. import java.util.ArrayList;
  28. import java.util.List;

  29. import org.apache.commons.lang.StringUtils;
  30. import org.openspcoop2.core.commons.Filtri;
  31. import org.openspcoop2.core.commons.ISearch;
  32. import org.openspcoop2.core.commons.Liste;
  33. import org.openspcoop2.core.commons.SearchUtils;
  34. import org.openspcoop2.core.constants.CostantiDB;
  35. import org.openspcoop2.core.constants.TipoPdD;
  36. import org.openspcoop2.core.id.IDFruizione;
  37. import org.openspcoop2.core.id.IDScope;
  38. import org.openspcoop2.core.id.IDServizio;
  39. import org.openspcoop2.core.registry.Scope;
  40. import org.openspcoop2.core.registry.constants.ScopeContesto;
  41. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  42. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  43. import org.openspcoop2.core.registry.driver.FiltroRicercaScope;
  44. import org.openspcoop2.utils.jdbc.JDBCUtilities;
  45. import org.openspcoop2.utils.sql.ISQLQueryObject;
  46. import org.openspcoop2.utils.sql.SQLObjectFactory;

  47. /**
  48.  * DriverRegistroServiziDB_scopeDriver
  49.  *
  50.  *
  51.  * @author Sandra Giangrandi (sandra@link.it)
  52.  * @author Stefano Corallo (corallo@link.it)
  53.  * @author $Author$
  54.  * @version $Rev$, $Date$
  55.  */
  56. public class DriverRegistroServiziDB_scopeDriver {

  57.     private DriverRegistroServiziDB driver = null;
  58.    
  59.     protected DriverRegistroServiziDB_scopeDriver(DriverRegistroServiziDB driver) {
  60.         this.driver = driver;
  61.     }
  62.    
  63.     protected Scope getScope(
  64.             IDScope idScope) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{

  65.         this.driver.logDebug("richiesto getScope: " + idScope);
  66.         // conrollo consistenza
  67.         if (idScope == null)
  68.             throw new DriverRegistroServiziException("[getScope] Parametro idScope is null");
  69.         if (idScope.getNome()==null || idScope.getNome().trim().equals(""))
  70.             throw new DriverRegistroServiziException("[getScope] Parametro idScope.nome non e' definito");

  71.         Connection con = null;
  72.         PreparedStatement stm = null;
  73.         ResultSet rs = null;

  74.         if (this.driver.atomica) {
  75.             try {
  76.                 con = this.driver.getConnectionFromDatasource("getScope(nome)");

  77.             } catch (Exception e) {
  78.                 throw new DriverRegistroServiziException("DriverRegistroServiziDB::getScope] Exception accedendo al datasource :" + e.getMessage(),e);

  79.             }

  80.         } else
  81.             con = this.driver.globalConnection;

  82.         this.driver.logDebug("operazione atomica = " + this.driver.atomica);

  83.         try {

  84.             ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  85.             sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  86.             sqlQueryObject.addSelectField("*");
  87.             sqlQueryObject.addWhereCondition("nome = ?");
  88.             String queryString = sqlQueryObject
  89.                     .createSQLQuery();
  90.             stm = con.prepareStatement(queryString);
  91.             stm.setString(1, idScope.getNome());
  92.             rs = stm.executeQuery();
  93.             Scope scope = null;
  94.             if (rs.next()) {
  95.                 scope = new Scope();
  96.                 scope.setId(rs.getLong("id"));
  97.                 scope.setNome(rs.getString("nome"));
  98.                 scope.setDescrizione(rs.getString("descrizione"));
  99.                 String tipologia = rs.getString("tipologia");
  100.                 if(tipologia!=null){
  101.                     scope.setTipologia(tipologia);
  102.                 }
  103.                 scope.setNomeEsterno(rs.getString("nome_esterno"));
  104.                 String contestoUtilizzo = rs.getString("contesto_utilizzo");
  105.                 if(contestoUtilizzo!=null){
  106.                     scope.setContestoUtilizzo(ScopeContesto.toEnumConstant(contestoUtilizzo));
  107.                 }
  108.                 scope.setSuperUser(rs.getString("superuser"));

  109.                 // Ora Registrazione
  110.                 if(rs.getTimestamp("ora_registrazione")!=null){
  111.                     scope.setOraRegistrazione(new Date(rs.getTimestamp("ora_registrazione").getTime()));
  112.                 }
  113.                
  114.                 // Proprieta Oggetto
  115.                 scope.setProprietaOggetto(DriverRegistroServiziDB_utilsDriver.readProprietaOggetto(rs,false));

  116.             } else {
  117.                 throw new DriverRegistroServiziNotFound("[DriverRegistroServiziDB::getScope] rs.next non ha restituito valori con la seguente interrogazione :\n" +
  118.                         DriverRegistroServiziDB_LIB.formatSQLString(queryString, idScope.getNome()));
  119.             }

  120.             return scope;

  121.         }catch (DriverRegistroServiziNotFound e) {
  122.             throw e;
  123.         } catch (SQLException se) {

  124.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::getScope] SqlException: " + se.getMessage(),se);
  125.         }catch (Exception se) {

  126.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::getScope] Exception: " + se.getMessage(),se);
  127.         } finally {
  128.             JDBCUtilities.closeResources(rs, stm);
  129.             this.driver.closeConnection(con);
  130.         }
  131.     }

  132.     protected Scope getScope(
  133.             long idScope) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{

  134.         this.driver.logDebug("richiesto getScope: " + idScope);
  135.         // conrollo consistenza
  136.         if (idScope <=0)
  137.             throw new DriverRegistroServiziException("[getScope] Parametro idScope non valido");

  138.         Connection con = null;
  139.         PreparedStatement stm = null;
  140.         ResultSet rs = null;

  141.         if (this.driver.atomica) {
  142.             try {
  143.                 con = this.driver.getConnectionFromDatasource("getScope(id)");

  144.             } catch (Exception e) {
  145.                 throw new DriverRegistroServiziException("DriverRegistroServiziDB::getScope] Exception accedendo al datasource :" + e.getMessage(),e);

  146.             }

  147.         } else
  148.             con = this.driver.globalConnection;

  149.         this.driver.logDebug("operazione atomica = " + this.driver.atomica);

  150.         IDScope idScopeObject = null;
  151.         try {

  152.             ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  153.             sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  154.             sqlQueryObject.addSelectField("nome");
  155.             sqlQueryObject.addWhereCondition("id = ?");
  156.             String queryString = sqlQueryObject.createSQLQuery();
  157.             stm = con.prepareStatement(queryString);
  158.             stm.setLong(1, idScope);
  159.             rs = stm.executeQuery();
  160.             if (rs.next()) {
  161.                 idScopeObject = new IDScope(rs.getString("nome"));
  162.             } else {
  163.                 throw new DriverRegistroServiziNotFound("[DriverRegistroServiziDB::getScope] rs.next non ha restituito valori con la seguente interrogazione :\n" +
  164.                         DriverRegistroServiziDB_LIB.formatSQLString(queryString, idScope));
  165.             }

  166.         }catch (DriverRegistroServiziNotFound e) {
  167.             throw e;
  168.         } catch (SQLException se) {

  169.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::getScope] SqlException: " + se.getMessage(),se);
  170.         }catch (Exception se) {

  171.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::getScope] Exception: " + se.getMessage(),se);
  172.         } finally {
  173.             JDBCUtilities.closeResources(rs, stm);
  174.             this.driver.closeConnection(con);
  175.         }
  176.        
  177.         return this.getScope(idScopeObject);
  178.     }

  179.     protected List<IDScope> getAllIdScope(
  180.             FiltroRicercaScope filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{

  181.         Connection con = null;
  182.         PreparedStatement stm = null;
  183.         ResultSet rs = null;

  184.         boolean filtroRicercaTipo = false;
  185.         if(filtroRicerca!=null){
  186.             filtroRicercaTipo = StringUtils.isNotEmpty(filtroRicerca.getTipologia());
  187.         }
  188.         List<String> listTipologia = null;
  189.         if(filtroRicercaTipo){
  190.             listTipologia = new ArrayList<>();
  191.             listTipologia.add(filtroRicerca.getTipologia());
  192.         }
  193.        
  194.         boolean filtroRicercaContesto = false;
  195.         if(filtroRicerca!=null){
  196.             filtroRicercaContesto = filtroRicerca.getContesto()!=null && !ScopeContesto.QUALSIASI.equals(filtroRicerca.getContesto());
  197.         }
  198.         List<String> listContesto = null;
  199.         if(filtroRicercaContesto){
  200.             listContesto = new ArrayList<>();
  201.             listContesto.add(ScopeContesto.QUALSIASI.getValue());
  202.             listContesto.add(filtroRicerca.getContesto().getValue());
  203.         }
  204.        
  205.         this.driver.logDebug("getAllIdScope...");

  206.         try {
  207.             this.driver.logDebug("operazione atomica = " + this.driver.atomica);
  208.             // prendo la connessione dal pool
  209.             if (this.driver.atomica)
  210.                 con = this.driver.getConnectionFromDatasource("getAllIdScope");
  211.             else
  212.                 con = this.driver.globalConnection;

  213.             ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  214.             sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  215.             sqlQueryObject.addSelectField("nome");
  216.             if(filtroRicerca!=null){
  217.                 // Filtro By Data
  218.                 if(filtroRicerca.getMinDate()!=null)
  219.                     sqlQueryObject.addWhereCondition("ora_registrazione > ?");
  220.                 if(filtroRicerca.getMaxDate()!=null)
  221.                     sqlQueryObject.addWhereCondition("ora_registrazione < ?");
  222.                 if(filtroRicerca.getNome()!=null)
  223.                     sqlQueryObject.addWhereCondition("nome = ?");
  224.                 if(filtroRicercaTipo){
  225.                     sqlQueryObject.addWhereCondition(false,"tipologia = ?","tipologia = ?");
  226.                 }
  227.                 if(filtroRicercaContesto){
  228.                     sqlQueryObject.addWhereCondition(false,"contesto_utilizzo = ?","contesto_utilizzo = ?");
  229.                 }
  230.                 sqlQueryObject.addOrderBy("nome");
  231.             }

  232.             sqlQueryObject.setANDLogicOperator(true);
  233.             String sqlQuery = sqlQueryObject.createSQLQuery();
  234.             this.driver.logDebug("eseguo query : " + sqlQuery );
  235.             stm = con.prepareStatement(sqlQuery);
  236.             int indexStmt = 1;
  237.             if(filtroRicerca!=null){
  238.                 if(filtroRicerca.getMinDate()!=null){
  239.                     this.driver.logDebug("minDate stmt.setTimestamp("+filtroRicerca.getMinDate()+")");
  240.                     stm.setTimestamp(indexStmt, new Timestamp(filtroRicerca.getMinDate().getTime()));
  241.                     indexStmt++;
  242.                 }
  243.                 if(filtroRicerca.getMaxDate()!=null){
  244.                     this.driver.logDebug("maxDate stmt.setTimestamp("+filtroRicerca.getMaxDate()+")");
  245.                     stm.setTimestamp(indexStmt, new Timestamp(filtroRicerca.getMaxDate().getTime()));
  246.                     indexStmt++;
  247.                 }  
  248.                 if(filtroRicerca.getNome()!=null){
  249.                     this.driver.logDebug("nome stmt.setString("+filtroRicerca.getNome()+")");
  250.                     stm.setString(indexStmt, filtroRicerca.getNome());
  251.                     indexStmt++;
  252.                 }  
  253.                 if(filtroRicercaTipo){
  254.                     for (int i = 0; i < listTipologia.size(); i++) {
  255.                         this.driver.logDebug("tipo stmt.setString("+listTipologia.get(i)+")");
  256.                         stm.setString(indexStmt, listTipologia.get(i));
  257.                         indexStmt++;
  258.                     }
  259.                 }
  260.                 if(filtroRicercaContesto){
  261.                     for (int i = 0; i < listContesto.size(); i++) {
  262.                         this.driver.logDebug("contesto stmt.setString("+listContesto.get(i)+")");
  263.                         stm.setString(indexStmt, listContesto.get(i));
  264.                         indexStmt++;
  265.                     }
  266.                 }
  267.             }
  268.             rs = stm.executeQuery();
  269.             List<IDScope> nomiScope = new ArrayList<>();
  270.             while (rs.next()) {
  271.                 nomiScope.add(new IDScope(rs.getString("nome")));
  272.             }
  273.             if(nomiScope.isEmpty()){
  274.                 if(filtroRicerca!=null)
  275.                     throw new DriverRegistroServiziNotFound("Scope non trovati che rispettano il filtro di ricerca selezionato: "+filtroRicerca.toString());
  276.                 else
  277.                     throw new DriverRegistroServiziNotFound("Scope non trovati");
  278.             }else{
  279.                 return nomiScope;
  280.             }
  281.         }catch(DriverRegistroServiziNotFound de){
  282.             throw de;
  283.         }
  284.         catch(Exception e){
  285.             throw new DriverRegistroServiziException("getAllIdScope error",e);
  286.         } finally {

  287.             //Chiudo statement and resultset
  288.             JDBCUtilities.closeResources(rs, stm);

  289.             this.driver.closeConnection(con);

  290.         }
  291.     }

  292.     protected void createScope(Scope scope) throws DriverRegistroServiziException{
  293.         if (scope == null)
  294.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::createScope] Parametro non valido.");

  295.         Connection con = null;
  296.         boolean error = false;

  297.         if (this.driver.atomica) {
  298.             try {
  299.                 con = this.driver.getConnectionFromDatasource("createScope");
  300.                 con.setAutoCommit(false);
  301.             } catch (Exception e) {
  302.                 throw new DriverRegistroServiziException("[DriverRegistroServiziDB::createScope] Exception accedendo al datasource :" + e.getMessage(),e);

  303.             }

  304.         } else
  305.             con = this.driver.globalConnection;

  306.         this.driver.logDebug("operazione atomica = " + this.driver.atomica);

  307.         try {
  308.             this.driver.logDebug("CRUDScope type = 1");
  309.             DriverRegistroServiziDB_LIB.CRUDScope(CostantiDB.CREATE, scope, con);

  310.         } catch (Exception qe) {
  311.             error = true;
  312.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::createScope] Errore durante la creazione del scope : " + qe.getMessage(), qe);
  313.         } finally {

  314.             this.driver.closeConnection(error,con);
  315.         }
  316.     }

  317.     protected boolean existsScope(IDScope idScope) throws DriverRegistroServiziException{
  318.         boolean exist = false;
  319.         Connection con = null;
  320.         PreparedStatement stm = null;
  321.         ResultSet rs = null;

  322.         if (idScope == null)
  323.             throw new DriverRegistroServiziException("Parametro non valido");

  324.         if (idScope.getNome()==null || idScope.getNome().equals(""))
  325.             throw new DriverRegistroServiziException("Parametro vuoto non valido");

  326.         if (this.driver.atomica) {
  327.             try {
  328.                 con = this.driver.getConnectionFromDatasource("existsScope");
  329.             } catch (Exception e) {
  330.                 throw new DriverRegistroServiziException("[DriverRegistroServiziDB::existsScope] Exception accedendo al datasource :" + e.getMessage(),e);

  331.             }

  332.         } else
  333.             con = this.driver.globalConnection;

  334.         try {
  335.             ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  336.             sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  337.             sqlQueryObject.addSelectField("*");
  338.             sqlQueryObject.addWhereCondition("nome = ?");
  339.             sqlQueryObject.setANDLogicOperator(true);
  340.             String sqlQuery = sqlQueryObject.createSQLQuery();
  341.             stm = con.prepareStatement(sqlQuery);
  342.             stm.setString(1, idScope.getNome());
  343.             rs = stm.executeQuery();
  344.             if (rs.next())
  345.                 exist = true;
  346.             rs.close();
  347.             stm.close();

  348.         } catch (Exception e) {
  349.             exist = false;
  350.             this.driver.log.error("Errore durante verifica esistenza scope: "+e.getMessage(), e);
  351.         } finally {

  352.             //Chiudo statement and resultset
  353.             JDBCUtilities.closeResources(rs, stm);

  354.             this.driver.closeConnection(con);
  355.         }

  356.         return exist;
  357.     }

  358.     protected void updateScope(Scope scope) throws DriverRegistroServiziException{
  359.         if (scope == null)
  360.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::updateScope] Parametro non valido.");

  361.         Connection con = null;
  362.         boolean error = false;

  363.         if (this.driver.atomica) {
  364.             try {
  365.                 con = this.driver.getConnectionFromDatasource("updateScope");
  366.                 con.setAutoCommit(false);
  367.             } catch (Exception e) {
  368.                 throw new DriverRegistroServiziException("[DriverRegistroServiziDB::updateScope] Exception accedendo al datasource :" + e.getMessage(),e);

  369.             }

  370.         } else
  371.             con = this.driver.globalConnection;

  372.         this.driver.logDebug("operazione atomica = " + this.driver.atomica);

  373.         try {

  374.             this.driver.logDebug("CRUDScope type = 2");
  375.             DriverRegistroServiziDB_LIB.CRUDScope(CostantiDB.UPDATE, scope, con);

  376.         } catch (Exception qe) {
  377.             error = true;
  378.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::updateScope] Errore durante l'aggiornamento del scope : " + qe.getMessage(),qe);
  379.         } finally {

  380.             this.driver.closeConnection(error,con);
  381.         }
  382.     }  

  383.     protected void deleteScope(Scope scope) throws DriverRegistroServiziException{
  384.         if (scope == null)
  385.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::deleteScope] Parametro non valido.");

  386.         Connection con = null;
  387.         boolean error = false;

  388.         if (this.driver.atomica) {
  389.             try {
  390.                 con = this.driver.getConnectionFromDatasource("deleteScope");
  391.                 con.setAutoCommit(false);
  392.             } catch (Exception e) {
  393.                 throw new DriverRegistroServiziException("[DriverRegistroServiziDB::deleteScope] Exception accedendo al datasource :" + e.getMessage(),e);

  394.             }

  395.         } else
  396.             con = this.driver.globalConnection;

  397.         this.driver.logDebug("operazione atomica = " + this.driver.atomica);

  398.         try {
  399.             this.driver.logDebug("CRUDScope type = 3");
  400.             DriverRegistroServiziDB_LIB.CRUDScope(CostantiDB.DELETE, scope, con);

  401.         } catch (Exception qe) {
  402.             error = true;
  403.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::deleteScope] Errore durante l'eliminazione del scope : " + qe.getMessage(),qe);
  404.         } finally {

  405.             this.driver.closeConnection(error,con);
  406.         }
  407.     }
  408.    
  409.     protected List<Scope> scopeList(String superuser, ISearch ricerca) throws DriverRegistroServiziException {
  410.         String nomeMetodo = "scopeList";
  411.         int idLista = Liste.SCOPE;
  412.         int offset;
  413.         int limit;
  414.         String search;
  415.         String queryString;

  416.         limit = ricerca.getPageSize(idLista);
  417.         offset = ricerca.getIndexIniziale(idLista);
  418.         search = (org.openspcoop2.core.constants.Costanti.SESSION_ATTRIBUTE_VALUE_RICERCA_UNDEFINED.equals(ricerca.getSearchString(idLista)) ? "" : ricerca.getSearchString(idLista));

  419.         String filterScopeTipologia = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SCOPE_TIPOLOGIA);
  420.         String scopeTipologia = null;
  421.         if(filterScopeTipologia!=null) {
  422.             scopeTipologia = StringUtils.isNotEmpty(filterScopeTipologia) ? filterScopeTipologia : null;
  423.         }
  424.        
  425.         String filterScopeContesto = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SCOPE_CONTESTO);
  426.         org.openspcoop2.core.registry.constants.ScopeContesto scopeContesto = null;
  427.         if(filterScopeContesto!=null) {
  428.             scopeContesto = org.openspcoop2.core.registry.constants.ScopeContesto.toEnumConstant(filterScopeContesto);
  429.         }

  430.         boolean isFilterGruppoErogazione = false;
  431.         boolean isFilterGruppoFruizione = false;
  432.         String filterGruppo = SearchUtils.getFilter(ricerca, idLista,  Filtri.FILTRO_GRUPPO);
  433.         if(filterGruppo!=null && !"".equals(filterGruppo)) {
  434.             isFilterGruppoErogazione = true;
  435.             isFilterGruppoFruizione = true;
  436.         }

  437.         TipoPdD apiContesto = null;
  438.         String filterApiContesto = SearchUtils.getFilter(ricerca, idLista,  Filtri.FILTRO_API_CONTESTO);
  439.         if(filterApiContesto!=null && !"".equals(filterApiContesto)) {
  440.             apiContesto = TipoPdD.toTipoPdD(filterApiContesto);
  441.             if(TipoPdD.APPLICATIVA.equals(apiContesto)) {
  442.                 isFilterGruppoFruizione = false;
  443.             }
  444.             else if(TipoPdD.DELEGATA.equals(apiContesto)) {
  445.                 isFilterGruppoErogazione = false;
  446.             }
  447.             else {
  448.                 apiContesto = null;
  449.             }
  450.         }
  451.        
  452.         String filterProtocollo = null;
  453.         String filterProtocolli = null;
  454.         List<String> tipoSoggettiProtocollo = null;
  455.         String filterSoggettoTipo = null;
  456.         String filterSoggettoNome = null;
  457.         boolean filterSoggettoProprietario = false;
  458.         boolean filterTipoSoggettoProtocollo = false;
  459.         if(apiContesto!=null) {
  460.             filterProtocollo = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_PROTOCOLLO);
  461.             filterProtocolli = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_PROTOCOLLI);
  462.             try {
  463.                 tipoSoggettiProtocollo = Filtri.convertToTipiSoggetti(filterProtocollo, filterProtocolli);
  464.             }catch(Exception e) {
  465.                 throw new DriverRegistroServiziException(e.getMessage(),e);
  466.             }
  467.             if(tipoSoggettiProtocollo!=null && !tipoSoggettiProtocollo.isEmpty()) {
  468.                 filterTipoSoggettoProtocollo=true;
  469.             }
  470.            
  471.             String filterSoggettoTipoNome = SearchUtils.getFilter(ricerca, idLista,  Filtri.FILTRO_SOGGETTO);
  472.             if(filterSoggettoTipoNome!=null && !"".equals(filterSoggettoTipoNome)) {
  473.                 filterSoggettoTipo = filterSoggettoTipoNome.split("/")[0];
  474.                 filterSoggettoNome = filterSoggettoTipoNome.split("/")[1];
  475.                 filterSoggettoProprietario=true;
  476.                 filterTipoSoggettoProtocollo=false; // piu' specifico il filtro sul soggetto proprietario
  477.             }
  478.         }
  479.        
  480.         String filterApiImplementazione = null;
  481.         IDServizio apiImplementazioneErogazione = null;
  482.         IDFruizione apiImplementazioneFruizione = null;
  483.         if(apiContesto!=null) {
  484.             filterApiImplementazione = SearchUtils.getFilter(ricerca, idLista,  Filtri.FILTRO_API_IMPLEMENTAZIONE);
  485.             if(filterApiImplementazione!=null && !"".equals(filterApiImplementazione)) {
  486.                 if(TipoPdD.APPLICATIVA.equals(apiContesto)) {
  487.                     try {
  488.                         apiImplementazioneErogazione = IDServizio.toIDServizio(filterApiImplementazione);
  489.                         isFilterGruppoErogazione=false; // non ha piu' senso ho selezionato una erogazione puntuale
  490.                     }catch(Exception e) {
  491.                         throw new DriverRegistroServiziException("Filtro API Implementazione '"+filterApiImplementazione+"' non valido: "+e.getMessage(),e);
  492.                     }
  493.                 }
  494.                 else if(TipoPdD.DELEGATA.equals(apiContesto)) {
  495.                     try {
  496.                         apiImplementazioneFruizione = IDFruizione.toIDFruizione(filterApiImplementazione);
  497.                         isFilterGruppoFruizione=false; // non ha piu' senso ho selezionato una fruizione puntuale
  498.                     }catch(Exception e) {
  499.                         throw new DriverRegistroServiziException("Filtro API Implementazione '"+filterApiImplementazione+"' non valido: "+e.getMessage(),e);
  500.                     }
  501.                 }
  502.             }
  503.         }
  504.        
  505.         this.driver.logDebug("search : " + search);
  506.         this.driver.logDebug("filterScopeTipologia : " + filterScopeTipologia);
  507.         this.driver.logDebug("filterScopeContesto : " + filterScopeContesto);
  508.         this.driver.logDebug("filterGruppo : " + filterGruppo);
  509.         this.driver.logDebug("filterApiContesto : " + filterApiContesto);
  510.         this.driver.logDebug("filterProtocollo : " + filterProtocollo);
  511.         this.driver.logDebug("filterProtocolli : " + filterProtocolli);
  512.         this.driver.logDebug("filterSoggettoNome : " + filterSoggettoNome);
  513.         this.driver.logDebug("filterSoggettoTipo : " + filterSoggettoTipo);
  514.         this.driver.logDebug("filterApiImplementazione : " + filterApiImplementazione);
  515.        
  516.         Connection con = null;
  517.         PreparedStatement stmt = null;
  518.         ResultSet risultato = null;
  519.         ArrayList<Scope> lista = new ArrayList<>();

  520.         if (this.driver.atomica) {
  521.             try {
  522.                 con = this.driver.getConnectionFromDatasource("scopeList");
  523.             } catch (Exception e) {
  524.                 throw new DriverRegistroServiziException("[DriverRegistroServiziDB::" + nomeMetodo + "] Exception accedendo al datasource :" + e.getMessage(),e);

  525.             }

  526.         } else
  527.             con = this.driver.globalConnection;

  528.         this.driver.logDebug("operazione this.driver.atomica = " + this.driver.atomica);

  529.         List<IDScope> listIdScope = null;
  530.         try {

  531.             /* === Filtro Gruppo, Tipo Erogazione/Fruizione, Implementazione API === */
  532.            
  533.             List<String> existsConditions = new ArrayList<>();
  534.             List<Object> existsParameters = new ArrayList<>();
  535.             String aliasPDSCOPE = "pdscope";
  536.             String aliasPD = "pd";
  537.             String aliasPASCOPE = "pascope";
  538.             String aliasPA = "pa";
  539.             String aliasSERVIZI = "s";
  540.             String aliasACCORDI = "a";
  541.             String aliasACCORDIGRUPPI = "ag";
  542.             String aliasGRUPPI = "g";
  543.             String aliasSOGGETTI = "sProprietario";
  544.            
  545.             // controllo accesso porte delegate
  546.             if(isFilterGruppoFruizione  || TipoPdD.DELEGATA.equals(apiContesto) || apiImplementazioneFruizione!=null) {
  547.                 ISQLQueryObject sqlQueryObjectAutorizzazioniPorteDelegate = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  548.                 sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.PORTE_DELEGATE_SCOPE,aliasPDSCOPE);
  549.                 sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.PORTE_DELEGATE,aliasPD);
  550.                 if(isFilterGruppoFruizione) {
  551.                     sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.SERVIZI,aliasSERVIZI);
  552.                     sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.ACCORDI,aliasACCORDI);
  553.                     sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.ACCORDI_GRUPPI,aliasACCORDIGRUPPI);
  554.                     sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.GRUPPI,aliasGRUPPI);
  555.                 }
  556.                 if(apiImplementazioneFruizione!=null || filterSoggettoProprietario || filterTipoSoggettoProtocollo) {
  557.                     sqlQueryObjectAutorizzazioniPorteDelegate.addFromTable(CostantiDB.SOGGETTI,aliasSOGGETTI);
  558.                 }
  559.                 sqlQueryObjectAutorizzazioniPorteDelegate.addSelectAliasField(aliasPDSCOPE, "id", aliasPDSCOPE+"id");
  560.                 sqlQueryObjectAutorizzazioniPorteDelegate.setANDLogicOperator(true);
  561.                 sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPDSCOPE+".scope = "+CostantiDB.SCOPE+".nome");
  562.                 sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPDSCOPE+".id_porta = "+aliasPD+".id");
  563.                 if(isFilterGruppoFruizione) {
  564.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".id_servizio = "+aliasSERVIZI+".id");
  565.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasSERVIZI+".id_accordo = "+aliasACCORDI+".id");
  566.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasACCORDIGRUPPI+".id_accordo = "+aliasACCORDI+".id");
  567.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasACCORDIGRUPPI+".id_gruppo = "+aliasGRUPPI+".id");
  568.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasGRUPPI+".nome = ?");
  569.                     existsParameters.add(filterGruppo);
  570.                 }
  571.                 if(apiImplementazioneFruizione!=null || filterSoggettoProprietario || filterTipoSoggettoProtocollo) {
  572.                     sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".id_soggetto = "+aliasSOGGETTI+".id");
  573.                     if(apiImplementazioneFruizione!=null) {
  574.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasSOGGETTI+".tipo_soggetto = ?");
  575.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasSOGGETTI+".nome_soggetto = ?");
  576.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".tipo_soggetto_erogatore = ?");
  577.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".nome_soggetto_erogatore = ?");
  578.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".tipo_servizio = ?");
  579.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".nome_servizio = ?");
  580.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasPD+".versione_servizio = ?");
  581.                         existsParameters.add(apiImplementazioneFruizione.getIdFruitore().getTipo());
  582.                         existsParameters.add(apiImplementazioneFruizione.getIdFruitore().getNome());
  583.                         existsParameters.add(apiImplementazioneFruizione.getIdServizio().getSoggettoErogatore().getTipo());
  584.                         existsParameters.add(apiImplementazioneFruizione.getIdServizio().getSoggettoErogatore().getNome());
  585.                         existsParameters.add(apiImplementazioneFruizione.getIdServizio().getTipo());
  586.                         existsParameters.add(apiImplementazioneFruizione.getIdServizio().getNome());
  587.                         existsParameters.add(apiImplementazioneFruizione.getIdServizio().getVersione());
  588.                     }
  589.                     else if(filterSoggettoProprietario) {
  590.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasSOGGETTI+".tipo_soggetto = ?");
  591.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereCondition(aliasSOGGETTI+".nome_soggetto = ?");
  592.                         existsParameters.add(filterSoggettoTipo);
  593.                         existsParameters.add(filterSoggettoNome);
  594.                     }
  595.                     else if(filterTipoSoggettoProtocollo) {
  596.                         sqlQueryObjectAutorizzazioniPorteDelegate.addWhereINCondition(aliasSOGGETTI+".tipo_soggetto", true, tipoSoggettiProtocollo.toArray(new String[1]));
  597.                     }
  598.                 }
  599.                
  600.                 existsConditions.add(sqlQueryObjectAutorizzazioniPorteDelegate.getWhereExistsCondition(false, sqlQueryObjectAutorizzazioniPorteDelegate));
  601.             }
  602.            
  603.            
  604.             // controllo accesso porte applicative
  605.             if(isFilterGruppoErogazione  || TipoPdD.APPLICATIVA.equals(apiContesto) || apiImplementazioneErogazione!=null) {
  606.                 ISQLQueryObject sqlQueryObjectAutorizzazioniPorteApplicative = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  607.                 sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.PORTE_APPLICATIVE_SCOPE,aliasPASCOPE);
  608.                 sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.PORTE_APPLICATIVE,aliasPA);
  609.                 if(isFilterGruppoErogazione) {
  610.                     sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.SERVIZI,aliasSERVIZI);
  611.                     sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.ACCORDI,aliasACCORDI);
  612.                     sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.ACCORDI_GRUPPI,aliasACCORDIGRUPPI);
  613.                     sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.GRUPPI,aliasGRUPPI);
  614.                 }
  615.                 if(apiImplementazioneErogazione!=null || filterSoggettoProprietario || filterTipoSoggettoProtocollo) {
  616.                     sqlQueryObjectAutorizzazioniPorteApplicative.addFromTable(CostantiDB.SOGGETTI,aliasSOGGETTI);
  617.                 }
  618.                 sqlQueryObjectAutorizzazioniPorteApplicative.addSelectAliasField(aliasPASCOPE, "id", aliasPASCOPE+"id");
  619.                 sqlQueryObjectAutorizzazioniPorteApplicative.setANDLogicOperator(true);
  620.                 sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPASCOPE+".scope = "+CostantiDB.SCOPE+".nome");
  621.                 sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPASCOPE+".id_porta = "+aliasPA+".id");
  622.                 if(isFilterGruppoErogazione) {
  623.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPA+".id_servizio = "+aliasSERVIZI+".id");
  624.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasSERVIZI+".id_accordo = "+aliasACCORDI+".id");
  625.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasACCORDIGRUPPI+".id_accordo = "+aliasACCORDI+".id");
  626.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasACCORDIGRUPPI+".id_gruppo = "+aliasGRUPPI+".id");
  627.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasGRUPPI+".nome = ?");
  628.                     existsParameters.add(filterGruppo);
  629.                 }
  630.                 if(apiImplementazioneErogazione!=null || filterSoggettoProprietario || filterTipoSoggettoProtocollo) {
  631.                     sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPA+".id_soggetto = "+aliasSOGGETTI+".id");
  632.                     if(apiImplementazioneErogazione!=null) {
  633.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasSOGGETTI+".tipo_soggetto = ?");
  634.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasSOGGETTI+".nome_soggetto = ?");
  635.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPA+".tipo_servizio = ?");
  636.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPA+".servizio = ?");
  637.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasPA+".versione_servizio = ?");
  638.                         existsParameters.add(apiImplementazioneErogazione.getSoggettoErogatore().getTipo());
  639.                         existsParameters.add(apiImplementazioneErogazione.getSoggettoErogatore().getNome());
  640.                         existsParameters.add(apiImplementazioneErogazione.getTipo());
  641.                         existsParameters.add(apiImplementazioneErogazione.getNome());
  642.                         existsParameters.add(apiImplementazioneErogazione.getVersione());
  643.                     }
  644.                     else if(filterSoggettoProprietario) {
  645.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasSOGGETTI+".tipo_soggetto = ?");
  646.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereCondition(aliasSOGGETTI+".nome_soggetto = ?");
  647.                         existsParameters.add(filterSoggettoTipo);
  648.                         existsParameters.add(filterSoggettoNome);
  649.                     }
  650.                     else if(filterTipoSoggettoProtocollo) {
  651.                         sqlQueryObjectAutorizzazioniPorteApplicative.addWhereINCondition(aliasSOGGETTI+".tipo_soggetto", true, tipoSoggettiProtocollo.toArray(new String[1]));
  652.                     }
  653.                 }
  654.                
  655.                 existsConditions.add(sqlQueryObjectAutorizzazioniPorteApplicative.getWhereExistsCondition(false, sqlQueryObjectAutorizzazioniPorteApplicative));
  656.             }
  657.            
  658.            
  659.            
  660.            
  661.             if (!search.equals("")) {
  662.                 //query con search
  663.                 ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  664.                 sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  665.                 sqlQueryObject.addSelectCountField("*", "cont");
  666.                 if(this.driver.useSuperUser && superuser!=null && (!superuser.equals("")))
  667.                     sqlQueryObject.addWhereCondition("superuser = ?");
  668.                 sqlQueryObject.addWhereLikeCondition("nome", search, true, true);  
  669.                 if(scopeContesto!=null) {
  670.                     sqlQueryObject.addWhereCondition("contesto_utilizzo = ?");
  671.                 }
  672.                 if(scopeTipologia!=null) {
  673.                     sqlQueryObject.addWhereCondition("tipologia = ?");
  674.                 }
  675.                 if(!existsConditions.isEmpty()) {
  676.                     sqlQueryObject.addWhereCondition(false, existsConditions.toArray(new String[1]));
  677.                 }
  678.                 sqlQueryObject.setANDLogicOperator(true);
  679.                 queryString = sqlQueryObject.createSQLQuery();
  680.             } else {
  681.                 ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  682.                 sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  683.                 sqlQueryObject.addSelectCountField("*", "cont");
  684.                 if(this.driver.useSuperUser && superuser!=null && (!superuser.equals("")))
  685.                     sqlQueryObject.addWhereCondition("superuser = ?");
  686.                 if(scopeContesto!=null) {
  687.                     sqlQueryObject.addWhereCondition("contesto_utilizzo = ?");
  688.                 }
  689.                 if(scopeTipologia!=null) {
  690.                     sqlQueryObject.addWhereCondition("tipologia = ?");
  691.                 }
  692.                 if(!existsConditions.isEmpty()) {
  693.                     sqlQueryObject.addWhereCondition(false, existsConditions.toArray(new String[1]));
  694.                 }
  695.                 sqlQueryObject.setANDLogicOperator(true);
  696.                 queryString = sqlQueryObject.createSQLQuery();
  697.             }
  698.             stmt = con.prepareStatement(queryString);
  699.             int index = 1;
  700.             if(this.driver.useSuperUser && superuser!=null && (!superuser.equals(""))){
  701.                 stmt.setString(index++, superuser);
  702.             }
  703.             if(scopeContesto!=null) {
  704.                 stmt.setString(index++, scopeContesto.getValue());
  705.             }
  706.             if(scopeTipologia!=null) {
  707.                 stmt.setString(index++, scopeTipologia);
  708.             }
  709.             if(existsParameters!=null && !existsParameters.isEmpty()) {
  710.                 for (Object object : existsParameters) {
  711.                     if(object instanceof String) {
  712.                         stmt.setString(index++, (String) object);
  713.                     }
  714.                     else {
  715.                         stmt.setInt(index++, (Integer) object);
  716.                     }
  717.                 }
  718.             }

  719.             risultato = stmt.executeQuery();
  720.             if (risultato.next())
  721.                 ricerca.setNumEntries(idLista,risultato.getInt(1));
  722.             risultato.close();
  723.             stmt.close();

  724.             // ricavo le entries
  725.             if (limit == 0) // con limit
  726.                 limit = ISQLQueryObject.LIMIT_DEFAULT_VALUE;
  727.             if (!search.equals("")) { // con search
  728.                 ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  729.                 sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  730.                 sqlQueryObject.addSelectField("nome");
  731.                 if(this.driver.useSuperUser && superuser!=null && (!superuser.equals("")))
  732.                     sqlQueryObject.addWhereCondition("superuser = ?");
  733.                 sqlQueryObject.addWhereLikeCondition("nome", search, true, true);
  734.                 if(scopeContesto!=null) {
  735.                     sqlQueryObject.addWhereCondition("contesto_utilizzo = ?");
  736.                 }
  737.                 if(scopeTipologia!=null) {
  738.                     sqlQueryObject.addWhereCondition("tipologia = ?");
  739.                 }
  740.                 if(!existsConditions.isEmpty()) {
  741.                     sqlQueryObject.addWhereCondition(false, existsConditions.toArray(new String[1]));
  742.                 }
  743.                 sqlQueryObject.setANDLogicOperator(true);
  744.                 sqlQueryObject.addOrderBy("nome");
  745.                 sqlQueryObject.setSortType(true);
  746.                 sqlQueryObject.setLimit(limit);
  747.                 sqlQueryObject.setOffset(offset);
  748.                 queryString = sqlQueryObject.createSQLQuery();
  749.             } else {
  750.                 // senza search
  751.                 ISQLQueryObject sqlQueryObject = SQLObjectFactory.createSQLQueryObject(this.driver.tipoDB);
  752.                 sqlQueryObject.addFromTable(CostantiDB.SCOPE);
  753.                 sqlQueryObject.addSelectField("nome");
  754.                 if(this.driver.useSuperUser && superuser!=null && (!superuser.equals("")))
  755.                     sqlQueryObject.addWhereCondition("superuser = ?");
  756.                 if(scopeContesto!=null) {
  757.                     sqlQueryObject.addWhereCondition("contesto_utilizzo = ?");
  758.                 }
  759.                 if(scopeTipologia!=null) {
  760.                     sqlQueryObject.addWhereCondition("tipologia = ?");
  761.                 }
  762.                 if(!existsConditions.isEmpty()) {
  763.                     sqlQueryObject.addWhereCondition(false, existsConditions.toArray(new String[1]));
  764.                 }
  765.                 sqlQueryObject.setANDLogicOperator(true);
  766.                 sqlQueryObject.addOrderBy("nome");
  767.                 sqlQueryObject.setSortType(true);
  768.                 sqlQueryObject.setLimit(limit);
  769.                 sqlQueryObject.setOffset(offset);
  770.                 queryString = sqlQueryObject.createSQLQuery();
  771.             }
  772.             stmt = con.prepareStatement(queryString);
  773.             index = 1;
  774.             if(this.driver.useSuperUser && superuser!=null && (!superuser.equals(""))){
  775.                 stmt.setString(index++, superuser);
  776.             }
  777.             if(scopeContesto!=null) {
  778.                 stmt.setString(index++, scopeContesto.getValue());
  779.             }
  780.             if(scopeTipologia!=null) {
  781.                 stmt.setString(index++, scopeTipologia);
  782.             }
  783.             if(existsParameters!=null && !existsParameters.isEmpty()) {
  784.                 for (Object object : existsParameters) {
  785.                     if(object instanceof String) {
  786.                         stmt.setString(index++, (String) object);
  787.                     }
  788.                     else {
  789.                         stmt.setInt(index++, (Integer) object);
  790.                     }
  791.                 }
  792.             }
  793.             risultato = stmt.executeQuery();

  794.             listIdScope = new ArrayList<>();
  795.             while (risultato.next()) {

  796.                 listIdScope.add(new IDScope(risultato.getString("nome")));

  797.             }

  798.         } catch (Exception qe) {
  799.             throw new DriverRegistroServiziException("[DriverRegistroServiziDB::" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  800.         } finally {

  801.             //Chiudo statement and resultset
  802.             JDBCUtilities.closeResources(risultato, stmt);

  803.             this.driver.closeConnection(con);
  804.         }
  805.        
  806.        
  807.         if(listIdScope!=null){
  808.             for (IDScope idScope : listIdScope) {
  809.                 try{
  810.                     lista.add(this.getScope(idScope));
  811.                 }catch(DriverRegistroServiziNotFound notFound){
  812.                     // non può capitare
  813.                     throw new DriverRegistroServiziException(notFound.getMessage(),notFound);
  814.                 }
  815.             }
  816.         }
  817.        
  818.         return lista;
  819.     }
  820. }