ConfigIntegrationReader.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.protocol.basic.registry;

  21. import java.sql.Connection;
  22. import java.util.ArrayList;
  23. import java.util.List;

  24. import org.apache.commons.lang.StringUtils;
  25. import org.openspcoop2.core.allarmi.Allarme;
  26. import org.openspcoop2.core.allarmi.constants.RuoloPorta;
  27. import org.openspcoop2.core.allarmi.utils.AllarmiDriverUtils;
  28. import org.openspcoop2.core.commons.Liste;
  29. import org.openspcoop2.core.commons.Search;
  30. import org.openspcoop2.core.config.CanaliConfigurazione;
  31. import org.openspcoop2.core.config.ConfigurazioneMultitenant;
  32. import org.openspcoop2.core.config.GenericProperties;
  33. import org.openspcoop2.core.config.PortaApplicativa;
  34. import org.openspcoop2.core.config.PortaDelegata;
  35. import org.openspcoop2.core.config.Proprieta;
  36. import org.openspcoop2.core.config.ServizioApplicativo;
  37. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  38. import org.openspcoop2.core.config.constants.CredenzialeTipo;
  39. import org.openspcoop2.core.config.constants.TipoAutenticazione;
  40. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  41. import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
  42. import org.openspcoop2.core.config.driver.IDriverConfigurazioneCRUD;
  43. import org.openspcoop2.core.config.driver.IDriverConfigurazioneGet;
  44. import org.openspcoop2.core.config.driver.db.DriverConfigurazioneDB;
  45. import org.openspcoop2.core.config.driver.db.IDServizioApplicativoDB;
  46. import org.openspcoop2.core.constants.CostantiDB;
  47. import org.openspcoop2.core.controllo_traffico.AttivazionePolicy;
  48. import org.openspcoop2.core.controllo_traffico.constants.RuoloPolicy;
  49. import org.openspcoop2.core.controllo_traffico.utils.ControlloTrafficoDriverUtils;
  50. import org.openspcoop2.core.id.IDPortaApplicativa;
  51. import org.openspcoop2.core.id.IDPortaDelegata;
  52. import org.openspcoop2.core.id.IDServizio;
  53. import org.openspcoop2.core.id.IDServizioApplicativo;
  54. import org.openspcoop2.core.id.IDSoggetto;
  55. import org.openspcoop2.core.mapping.DBMappingUtils;
  56. import org.openspcoop2.core.mapping.MappingErogazionePortaApplicativa;
  57. import org.openspcoop2.core.mapping.MappingFruizionePortaDelegata;
  58. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  59. import org.openspcoop2.protocol.sdk.ProtocolException;
  60. import org.openspcoop2.protocol.sdk.registry.IConfigIntegrationReader;
  61. import org.openspcoop2.protocol.sdk.registry.IConfigIntegrationReaderInUso;
  62. import org.openspcoop2.protocol.sdk.registry.ProtocolFiltroRicercaPorteApplicative;
  63. import org.openspcoop2.protocol.sdk.registry.ProtocolFiltroRicercaPorteDelegate;
  64. import org.openspcoop2.protocol.sdk.registry.ProtocolFiltroRicercaServiziApplicativi;
  65. import org.openspcoop2.protocol.sdk.registry.RegistryException;
  66. import org.openspcoop2.protocol.sdk.registry.RegistryNotFound;
  67. import org.openspcoop2.utils.certificate.CertificateInfo;
  68. import org.openspcoop2.utils.crypt.CryptConfig;
  69. import org.openspcoop2.utils.resources.Loader;
  70. import org.slf4j.Logger;

  71. /**
  72.  *  ArchiveRegistryReader
  73.  *
  74.  * @author Poli Andrea (apoli@link.it)
  75.  * @author $Author$
  76.  * @version $Rev$, $Date$
  77.  */
  78. public class ConfigIntegrationReader implements IConfigIntegrationReader {

  79.     private IDriverConfigurazioneGet driverConfigurazioneGET;
  80.     private IDriverConfigurazioneCRUD driverConfigurazioneCRUD;
  81.    
  82.     private IConfigIntegrationReaderInUso inUsoDriver = null;
  83.    
  84.     private Logger log;
  85.     public ConfigIntegrationReader(IDriverConfigurazioneGet driverConfigurazione,Logger log) throws ProtocolException{
  86.         this.driverConfigurazioneGET = driverConfigurazione;
  87.         if(this.driverConfigurazioneGET instanceof IDriverConfigurazioneCRUD){
  88.             this.driverConfigurazioneCRUD = (IDriverConfigurazioneCRUD) this.driverConfigurazioneGET;
  89.         }
  90.         this.log = log;
  91.        
  92.         Loader loader = new Loader();
  93.         try {
  94.             this.inUsoDriver = (IConfigIntegrationReaderInUso) loader.newInstance("org.openspcoop2.protocol.engine.registry.ConfigIntegrationReaderInUso");
  95.         }catch(Exception e) {
  96.             throw new ProtocolException(e.getMessage(),e);
  97.         }
  98.         this.inUsoDriver.init(this.driverConfigurazioneGET, log);
  99.     }
  100.    
  101.     private static final String NOT_IMPLEMENTED = "Not Implemented";

  102.    
  103.     // SERVIZI APPLICATIVI
  104.    
  105.     @Override
  106.     public boolean existsServizioApplicativo(IDServizioApplicativo idServizioApplicativo) {
  107.         try{
  108.             if(this.driverConfigurazioneCRUD!=null){
  109.                 return this.driverConfigurazioneCRUD.existsServizioApplicativo(idServizioApplicativo);
  110.             }
  111.             else{
  112.                 return this.driverConfigurazioneGET.getServizioApplicativo(idServizioApplicativo)!=null;
  113.             }
  114.         }catch(Exception e){
  115.             return false;
  116.         }
  117.     }
  118.    
  119.     @Override
  120.     public boolean existsServizioApplicativoByCredenzialiBasic(String username, String password, CryptConfig config){
  121.         try{
  122.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiBasic(username, password, config)!=null;
  123.         }catch(Exception e){
  124.             return false;
  125.         }
  126.     }
  127.    
  128.     @Override
  129.     public ServizioApplicativo getServizioApplicativoByCredenzialiBasic(String username, String password, CryptConfig config) throws RegistryNotFound,RegistryException{
  130.         try{
  131.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiBasic(username, password, config);
  132.         } catch (DriverConfigurazioneNotFound de) {
  133.             throw new RegistryNotFound(de.getMessage(),de);
  134.         }catch(Exception e){
  135.             throw new RegistryException(e.getMessage(),e);
  136.         }
  137.     }
  138.    
  139.     @Override
  140.     public boolean existsServizioApplicativoByCredenzialiSsl(String subject, String issuer){
  141.         try{
  142.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiSsl(subject, issuer)!=null;
  143.         }catch(Exception e){
  144.             return false;
  145.         }  
  146.     }
  147.    
  148.     @Override
  149.     public ServizioApplicativo getServizioApplicativoByCredenzialiSsl(String subject, String issuer) throws RegistryNotFound,RegistryException{
  150.         try{
  151.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiSsl(subject, issuer);
  152.         } catch (DriverConfigurazioneNotFound de) {
  153.             throw new RegistryNotFound(de.getMessage(),de);
  154.         }catch(Exception e){
  155.             throw new RegistryException(e.getMessage(),e);
  156.         }
  157.     }
  158.    
  159.     @Override
  160.     public boolean existsServizioApplicativoByCredenzialiSsl(String subject, String issuer,
  161.             List<String> tipiSoggetto,
  162.             boolean includiApplicativiNonModI, boolean includiApplicativiModIEsterni, boolean includiApplicativiModIInterni) {
  163.         try{
  164.             return this.getServizioApplicativoByCredenzialiSsl(subject, issuer,
  165.                     tipiSoggetto,
  166.                     includiApplicativiNonModI, includiApplicativiModIEsterni, includiApplicativiModIInterni)!=null;
  167.         }catch(Exception e){
  168.             return false;
  169.         }  
  170.     }
  171.     @Override
  172.     public ServizioApplicativo getServizioApplicativoByCredenzialiSsl(String subject, String issuer,
  173.             List<String> tipiSoggetto,
  174.             boolean includiApplicativiNonModI, boolean includiApplicativiModIEsterni, boolean includiApplicativiModIInterni) throws RegistryNotFound,RegistryException{
  175.         try{
  176.             if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  177.                 return ((DriverConfigurazioneDB)this.driverConfigurazioneGET).getServizioApplicativoByCredenzialiSsl(subject, issuer,
  178.                         tipiSoggetto,
  179.                         includiApplicativiNonModI, includiApplicativiModIEsterni, includiApplicativiModIInterni);
  180.             }
  181.             else {
  182.                 throw new RegistryException("Unsupported");
  183.             }
  184.         } catch (DriverConfigurazioneNotFound de) {
  185.             throw new RegistryNotFound(de.getMessage(),de);
  186.         }catch(Exception e){
  187.             throw new RegistryException(e.getMessage(),e);
  188.         }
  189.     }
  190.    
  191.     @Override
  192.     public boolean existsServizioApplicativoByCredenzialiSsl(CertificateInfo certificate, boolean strictVerifier){
  193.         try{
  194.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiSsl(certificate, strictVerifier)!=null;
  195.         }catch(Exception e){
  196.             return false;
  197.         }  
  198.     }
  199.    
  200.     @Override
  201.     public ServizioApplicativo getServizioApplicativoByCredenzialiSsl(CertificateInfo certificate, boolean strictVerifier) throws RegistryNotFound,RegistryException{
  202.         try{
  203.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiSsl(certificate, strictVerifier);
  204.         } catch (DriverConfigurazioneNotFound de) {
  205.             throw new RegistryNotFound(de.getMessage(),de);
  206.         }catch(Exception e){
  207.             throw new RegistryException(e.getMessage(),e);
  208.         }
  209.     }
  210.    
  211.     @Override
  212.     public boolean existsServizioApplicativoByCredenzialiSsl(CertificateInfo certificate, boolean strictVerifier,
  213.             List<String> tipiSoggetto,
  214.             boolean includiApplicativiNonModI, boolean includiApplicativiModIEsterni, boolean includiApplicativiModIInterni) {
  215.         try{
  216.             return this.getServizioApplicativoByCredenzialiSsl(certificate, strictVerifier,
  217.                     tipiSoggetto,
  218.                     includiApplicativiNonModI, includiApplicativiModIEsterni, includiApplicativiModIInterni)!=null;
  219.         }catch(Exception e){
  220.             return false;
  221.         }  
  222.     }
  223.     @Override
  224.     public ServizioApplicativo getServizioApplicativoByCredenzialiSsl(CertificateInfo certificate, boolean strictVerifier,
  225.             List<String> tipiSoggetto,
  226.             boolean includiApplicativiNonModI, boolean includiApplicativiModIEsterni, boolean includiApplicativiModIInterni) throws RegistryNotFound,RegistryException{
  227.         try{
  228.             if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  229.                 return ((DriverConfigurazioneDB)this.driverConfigurazioneGET).getServizioApplicativoByCredenzialiSsl(certificate, strictVerifier);
  230.             }
  231.             else {
  232.                 throw new RegistryException("Unsupported");
  233.             }
  234.         } catch (DriverConfigurazioneNotFound de) {
  235.             throw new RegistryNotFound(de.getMessage(),de);
  236.         }catch(Exception e){
  237.             throw new RegistryException(e.getMessage(),e);
  238.         }
  239.     }
  240.    
  241.     @Override
  242.     public boolean existsServizioApplicativoByCredenzialiPrincipal(String principal){
  243.         try{
  244.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiPrincipal(principal)!=null;
  245.         }catch(Exception e){
  246.             return false;
  247.         }  
  248.     }
  249.    
  250.     @Override
  251.     public ServizioApplicativo getServizioApplicativoByCredenzialiPrincipal(String principal) throws RegistryNotFound,RegistryException{
  252.         try{
  253.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiPrincipal(principal);
  254.         } catch (DriverConfigurazioneNotFound de) {
  255.             throw new RegistryNotFound(de.getMessage(),de);
  256.         }catch(Exception e){
  257.             throw new RegistryException(e.getMessage(),e);
  258.         }
  259.     }
  260.    
  261.     @Override
  262.     public boolean existsServizioApplicativoByCredenzialiToken(String tokenPolicy, String tokenClientId, boolean tokenWithHttpsEnabled) {
  263.         try{
  264.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiToken(tokenPolicy, tokenClientId, tokenWithHttpsEnabled)!=null;
  265.         }catch(Exception e){
  266.             return false;
  267.         }
  268.     }
  269.    
  270.     @Override
  271.     public ServizioApplicativo getServizioApplicativoByCredenzialiToken(String tokenPolicy, String tokenClientId, boolean tokenWithHttpsEnabled) throws RegistryNotFound,RegistryException{
  272.         try{
  273.             return this.driverConfigurazioneGET.getServizioApplicativoByCredenzialiToken(tokenPolicy, tokenClientId, tokenWithHttpsEnabled);
  274.         } catch (DriverConfigurazioneNotFound de) {
  275.             throw new RegistryNotFound(de.getMessage(),de);
  276.         }catch(Exception e){
  277.             throw new RegistryException(e.getMessage(),e);
  278.         }
  279.     }
  280.    
  281.     @Override
  282.     public ServizioApplicativo getServizioApplicativo(IDServizioApplicativo idServizioApplicativo) throws RegistryNotFound,RegistryException{
  283.         try{
  284.             return this.driverConfigurazioneGET.getServizioApplicativo(idServizioApplicativo);
  285.         } catch (DriverConfigurazioneNotFound de) {
  286.             throw new RegistryNotFound(de.getMessage(),de);
  287.         }catch(Exception e){
  288.             throw new RegistryException(e.getMessage(),e);
  289.         }
  290.     }
  291.        
  292.     @Override
  293.     public List<IDServizioApplicativo> findIdServiziApplicativi(ProtocolFiltroRicercaServiziApplicativi filtroRicerca) throws RegistryNotFound,RegistryException{
  294.         try{
  295.             return this.driverConfigurazioneGET.getAllIdServiziApplicativi(filtroRicerca);
  296.         } catch (DriverConfigurazioneNotFound de) {
  297.             throw new RegistryNotFound(de.getMessage(),de);
  298.         }catch(Exception e){
  299.             throw new RegistryException(e.getMessage(),e);
  300.         }
  301.     }
  302.    
  303.     @Override
  304.     public List<IDServizioApplicativo> findIdServiziApplicativiByPaAuth(PortaApplicativa pa, boolean authToken, boolean authTrasporto) throws RegistryNotFound,RegistryException{
  305.         try{
  306.             if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  307.                 IDSoggetto idSoggetto = new IDSoggetto(pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario());
  308.                 String superuser = null;
  309.                
  310.                 boolean returnAll = false;
  311.                
  312.                 boolean bothSslAndToken = false;
  313.                 String tokenPolicy = null;
  314.                 boolean tokenPolicyOR = false;
  315.                 if(pa.getGestioneToken()!=null && pa.getGestioneToken().getPolicy()!=null) {
  316.                     tokenPolicy = pa.getGestioneToken().getPolicy();
  317.                 }
  318.                
  319.                 // find by credenziali trasporto        
  320.                 List<IDServizioApplicativo> ltrasporto = null;
  321.                 if(authTrasporto) {
  322.                     if(pa.getAutenticazione()!=null && StringUtils.isNotEmpty(pa.getAutenticazione())) {
  323.                         TipoAutenticazione auth = TipoAutenticazione.toEnumConstant(pa.getAutenticazione(), false);
  324.                         if(auth==null || TipoAutenticazione.DISABILITATO.equals(auth)) {
  325.                             returnAll = true;
  326.                         }
  327.                     }
  328.                     if(returnAll) {
  329.                         return findIdServiziApplicativiByAuthTrasporto(idSoggetto, returnAll, pa.getAutenticazione(), tokenPolicy, pa.getProprietaAutenticazione());
  330.                     }
  331.                     else {
  332.                         ltrasporto = findIdServiziApplicativiByAuthTrasporto(idSoggetto, returnAll, pa.getAutenticazione(), tokenPolicy, pa.getProprietaAutenticazione());
  333.                     }
  334.                 }
  335.                
  336.                 // find by token
  337.                 List<IDServizioApplicativoDB> ltoken = null;
  338.                 if(authToken &&
  339.                     tokenPolicy!=null) {
  340.                     ltoken = ((DriverConfigurazioneDB)this.driverConfigurazioneGET).soggettiServizioApplicativoList(idSoggetto,superuser, CredenzialeTipo.TOKEN,
  341.                             false, CostantiConfigurazione.CLIENT,
  342.                             bothSslAndToken, tokenPolicy, tokenPolicyOR);
  343.                 }

  344.                 List<IDServizioApplicativo> lSA = new ArrayList<>();
  345.                 List<String> nomi = new ArrayList<>();
  346.                 if(ltrasporto!=null && !ltrasporto.isEmpty()) {
  347.                     for (IDServizioApplicativo idSADB : ltrasporto) {
  348.                         lSA.add(idSADB);
  349.                         nomi.add(idSADB.getNome());
  350.                     }
  351.                 }
  352.                 if(ltoken!=null && !ltoken.isEmpty()) {
  353.                     for (IDServizioApplicativoDB idSADB : ltoken) {
  354.                         if(!nomi.contains(idSADB.getNome())) {
  355.                             lSA.add(idSADB);
  356.                             nomi.add(idSADB.getNome());
  357.                         }
  358.                     }
  359.                 }
  360.                 if(lSA.isEmpty()) {
  361.                     throw new RegistryNotFound("Servizi applicativi non trovati");
  362.                 }
  363.                 return lSA;
  364.             }
  365.             else {
  366.                 throw new RegistryException("Unsupported");
  367.             }
  368.         }
  369.         catch (RegistryNotFound notFound) {
  370.             throw notFound;
  371.         }
  372.         catch(Exception e){
  373.             throw new RegistryException(e.getMessage(),e);
  374.         }
  375.     }
  376.    
  377.     @Override
  378.     public List<IDServizioApplicativo> findIdServiziApplicativiByPdAuth(PortaDelegata pd, boolean authToken, boolean authTrasporto) throws RegistryNotFound,RegistryException{
  379.         try{
  380.             if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  381.                 IDSoggetto idSoggetto = new IDSoggetto(pd.getTipoSoggettoProprietario(), pd.getNomeSoggettoProprietario());
  382.                 String superuser = null;
  383.                
  384.                 boolean returnAll = false;
  385.                
  386.                 boolean bothSslAndToken = false;
  387.                 String tokenPolicy = null;
  388.                 boolean tokenPolicyOR = false;
  389.                 if(pd.getGestioneToken()!=null && pd.getGestioneToken().getPolicy()!=null) {
  390.                     tokenPolicy = pd.getGestioneToken().getPolicy();
  391.                 }
  392.                
  393.                 // find by credenziali trasporto        
  394.                 List<IDServizioApplicativo> ltrasporto = null;
  395.                 if(authTrasporto) {
  396.                     if(pd.getAutenticazione()!=null && StringUtils.isNotEmpty(pd.getAutenticazione())) {
  397.                         TipoAutenticazione auth = TipoAutenticazione.toEnumConstant(pd.getAutenticazione(), false);
  398.                         if(auth==null || TipoAutenticazione.DISABILITATO.equals(auth)) {
  399.                             returnAll = true;
  400.                         }
  401.                     }
  402.                     if(returnAll) {
  403.                         return findIdServiziApplicativiByAuthTrasporto(idSoggetto, returnAll, pd.getAutenticazione(), tokenPolicy, pd.getProprietaAutenticazione());
  404.                     }
  405.                     else {
  406.                         ltrasporto = findIdServiziApplicativiByAuthTrasporto(idSoggetto, returnAll, pd.getAutenticazione(), tokenPolicy, pd.getProprietaAutenticazione());
  407.                     }
  408.                 }
  409.                
  410.                 // find by token
  411.                 List<IDServizioApplicativoDB> ltoken = null;
  412.                 if(authToken &&
  413.                     tokenPolicy!=null) {
  414.                     ltoken = ((DriverConfigurazioneDB)this.driverConfigurazioneGET).soggettiServizioApplicativoList(idSoggetto,superuser, CredenzialeTipo.TOKEN,
  415.                             false, CostantiConfigurazione.CLIENT,
  416.                             bothSslAndToken, tokenPolicy, tokenPolicyOR);
  417.                 }

  418.                 List<IDServizioApplicativo> lSA = new ArrayList<>();
  419.                 List<String> nomi = new ArrayList<>();
  420.                 if(ltrasporto!=null && !ltrasporto.isEmpty()) {
  421.                     for (IDServizioApplicativo idSADB : ltrasporto) {
  422.                         lSA.add(idSADB);
  423.                         nomi.add(idSADB.getNome());
  424.                     }
  425.                 }
  426.                 if(ltoken!=null && !ltoken.isEmpty()) {
  427.                     for (IDServizioApplicativoDB idSADB : ltoken) {
  428.                         if(!nomi.contains(idSADB.getNome())) {
  429.                             lSA.add(idSADB);
  430.                             nomi.add(idSADB.getNome());
  431.                         }
  432.                     }
  433.                 }
  434.                 if(lSA.isEmpty()) {
  435.                     throw new RegistryNotFound("Servizi applicativi non trovati");
  436.                 }
  437.                 return lSA;
  438.             }
  439.             else {
  440.                 throw new RegistryException("Unsupported");
  441.             }
  442.         }
  443.         catch (RegistryNotFound notFound) {
  444.             throw notFound;
  445.         }
  446.         catch(Exception e){
  447.             throw new RegistryException(e.getMessage(),e);
  448.         }
  449.     }
  450.     private List<IDServizioApplicativo> findIdServiziApplicativiByAuthTrasporto(IDSoggetto idSoggetto, boolean returnAll, String autenticazione, String tokenPolicy, List<Proprieta> listProprietaAutenticazione) throws RegistryNotFound, RegistryException, DriverConfigurazioneException{
  451.         // find by credenziali trasporto
  452.         if(returnAll) {
  453.             ProtocolFiltroRicercaServiziApplicativi f = new ProtocolFiltroRicercaServiziApplicativi();
  454.             f.setTipoSoggetto(idSoggetto.getTipo());
  455.             f.setNomeSoggetto(idSoggetto.getNome());
  456.             f.setTipo(CostantiConfigurazione.CLIENT);
  457.             return this.findIdServiziApplicativi(f);
  458.         }
  459.         else {
  460.             Boolean appId = null;
  461.             CredenzialeTipo tipoAutenticazione = CredenzialeTipo.toEnumConstant(autenticazione);
  462.             if(CredenzialeTipo.APIKEY.equals(tipoAutenticazione) && listProprietaAutenticazione!=null && !listProprietaAutenticazione.isEmpty()) {
  463.                 for (Proprieta proprieta : listProprietaAutenticazione) {
  464.                     if("appId".equals(proprieta.getNome())) {
  465.                         appId = "true".equals(proprieta.getValore());
  466.                         break;
  467.                     }
  468.                 }
  469.             }
  470.             boolean bothSslAndToken = false;
  471.             boolean tokenPolicyOR = false;
  472.             List<IDServizioApplicativoDB> ltrasporto = ((DriverConfigurazioneDB)this.driverConfigurazioneGET).soggettiServizioApplicativoList(idSoggetto,null,tipoAutenticazione,
  473.                     appId, CostantiConfigurazione.CLIENT,
  474.                     bothSslAndToken, tokenPolicy, tokenPolicyOR);
  475.             List<IDServizioApplicativo> lSA = new ArrayList<>();
  476.             for (IDServizioApplicativoDB idSADB : ltrasporto) {
  477.                 lSA.add(idSADB);
  478.             }
  479.             return lSA;
  480.         }
  481.        
  482.     }
  483.    
  484.     @Override
  485.     public boolean inUso(IDServizioApplicativo idServizioApplicativo, boolean verificaRuoli) throws RegistryException{
  486.         return this.inUsoDriver.inUso(idServizioApplicativo, verificaRuoli);
  487.     }
  488.    
  489.     @Override
  490.     public String getDettagliInUso(IDServizioApplicativo idServizioApplicativo, boolean verificaRuoli) throws RegistryException{
  491.         return this.inUsoDriver.getDettagliInUso(idServizioApplicativo, verificaRuoli);
  492.     }
  493.    
  494.    
  495.    
  496.    
  497.     // PORTA DELEGATA
  498.    
  499.     @Override
  500.     public IDPortaDelegata getIdPortaDelegata(String nome, IProtocolFactory<?> protocolFactory) throws RegistryNotFound,RegistryException{
  501.        
  502.         try{
  503.             return this.driverConfigurazioneGET.getIDPortaDelegata(nome);
  504.         } catch (DriverConfigurazioneNotFound de) {
  505.             throw new RegistryNotFound(de.getMessage(),de);
  506.         }catch(Exception e){
  507.             throw new RegistryException(e.getMessage(),e);
  508.         }

  509.     }
  510.    
  511.     @Override
  512.     public boolean existsPortaDelegata(IDPortaDelegata idPortaDelegata){
  513.         try{
  514.             if(this.driverConfigurazioneCRUD!=null){
  515.                 return this.driverConfigurazioneCRUD.existsPortaDelegata(idPortaDelegata);
  516.             }
  517.             else{
  518.                 return this.driverConfigurazioneGET.getPortaDelegata(idPortaDelegata)!=null;
  519.             }
  520.         }catch(Exception e){
  521.             return false;
  522.         }  
  523.     }
  524.    
  525.     @Override
  526.     public PortaDelegata getPortaDelegata(IDPortaDelegata idPortaDelegata) throws RegistryNotFound,RegistryException{
  527.         try{
  528.             return this.driverConfigurazioneGET.getPortaDelegata(idPortaDelegata);
  529.         } catch (DriverConfigurazioneNotFound de) {
  530.             throw new RegistryNotFound(de.getMessage(),de);
  531.         }catch(Exception e){
  532.             throw new RegistryException(e.getMessage(),e);
  533.         }
  534.     }
  535.    
  536.     @Override
  537.     public List<IDPortaDelegata> findIdPorteDelegate(ProtocolFiltroRicercaPorteDelegate filtroRicerca) throws RegistryNotFound,RegistryException{
  538.         try{
  539.             return this.driverConfigurazioneGET.getAllIdPorteDelegate(filtroRicerca);
  540.         } catch (DriverConfigurazioneNotFound de) {
  541.             throw new RegistryNotFound(de.getMessage(),de);
  542.         }catch(Exception e){
  543.             throw new RegistryException(e.getMessage(),e);
  544.         }
  545.     }
  546.    
  547.     @Override
  548.     public List<AttivazionePolicy> getRateLimitingPolicy(IDPortaDelegata idPortaDelegata) throws RegistryNotFound,RegistryException{
  549.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  550.            
  551.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  552.             Connection con = null;
  553.             try {
  554.                 con = driver.getConnection("getRateLimitingPolicy(portaDelegata)");
  555.                
  556.                 org.openspcoop2.core.commons.Search search = new Search(true);
  557.                 return ControlloTrafficoDriverUtils.configurazioneControlloTrafficoAttivazionePolicyList(search, RuoloPolicy.DELEGATA, idPortaDelegata.getNome(),
  558.                         con, this.log, driver.getTipoDB());
  559.                
  560.             }
  561.             catch(Exception e) {
  562.                 throw new RegistryException(e.getMessage(),e);
  563.             }
  564.             finally {
  565.                 try {
  566.                     if(con!=null) {
  567.                         driver.releaseConnection(con);
  568.                     }
  569.                 }catch(Exception eClose) {
  570.                     // close
  571.                 }
  572.             }
  573.            
  574.         }
  575.         else {
  576.             throw new RegistryException(NOT_IMPLEMENTED);
  577.         }
  578.     }
  579.    
  580.     @Override
  581.     public List<Allarme> getAllarmi(IDPortaDelegata idPortaDelegata) throws RegistryNotFound,RegistryException{
  582.         if(!CostantiDB.isAllarmiEnabled()) {
  583.             return new ArrayList<>();
  584.         }
  585.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  586.            
  587.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  588.             Connection con = null;
  589.             try {
  590.                 con = driver.getConnection("getAllarmi(portaDelegata)");
  591.                
  592.                 org.openspcoop2.core.commons.Search search = new Search(true);
  593.                 return AllarmiDriverUtils.allarmiList(search, RuoloPorta.DELEGATA, idPortaDelegata.getNome(),
  594.                         con, this.log, driver.getTipoDB());
  595.                
  596.             }
  597.             catch(Exception e) {
  598.                 throw new RegistryException(e.getMessage(),e);
  599.             }
  600.             finally {
  601.                 try {
  602.                     if(con!=null) {
  603.                         driver.releaseConnection(con);
  604.                     }
  605.                 }catch(Exception eClose) {
  606.                     // close
  607.                 }
  608.             }
  609.            
  610.         }
  611.         else {
  612.             throw new RegistryException(NOT_IMPLEMENTED);
  613.         }
  614.     }
  615.    
  616.     @Override
  617.     public List<MappingFruizionePortaDelegata> getMappingFruizionePortaDelegataList(IDSoggetto idFruitore, IDServizio idServizio) throws RegistryException{
  618.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  619.            
  620.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  621.             Connection con = null;
  622.             try {
  623.                 con = driver.getConnection("getMappingFruizionePortaDelegataList");
  624.                
  625.                 return DBMappingUtils.mappingFruizionePortaDelegataList(con, driver.getTipoDB(), idFruitore, idServizio, false);
  626.                
  627.             }
  628.             catch(Exception e) {
  629.                 throw new RegistryException(e.getMessage(),e);
  630.             }
  631.             finally {
  632.                 try {
  633.                     if(con!=null) {
  634.                         driver.releaseConnection(con);
  635.                     }
  636.                 }catch(Exception eClose) {
  637.                     // close
  638.                 }
  639.             }
  640.            
  641.         }
  642.         else {
  643.             throw new RegistryException(NOT_IMPLEMENTED);
  644.         }
  645.     }
  646.        
  647.    
  648.    
  649.    
  650.    
  651.        
  652.     // PORTA APPLICATIVA
  653.        
  654.     @Override
  655.     public IDPortaApplicativa getIdPortaApplicativa(String nome, IProtocolFactory<?> protocolFactory) throws RegistryNotFound,RegistryException{
  656.        
  657.         try{
  658.             return this.driverConfigurazioneGET.getIDPortaApplicativa(nome);
  659.         } catch (DriverConfigurazioneNotFound de) {
  660.             throw new RegistryNotFound(de.getMessage(),de);
  661.         }catch(Exception e){
  662.             throw new RegistryException(e.getMessage(),e);
  663.         }

  664.     }
  665.        
  666.     @Override
  667.     public boolean existsPortaApplicativa(IDPortaApplicativa idPortaApplicativa){
  668.         try{
  669.             if(this.driverConfigurazioneCRUD!=null){
  670.                 return this.driverConfigurazioneCRUD.existsPortaApplicativa(idPortaApplicativa);
  671.             }
  672.             else{
  673.                 return this.driverConfigurazioneGET.getPortaApplicativa(idPortaApplicativa)!=null;
  674.             }
  675.         }catch(Exception e){
  676.             return false;
  677.         }  
  678.     }
  679.    
  680.     @Override
  681.     public PortaApplicativa getPortaApplicativa(IDPortaApplicativa idPortaApplicativa) throws RegistryNotFound,RegistryException{
  682.         try{
  683.             return this.driverConfigurazioneGET.getPortaApplicativa(idPortaApplicativa);
  684.         } catch (DriverConfigurazioneNotFound de) {
  685.             throw new RegistryNotFound(de.getMessage(),de);
  686.         }catch(Exception e){
  687.             throw new RegistryException(e.getMessage(),e);
  688.         }
  689.     }
  690.    
  691.     @Override
  692.     public List<IDPortaApplicativa> findIdPorteApplicative(ProtocolFiltroRicercaPorteApplicative filtroRicerca) throws RegistryNotFound,RegistryException{
  693.         try{
  694.             return this.driverConfigurazioneGET.getAllIdPorteApplicative(filtroRicerca);
  695.         } catch (DriverConfigurazioneNotFound de) {
  696.             throw new RegistryNotFound(de.getMessage(),de);
  697.         }catch(Exception e){
  698.             throw new RegistryException(e.getMessage(),e);
  699.         }
  700.     }
  701.    
  702.    
  703.     @Override
  704.     public List<AttivazionePolicy> getRateLimitingPolicy(IDPortaApplicativa idPortaApplicativa) throws RegistryNotFound,RegistryException{
  705.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  706.            
  707.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  708.             Connection con = null;
  709.             try {
  710.                 con = driver.getConnection("getRateLimitingPolicy(portaApplicativa)");
  711.                
  712.                 org.openspcoop2.core.commons.Search search = new Search(true);
  713.                 return ControlloTrafficoDriverUtils.configurazioneControlloTrafficoAttivazionePolicyList(search, RuoloPolicy.APPLICATIVA, idPortaApplicativa.getNome(),
  714.                         con, this.log, driver.getTipoDB());
  715.                
  716.             }
  717.             catch(Exception e) {
  718.                 throw new RegistryException(e.getMessage(),e);
  719.             }
  720.             finally {
  721.                 try {
  722.                     if(con!=null) {
  723.                         driver.releaseConnection(con);
  724.                     }
  725.                 }catch(Exception eClose) {
  726.                     // close
  727.                 }
  728.             }
  729.            
  730.         }
  731.         else {
  732.             throw new RegistryException(NOT_IMPLEMENTED);
  733.         }
  734.     }
  735.    
  736.     @Override
  737.     public List<Allarme> getAllarmi(IDPortaApplicativa idPortaApplicativa) throws RegistryNotFound,RegistryException{
  738.         if(!CostantiDB.isAllarmiEnabled()) {
  739.             return new ArrayList<>();
  740.         }
  741.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  742.            
  743.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  744.             Connection con = null;
  745.             try {
  746.                 con = driver.getConnection("getAllarmi(portaApplicativa)");
  747.                
  748.                 org.openspcoop2.core.commons.Search search = new Search(true);
  749.                 return AllarmiDriverUtils.allarmiList(search, RuoloPorta.APPLICATIVA, idPortaApplicativa.getNome(),
  750.                         con, this.log, driver.getTipoDB());
  751.                
  752.             }
  753.             catch(Exception e) {
  754.                 throw new RegistryException(e.getMessage(),e);
  755.             }
  756.             finally {
  757.                 try {
  758.                     if(con!=null) {
  759.                         driver.releaseConnection(con);
  760.                     }
  761.                 }catch(Exception eClose) {
  762.                     // close
  763.                 }
  764.             }
  765.            
  766.         }
  767.         else {
  768.             throw new RegistryException(NOT_IMPLEMENTED);
  769.         }
  770.     }
  771.    
  772.     @Override
  773.     public List<MappingErogazionePortaApplicativa> getMappingErogazionePortaApplicativaList(IDServizio idServizio) throws RegistryException{
  774.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  775.            
  776.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  777.             Connection con = null;
  778.             try {
  779.                 con = driver.getConnection("getMappingErogazionePortaApplicativaList");
  780.                
  781.                 return DBMappingUtils.mappingErogazionePortaApplicativaList(con, driver.getTipoDB(), idServizio, false);
  782.                
  783.             }
  784.             catch(Exception e) {
  785.                 throw new RegistryException(e.getMessage(),e);
  786.             }
  787.             finally {
  788.                 try {
  789.                     if(con!=null) {
  790.                         driver.releaseConnection(con);
  791.                     }
  792.                 }catch(Exception eClose) {
  793.                     // close
  794.                 }
  795.             }
  796.            
  797.         }
  798.         else {
  799.             throw new RegistryException(NOT_IMPLEMENTED);
  800.         }
  801.     }
  802.    
  803.    

  804.     // CONFIGURAZIONE
  805.    
  806.     @Override
  807.     public ConfigurazioneMultitenant getConfigurazioneMultitenant() throws RegistryNotFound,RegistryException{
  808.         try{
  809.             ConfigurazioneMultitenant conf = this.driverConfigurazioneGET.getConfigurazioneGenerale().getMultitenant();
  810.             if(conf==null) {
  811.                 return new ConfigurazioneMultitenant();
  812.             }
  813.             return conf;
  814.         } catch (DriverConfigurazioneNotFound de) {
  815.             throw new RegistryNotFound(de.getMessage(),de);
  816.         }catch(Exception e){
  817.             throw new RegistryException(e.getMessage(),e);
  818.         }
  819.     }
  820.    
  821.     @Override
  822.     public CanaliConfigurazione getCanaliConfigurazione() throws RegistryNotFound,RegistryException{
  823.         try{
  824.             return this.driverConfigurazioneGET.getCanaliConfigurazione();
  825.         } catch (DriverConfigurazioneNotFound de) {
  826.             throw new RegistryNotFound(de.getMessage(),de);
  827.         }catch(Exception e){
  828.             throw new RegistryException(e.getMessage(),e);
  829.         }
  830.     }
  831.    
  832.     @Override
  833.     public List<AttivazionePolicy> getRateLimitingPolicyGlobali() throws RegistryNotFound,RegistryException{
  834.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  835.            
  836.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  837.             Connection con = null;
  838.             try {
  839.                 con = driver.getConnection("getRateLimitingPolicyGlobali");
  840.                
  841.                 org.openspcoop2.core.commons.Search search = new Search(true);
  842.                 return ControlloTrafficoDriverUtils.configurazioneControlloTrafficoAttivazionePolicyList(search, null, null,
  843.                         con, this.log, driver.getTipoDB());
  844.                
  845.             }
  846.             catch(Exception e) {
  847.                 throw new RegistryException(e.getMessage(),e);
  848.             }
  849.             finally {
  850.                 try {
  851.                     if(con!=null) {
  852.                         driver.releaseConnection(con);
  853.                     }
  854.                 }catch(Exception eClose) {
  855.                     // close
  856.                 }
  857.             }
  858.            
  859.         }
  860.         else {
  861.             throw new RegistryException(NOT_IMPLEMENTED);
  862.         }
  863.     }
  864.    
  865.     @Override
  866.     public String getNextPolicyInstanceSerialId(String policyId) throws RegistryException{
  867.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  868.            
  869.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  870.             Connection con = null;
  871.             try {
  872.                 con = driver.getConnection("getNextPolicyInstanceSerialId");
  873.                
  874.                 return ControlloTrafficoDriverUtils.getNextPolicyInstanceSerialId(policyId,
  875.                         con, this.log, driver.getTipoDB());
  876.                
  877.             }
  878.             catch(Exception e) {
  879.                 throw new RegistryException(e.getMessage(),e);
  880.             }
  881.             finally {
  882.                 try {
  883.                     if(con!=null) {
  884.                         driver.releaseConnection(con);
  885.                     }
  886.                 }catch(Exception eClose) {
  887.                     // close
  888.                 }
  889.             }
  890.            
  891.         }
  892.         else {
  893.             throw new RegistryException(NOT_IMPLEMENTED);
  894.         }
  895.     }

  896.     @Override
  897.     public List<Allarme> getAllarmiGlobali() throws RegistryNotFound,RegistryException{
  898.         if(!CostantiDB.isAllarmiEnabled()) {
  899.             return new ArrayList<>();
  900.         }
  901.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  902.            
  903.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  904.             Connection con = null;
  905.             try {
  906.                 con = driver.getConnection("getAllarmiGlobali");
  907.                
  908.                 org.openspcoop2.core.commons.Search search = new Search(true);
  909.                 return AllarmiDriverUtils.allarmiList(search, null, null,
  910.                         con, this.log, driver.getTipoDB());
  911.                
  912.             }
  913.             catch(Exception e) {
  914.                 throw new RegistryException(e.getMessage(),e);
  915.             }
  916.             finally {
  917.                 try {
  918.                     if(con!=null) {
  919.                         driver.releaseConnection(con);
  920.                     }
  921.                 }catch(Exception eClose) {
  922.                     // close
  923.                 }
  924.             }
  925.            
  926.         }
  927.         else {
  928.             throw new RegistryException(NOT_IMPLEMENTED);
  929.         }
  930.     }
  931.    
  932.     @Override
  933.     public String getNextAlarmInstanceSerialId(String tipoPlugin) throws RegistryException{
  934.         if(!CostantiDB.isAllarmiEnabled()) {
  935.             throw new RegistryException("Alarm not supported");
  936.         }
  937.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  938.            
  939.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  940.             Connection con = null;
  941.             try {
  942.                 con = driver.getConnection("getNextAlarmInstanceSerialId");
  943.                
  944.                 return AllarmiDriverUtils.getNextAlarmInstanceSerialId(tipoPlugin,
  945.                         con, this.log, driver.getTipoDB());
  946.                
  947.             }
  948.             catch(Exception e) {
  949.                 throw new RegistryException(e.getMessage(),e);
  950.             }
  951.             finally {
  952.                 try {
  953.                     if(con!=null) {
  954.                         driver.releaseConnection(con);
  955.                     }
  956.                 }catch(Exception eClose) {
  957.                     // close
  958.                 }
  959.             }
  960.            
  961.         }
  962.         else {
  963.             throw new RegistryException(NOT_IMPLEMENTED);
  964.         }
  965.     }
  966.    
  967.     @Override
  968.     public List<GenericProperties> getTokenPolicyValidazione() throws RegistryException{
  969.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  970.            
  971.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  972.             try {
  973.                 org.openspcoop2.core.commons.Search search = new Search(true);
  974.                 List<String> tipologiaList = new ArrayList<>();
  975.                 tipologiaList.add(CostantiConfigurazione.GENERIC_PROPERTIES_TOKEN_TIPOLOGIA_VALIDATION);
  976.                 return driver.getGenericProperties(tipologiaList, Liste.CONFIGURAZIONE_GESTIONE_POLICY_TOKEN, search,false);
  977.             }
  978.             catch(Exception e) {
  979.                 throw new RegistryException(e.getMessage(),e);
  980.             }
  981.            
  982.         }
  983.         else {
  984.             throw new RegistryException(NOT_IMPLEMENTED);
  985.         }
  986.     }
  987.     @Override
  988.     public GenericProperties getTokenPolicyValidazione(String nome) throws RegistryNotFound,RegistryException{
  989.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  990.            
  991.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  992.             try {
  993.                 GenericProperties gp = driver.getGenericProperties(CostantiConfigurazione.GENERIC_PROPERTIES_TOKEN_TIPOLOGIA_VALIDATION, nome);
  994.                 if(gp==null) {
  995.                     throw new DriverConfigurazioneNotFound();
  996.                 }
  997.                 return gp;
  998.             } catch (DriverConfigurazioneNotFound de) {
  999.                 throw new RegistryNotFound(de.getMessage(),de);
  1000.             }
  1001.             catch(Exception e) {
  1002.                 throw new RegistryException(e.getMessage(),e);
  1003.             }
  1004.            
  1005.         }
  1006.         else {
  1007.             throw new RegistryException(NOT_IMPLEMENTED);
  1008.         }
  1009.     }
  1010.    
  1011.     @Override
  1012.     public List<GenericProperties> getTokenPolicyNegoziazione() throws RegistryException{
  1013.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  1014.            
  1015.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  1016.             try {
  1017.                 org.openspcoop2.core.commons.Search search = new Search(true);
  1018.                 List<String> tipologiaList = new ArrayList<>();
  1019.                 tipologiaList.add(CostantiConfigurazione.GENERIC_PROPERTIES_TOKEN_TIPOLOGIA_RETRIEVE);
  1020.                 return driver.getGenericProperties(tipologiaList, Liste.CONFIGURAZIONE_GESTIONE_POLICY_TOKEN, search,false);
  1021.             }
  1022.             catch(Exception e) {
  1023.                 throw new RegistryException(e.getMessage(),e);
  1024.             }
  1025.            
  1026.         }
  1027.         else {
  1028.             throw new RegistryException(NOT_IMPLEMENTED);
  1029.         }
  1030.     }
  1031.     @Override
  1032.     public GenericProperties getTokenPolicyNegoziazione(String nome) throws RegistryNotFound,RegistryException{
  1033.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  1034.            
  1035.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  1036.             try {
  1037.                 GenericProperties gp = driver.getGenericProperties(CostantiConfigurazione.GENERIC_PROPERTIES_TOKEN_TIPOLOGIA_RETRIEVE, nome);
  1038.                 if(gp==null) {
  1039.                     throw new DriverConfigurazioneNotFound();
  1040.                 }
  1041.                 return gp;
  1042.             } catch (DriverConfigurazioneNotFound de) {
  1043.                 throw new RegistryNotFound(de.getMessage(),de);
  1044.             }
  1045.             catch(Exception e) {
  1046.                 throw new RegistryException(e.getMessage(),e);
  1047.             }
  1048.            
  1049.         }
  1050.         else {
  1051.             throw new RegistryException(NOT_IMPLEMENTED);
  1052.         }
  1053.     }
  1054.    
  1055.     @Override
  1056.     public List<GenericProperties> getAttributeAuthority() throws RegistryException{
  1057.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  1058.            
  1059.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  1060.             try {
  1061.                 org.openspcoop2.core.commons.Search search = new Search(true);
  1062.                 List<String> tipologiaList = new ArrayList<>();
  1063.                 tipologiaList.add(CostantiConfigurazione.GENERIC_PROPERTIES_ATTRIBUTE_AUTHORITY);
  1064.                 return driver.getGenericProperties(tipologiaList, Liste.CONFIGURAZIONE_GESTIONE_ATTRIBUTE_AUTHORITY, search,false);
  1065.             }
  1066.             catch(Exception e) {
  1067.                 throw new RegistryException(e.getMessage(),e);
  1068.             }
  1069.            
  1070.         }
  1071.         else {
  1072.             throw new RegistryException(NOT_IMPLEMENTED);
  1073.         }
  1074.     }
  1075.     @Override
  1076.     public GenericProperties getAttributeAuthority(String nome) throws RegistryNotFound,RegistryException{
  1077.         if(this.driverConfigurazioneGET instanceof DriverConfigurazioneDB) {
  1078.            
  1079.             DriverConfigurazioneDB driver = (DriverConfigurazioneDB) this.driverConfigurazioneGET;
  1080.             try {
  1081.                 GenericProperties gp = driver.getGenericProperties(CostantiConfigurazione.GENERIC_PROPERTIES_ATTRIBUTE_AUTHORITY, nome);
  1082.                 if(gp==null) {
  1083.                     throw new DriverConfigurazioneNotFound();
  1084.                 }
  1085.                 return gp;
  1086.             } catch (DriverConfigurazioneNotFound de) {
  1087.                 throw new RegistryNotFound(de.getMessage(),de);
  1088.             }
  1089.             catch(Exception e) {
  1090.                 throw new RegistryException(e.getMessage(),e);
  1091.             }
  1092.            
  1093.         }
  1094.         else {
  1095.             throw new RegistryException(NOT_IMPLEMENTED);
  1096.         }
  1097.     }

  1098. }