SoggettiCore.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.web.ctrlstat.servlet.soggetti;

  21. import java.sql.Connection;
  22. import java.util.ArrayList;
  23. import java.util.EnumMap;
  24. import java.util.Enumeration;
  25. import java.util.List;
  26. import java.util.Map;

  27. import org.openspcoop2.core.commons.ErrorsHandlerCostant;
  28. import org.openspcoop2.core.commons.ISearch;
  29. import org.openspcoop2.core.config.Soggetto;
  30. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  31. import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
  32. import org.openspcoop2.core.config.driver.db.DriverConfigurazioneDB;
  33. import org.openspcoop2.core.id.IDSoggetto;
  34. import org.openspcoop2.core.registry.Proprieta;
  35. import org.openspcoop2.core.registry.constants.CredenzialeTipo;
  36. import org.openspcoop2.core.registry.constants.PddTipologia;
  37. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  38. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  39. import org.openspcoop2.core.registry.driver.FiltroRicercaSoggetti;
  40. import org.openspcoop2.core.registry.driver.db.IDSoggettoDB;
  41. import org.openspcoop2.pdd.core.autenticazione.ApiKey;
  42. import org.openspcoop2.pdd.core.autenticazione.ApiKeyUtilities;
  43. import org.openspcoop2.protocol.engine.utils.DBOggettiInUsoUtils;
  44. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  45. import org.openspcoop2.utils.certificate.CertificateInfo;
  46. import org.openspcoop2.utils.resources.MapReader;
  47. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  48. import org.openspcoop2.web.ctrlstat.dao.SoggettoCtrlStat;
  49. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationDB;
  50. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationException;
  51. import org.openspcoop2.web.ctrlstat.registro.GestoreRegistroServiziRemoto;
  52. import org.openspcoop2.web.lib.users.DriverUsersDBException;

  53. /**
  54.  * SoggettiCore
  55.  *
  56.  * @author Poli Andrea (apoli@link.it)
  57.  * @author $Author$
  58.  * @version $Rev$, $Date$
  59.  */
  60. public class SoggettiCore extends ControlStationCore {

  61.     public SoggettiCore() throws DriverControlStationException {
  62.         super();
  63.     }
  64.     public SoggettiCore(ControlStationCore core) throws DriverControlStationException {
  65.         super(core);
  66.     }
  67.        
  68.     public List<IDSoggetto> getAllIdSoggettiRegistro(FiltroRicercaSoggetti filtroRicerca) throws DriverRegistroServiziException {
  69.         Connection con = null;
  70.         String nomeMetodo = "getAllIdSoggettiRegistro";
  71.         DriverControlStationDB driver = null;

  72.         try {
  73.             if(this.isRegistroServiziLocale()){
  74.                 // prendo una connessione
  75.                 con = ControlStationCore.dbM.getConnection();
  76.                 // istanzio il driver
  77.                 driver = new DriverControlStationDB(con, null, this.tipoDB);
  78.    
  79.                 return driver.getDriverRegistroServiziDB().getAllIdSoggetti(filtroRicerca);
  80.             }
  81.             else{
  82.                 return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAllIdSoggetti(filtroRicerca);
  83.             }

  84.         } catch (DriverRegistroServiziNotFound de) {
  85.             ControlStationCore.logInfo(getPrefixError(nomeMetodo,  de));
  86.             return new ArrayList<>();
  87.         } catch (Exception e) {
  88.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  89.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  90.         } finally {
  91.             ControlStationCore.dbM.releaseConnection(con);
  92.         }
  93.     }

  94.     public boolean existsSoggetto(long idSoggetto) throws DriverRegistroServiziException {
  95.         Connection con = null;
  96.         String nomeMetodo = "existsSoggetto(long)";
  97.         DriverControlStationDB driver = null;

  98.         try {
  99.             // prendo una connessione
  100.             con = ControlStationCore.dbM.getConnection();
  101.             // istanzio il driver
  102.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  103.             return driver.getDriverRegistroServiziDB().existsSoggetto(idSoggetto);

  104.         } catch (Exception e) {
  105.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  106.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  107.         } finally {
  108.             ControlStationCore.dbM.releaseConnection(con);
  109.         }
  110.     }

  111.     public boolean existsSoggetto(IDSoggetto idSoggetto) throws DriverConfigurazioneException {
  112.         Connection con = null;
  113.         String nomeMetodo = "existsSoggetto";
  114.         DriverControlStationDB driver = null;

  115.         try {
  116.             // prendo una connessione
  117.             con = ControlStationCore.dbM.getConnection();
  118.             // istanzio il driver
  119.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  120.             return driver.getDriverConfigurazioneDB().existsSoggetto(idSoggetto);

  121.         } catch (Exception e) {
  122.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  123.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  124.         } finally {
  125.             ControlStationCore.dbM.releaseConnection(con);
  126.         }
  127.     }
  128.    
  129.     public boolean existsSoggetto(String codiceIPA) throws DriverConfigurazioneException {
  130.         Connection con = null;
  131.         String nomeMetodo = "existsSoggetto";
  132.         DriverControlStationDB driver = null;

  133.         try {
  134.             // prendo una connessione
  135.             con = ControlStationCore.dbM.getConnection();
  136.             // istanzio il driver
  137.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  138.             return driver.getDriverRegistroServiziDB().existsSoggetto(codiceIPA);

  139.         } catch (Exception e) {
  140.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  141.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  142.         } finally {
  143.             ControlStationCore.dbM.releaseConnection(con);
  144.         }
  145.     }
  146.    
  147.     public org.openspcoop2.core.registry.Soggetto getSoggettoByCodiceIPA(String codiceIPA) throws DriverConfigurazioneException,DriverRegistroServiziNotFound {
  148.         Connection con = null;
  149.         String nomeMetodo = "getSoggettoByCodiceIPA";
  150.         DriverControlStationDB driver = null;

  151.         try {
  152.             // prendo una connessione
  153.             con = ControlStationCore.dbM.getConnection();
  154.             // istanzio il driver
  155.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  156.             return driver.getDriverRegistroServiziDB().getSoggetto(codiceIPA);

  157.         } catch (DriverRegistroServiziNotFound de) {
  158.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  159.             throw de;
  160.         }catch (Exception e) {
  161.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  162.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  163.         } finally {
  164.             ControlStationCore.dbM.releaseConnection(con);
  165.         }
  166.     }
  167.    
  168.     public String getCodiceIPA(IDSoggetto idSoggetto) throws DriverRegistroServiziException,DriverRegistroServiziNotFound {
  169.         Connection con = null;
  170.         String nomeMetodo = "getCodiceIPA";
  171.         DriverControlStationDB driver = null;

  172.         try {
  173.             // prendo una connessione
  174.             con = ControlStationCore.dbM.getConnection();
  175.             // istanzio il driver
  176.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  177.             return driver.getDriverRegistroServiziDB().getCodiceIPA(idSoggetto);

  178.         } catch (DriverRegistroServiziNotFound de) {
  179.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  180.             throw de;
  181.         }catch (Exception e) {
  182.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  183.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  184.         } finally {
  185.             ControlStationCore.dbM.releaseConnection(con);
  186.         }
  187.     }
  188.    
  189.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistro(IDSoggetto idSoggetto) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  190.         Connection con = null;
  191.         String nomeMetodo = "getSoggettoRegistro";
  192.         DriverControlStationDB driver = null;

  193.         try {
  194.             if(this.isRegistroServiziLocale()){
  195.                 // prendo una connessione
  196.                 con = ControlStationCore.dbM.getConnection();
  197.                 // istanzio il driver
  198.                 driver = new DriverControlStationDB(con, null, this.tipoDB);
  199.    
  200.                 return driver.getDriverRegistroServiziDB().getSoggetto(idSoggetto);
  201.             }
  202.             else{
  203.                 return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getSoggetto(idSoggetto);
  204.             }

  205.         } catch (DriverRegistroServiziNotFound de) {
  206.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  207.             throw de;
  208.         } catch (Exception e) {
  209.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  210.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  211.         } finally {
  212.             ControlStationCore.dbM.releaseConnection(con);
  213.         }

  214.     }
  215.    
  216.     public IDSoggetto getIdSoggettoRegistro(long idErogatore) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  217.         Connection con = null;
  218.         String nomeMetodo = "getIdSoggettoRegistro";
  219.         DriverControlStationDB driver = null;

  220.         try {
  221.             // prendo una connessione
  222.             con = ControlStationCore.dbM.getConnection();
  223.             // istanzio il driver
  224.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  225.             return driver.getDriverRegistroServiziDB().getIdSoggetto(idErogatore);

  226.         } catch (DriverRegistroServiziNotFound de) {
  227.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  228.             throw de;
  229.         } catch (Exception e) {
  230.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  231.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  232.         } finally {
  233.             ControlStationCore.dbM.releaseConnection(con);
  234.         }
  235.     }
  236.    
  237.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistro(long idErogatore) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  238.         Connection con = null;
  239.         String nomeMetodo = "getSoggettoRegistro";
  240.         DriverControlStationDB driver = null;

  241.         try {
  242.             // prendo una connessione
  243.             con = ControlStationCore.dbM.getConnection();
  244.             // istanzio il driver
  245.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  246.             return driver.getDriverRegistroServiziDB().getSoggetto(idErogatore);

  247.         } catch (DriverRegistroServiziNotFound de) {
  248.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  249.             throw de;
  250.         } catch (Exception e) {
  251.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  252.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  253.         } finally {
  254.             ControlStationCore.dbM.releaseConnection(con);
  255.         }
  256.     }

  257.     public boolean existsSoggettoServiziWithoutConnettore(long idSoggetto) throws DriverRegistroServiziException {
  258.         Connection con = null;
  259.         String nomeMetodo = "existsSoggettoServiziWithoutConnettore";
  260.         DriverControlStationDB driver = null;

  261.         try {
  262.             // prendo una connessione
  263.             con = ControlStationCore.dbM.getConnection();
  264.             // istanzio il driver
  265.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  266.             return driver.getDriverRegistroServiziDB().existsSoggettoServiziWithoutConnettore(idSoggetto);

  267.         } catch (Exception e) {
  268.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  269.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  270.         } finally {
  271.             ControlStationCore.dbM.releaseConnection(con);
  272.         }
  273.     }
  274.    
  275.     public boolean existFruizioniServiziSoggettoWithoutConnettore(long idSoggetto, boolean escludiSoggettiEsterni) throws DriverRegistroServiziException {
  276.         Connection con = null;
  277.         String nomeMetodo = "existFruizioniServiziSoggettoWithoutConnettore";
  278.         DriverControlStationDB driver = null;

  279.         try {
  280.             // prendo una connessione
  281.             con = ControlStationCore.dbM.getConnection();
  282.             // istanzio il driver
  283.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  284.             return driver.getDriverRegistroServiziDB().existFruizioniServiziSoggettoWithoutConnettore(idSoggetto,escludiSoggettiEsterni);

  285.         } catch (Exception e) {
  286.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  287.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  288.         } finally {
  289.             ControlStationCore.dbM.releaseConnection(con);
  290.         }
  291.     }
  292.    
  293.     public Soggetto getRouter() throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  294.         Connection con = null;
  295.         String nomeMetodo = "getRouter";
  296.         DriverControlStationDB driver = null;

  297.         try {
  298.             // prendo una connessione
  299.             con = ControlStationCore.dbM.getConnection();
  300.             // istanzio il driver
  301.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  302.             return driver.getDriverConfigurazioneDB().getRouter();

  303.         } catch (DriverConfigurazioneNotFound de) {
  304.             ControlStationCore.logInfo(getPrefixError(nomeMetodo,  de));
  305.             throw de;
  306.         } catch (Exception e) {
  307.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  308.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  309.         } finally {
  310.             ControlStationCore.dbM.releaseConnection(con);
  311.         }

  312.     }

  313.     /**
  314.      * Ritorna il {@link Soggetto} utilizzando il driver
  315.      * {@link DriverConfigurazioneDB} che soddisfa i parametri passati come
  316.      * input
  317.      */
  318.     public Soggetto getSoggetto(IDSoggetto soggetto) throws DriverConfigurazioneException, DriverConfigurazioneNotFound {
  319.         Connection con = null;
  320.         String nomeMetodo = "getSoggetto";
  321.         DriverControlStationDB driver = null;

  322.         try {
  323.             // prendo una connessione
  324.             con = ControlStationCore.dbM.getConnection();
  325.             // istanzio il driver
  326.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  327.             return driver.getDriverConfigurazioneDB().getSoggetto(soggetto);

  328.         } catch (DriverControlStationException e) {
  329.             ControlStationCore.logError(e.getMessage(),e);
  330.             throw new DriverConfigurazioneException(e);
  331.         } catch (DriverConfigurazioneNotFound de) {
  332.             ControlStationCore.logInfo(getPrefixError(nomeMetodo,  de));
  333.             throw de;
  334.         } catch (DriverConfigurazioneException e) {
  335.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  336.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  337.         } finally {
  338.             ControlStationCore.dbM.releaseConnection(con);
  339.         }

  340.     }

  341.     public Soggetto getSoggetto(long idSoggetto) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  342.         Connection con = null;
  343.         String nomeMetodo = "getSoggetto";
  344.         DriverControlStationDB driver = null;

  345.         try {
  346.             // prendo una connessione
  347.             con = ControlStationCore.dbM.getConnection();
  348.             // istanzio il driver
  349.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  350.             return driver.getDriverConfigurazioneDB().getSoggetto(idSoggetto);

  351.         } catch (DriverConfigurazioneNotFound de) {
  352.             ControlStationCore.logInfo(getPrefixError(nomeMetodo,  de));
  353.             throw de;
  354.         } catch (Exception e) {
  355.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  356.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  357.         } finally {
  358.             ControlStationCore.dbM.releaseConnection(con);
  359.         }

  360.     }

  361.     public SoggettoCtrlStat getSoggettoCtrlStat(long idSoggetto) throws DriverConfigurazioneNotFound, DriverRegistroServiziNotFound, DriverControlStationException {
  362.         Connection con = null;
  363.         String nomeMetodo = "getSoggettoCtrlStat";
  364.         DriverControlStationDB driver = null;

  365.         try {
  366.             // prendo una connessione
  367.             con = ControlStationCore.dbM.getConnection();
  368.             // istanzio il driver
  369.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  370.             Soggetto soggConf = driver.getDriverConfigurazioneDB().getSoggetto(idSoggetto);
  371.             org.openspcoop2.core.registry.Soggetto soggReg = null;
  372.             if(this.isRegistroServiziLocale()){
  373.                 soggReg = driver.getDriverRegistroServiziDB().getSoggetto(idSoggetto);
  374.             }

  375.             return new SoggettoCtrlStat(soggReg, soggConf);

  376.         } catch (DriverConfigurazioneNotFound de) {
  377.             ControlStationCore.logInfo(getPrefixError(nomeMetodo,  de));
  378.             throw de;
  379.         } catch (DriverRegistroServiziNotFound de) {
  380.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  381.             throw de;
  382.         } catch (Exception e) {
  383.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  384.             throw new DriverControlStationException(getPrefixError(nomeMetodo,  e),e);
  385.         } finally {
  386.             ControlStationCore.dbM.releaseConnection(con);
  387.         }
  388.     }
  389.    
  390.     public long getIdSoggetto(String nomeSoggetto, String tipoSoggetto) throws DriverConfigurazioneException
  391.     {
  392.         Connection con = null;
  393.         String nomeMetodo = "getIdSoggetto";
  394.         DriverControlStationDB driver = null;
  395.  
  396.         long idSoggetto=-1;
  397.         try
  398.         {
  399.             // prendo una connessione
  400.             con = ControlStationCore.dbM.getConnection();
  401.             // istanzio il driver
  402.             driver = new DriverControlStationDB(con, null, this.tipoDB);
  403.            
  404.             IDSoggetto aSoggetto = new IDSoggetto(tipoSoggetto, nomeSoggetto);
  405.            
  406.             idSoggetto = driver.getDriverConfigurazioneDB().getSoggetto(aSoggetto).getId();

  407.         } catch (DriverConfigurazioneNotFound e) {
  408.             // Lasciare DEBUG, usato anche in servizio API RS
  409.             ControlStationCore.logDebug(getPrefixNotFound(nomeMetodo,  e), e);
  410.             throw new DriverConfigurazioneException(getPrefixNotFound(nomeMetodo,  e),e);
  411.         } catch (Exception e) {
  412.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  413.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  414.         }finally
  415.         {
  416.             ControlStationCore.dbM.releaseConnection(con);
  417.         }
  418.         return idSoggetto;
  419.     }
  420.    
  421.     public List<Soggetto> soggettiList(String superuser, ISearch ricerca) throws DriverConfigurazioneException {
  422.         Connection con = null;
  423.         String nomeMetodo = "soggettiList";
  424.         DriverControlStationDB driver = null;

  425.         try {
  426.             // prendo una connessione
  427.             con = ControlStationCore.dbM.getConnection();
  428.             // istanzio il driver
  429.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  430.             return driver.getDriverConfigurazioneDB().soggettiList(superuser, ricerca);

  431.         } catch (Exception e) {
  432.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  433.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  434.         } finally {
  435.             ControlStationCore.dbM.releaseConnection(con);
  436.         }

  437.     }

  438.     public List<Soggetto> soggettiWithServiziList(String superuser,ISearch ricerca) throws DriverConfigurazioneException {
  439.         Connection con = null;
  440.         String nomeMetodo = "soggettiWithServiziList";
  441.         DriverControlStationDB driver = null;

  442.         try {
  443.             // prendo una connessione
  444.             con = ControlStationCore.dbM.getConnection();
  445.             // istanzio il driver
  446.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  447.             return driver.getDriverConfigurazioneDB().soggettiWithServiziList(superuser,ricerca);

  448.         } catch (Exception e) {
  449.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  450.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  451.         } finally {
  452.             ControlStationCore.dbM.releaseConnection(con);
  453.         }

  454.     }
  455.    
  456.    
  457.     public boolean isSoggettoInUso(org.openspcoop2.core.registry.Soggetto soggetto, Map<ErrorsHandlerCostant, List<String>> whereIsInUso,
  458.             boolean normalizeObjectIds, boolean verificaRuoli) throws DriverControlStationException {

  459.         Connection con = null;
  460.         String nomeMetodo = "isSoggettoInUso(Registro)";
  461.         DriverControlStationDB driver = null;

  462.         try {
  463.             // prendo una connessione
  464.             con = ControlStationCore.dbM.getConnection();
  465.             // istanzio il driver
  466.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  467.             return driver.isSoggettoInUso(soggetto, whereIsInUso, normalizeObjectIds, verificaRuoli);

  468.         } catch (Exception e) {
  469.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  470.             throw new DriverControlStationException(getPrefixError(nomeMetodo,  e), e);
  471.         } finally {
  472.             ControlStationCore.dbM.releaseConnection(con);
  473.         }

  474.     }
  475.    
  476.     public boolean isSoggettoInUso(org.openspcoop2.core.config.Soggetto soggetto, Map<ErrorsHandlerCostant, List<String>> whereIsInUso,
  477.             boolean normalizeObjectIds, boolean verificaRuoli) throws DriverControlStationException {

  478.         Connection con = null;
  479.         String nomeMetodo = "isSoggettoInUso(Config)";
  480.         DriverControlStationDB driver = null;

  481.         try {
  482.             // prendo una connessione
  483.             con = ControlStationCore.dbM.getConnection();
  484.             // istanzio il driver
  485.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  486.             return driver.isSoggettoInUso(soggetto, whereIsInUso, normalizeObjectIds, verificaRuoli);

  487.         } catch (Exception e) {
  488.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  489.             throw new DriverControlStationException(getPrefixError(nomeMetodo,  e), e);
  490.         } finally {
  491.             ControlStationCore.dbM.releaseConnection(con);
  492.         }

  493.     }
  494.    
  495.     public boolean isSoggettoInUsoInPackageFinali(org.openspcoop2.core.registry.Soggetto soggetto, Map<ErrorsHandlerCostant,String> whereIsInUso) throws DriverControlStationException {

  496.         Connection con = null;
  497.         String nomeMetodo = "isSoggettoInUsoInPackageFinali";
  498.         DriverControlStationDB driver = null;

  499.         try {
  500.             // prendo una connessione
  501.             con = ControlStationCore.dbM.getConnection();
  502.             // istanzio il driver
  503.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  504.             return driver.getDriverRegistroServiziDB().isSoggettoInUsoInPackageFinali(soggetto, whereIsInUso);

  505.         } catch (Exception e) {
  506.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  507.             throw new DriverControlStationException(getPrefixError(nomeMetodo,  e),e);
  508.         } finally {
  509.             ControlStationCore.dbM.releaseConnection(con);
  510.         }

  511.     }
  512.    
  513.     public boolean isSoggettoInUsoInPackagePubblici(org.openspcoop2.core.registry.Soggetto soggetto, Map<ErrorsHandlerCostant,String> whereIsInUso) throws DriverControlStationException {

  514.         Connection con = null;
  515.         String nomeMetodo = "isSoggettoInUsoInPackagePubblici";
  516.         DriverControlStationDB driver = null;

  517.         try {
  518.             // prendo una connessione
  519.             con = ControlStationCore.dbM.getConnection();
  520.             // istanzio il driver
  521.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  522.             return driver.getDriverRegistroServiziDB().isSoggettoInUsoInPackagePubblici(soggetto, whereIsInUso);

  523.         } catch (Exception e) {
  524.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  525.             throw new DriverControlStationException(getPrefixError(nomeMetodo,  e),e);
  526.         } finally {
  527.             ControlStationCore.dbM.releaseConnection(con);
  528.         }

  529.     }

  530.     public List<IDSoggetto> getSoggettiWithSuperuser(String user) throws DriverUsersDBException {
  531.         Connection con = null;
  532.         String nomeMetodo = "getSoggettiWithSuperuser";
  533.         DriverControlStationDB driver = null;

  534.         try {
  535.             // prendo una connessione
  536.             con = ControlStationCore.dbM.getConnection();
  537.             // istanzio il driver
  538.             driver = new DriverControlStationDB(con, null, this.tipoDB);
  539.             return driver.getDriverConfigurazioneDB().getSoggettiWithSuperuser(user);
  540.         } catch (Exception e) {
  541.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  542.             throw new DriverUsersDBException(getPrefixError(nomeMetodo,  e),e);
  543.         } finally {
  544.             ControlStationCore.dbM.releaseConnection(con);
  545.         }
  546.     }
  547.    
  548.    
  549.        
  550.     public List<String> getTipiSoggettiGestiti() throws DriverRegistroServiziException {
  551.         String nomeMetodo = "getTipiSoggettiGestiti";
  552.         try{
  553.            
  554.             List<String> tipi = new ArrayList<>();
  555.            
  556.             MapReader<String, IProtocolFactory<?>> protocolFactories = this.protocolFactoryManager.getProtocolFactories();
  557.             Enumeration<String> protocolli = protocolFactories.keys();
  558.             while (protocolli.hasMoreElements()) {
  559.                
  560.                 String protocollo = protocolli.nextElement();
  561.                 IProtocolFactory<?> protocolFactory = protocolFactories.get(protocollo);
  562.                 for (String tipo : protocolFactory.createProtocolConfiguration().getTipiSoggetti()){
  563.                     if(!tipi.contains(tipo)){
  564.                         tipi.add(tipo);
  565.                     }
  566.                 }
  567.             }
  568.            
  569.             return tipi;
  570.            
  571.         }catch (Exception e) {
  572.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  573.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  574.         }
  575.     }
  576.     public String getTipoSoggettoDefaultProtocollo(String protocollo) throws  DriverRegistroServiziException {
  577.         String getTipoServizioDefault = "getTipoSoggettoDefaultProtocollo";
  578.         try{
  579.            
  580.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().getTipoSoggettoDefault();
  581.            
  582.         }catch (Exception e) {
  583.             String msgError = getPrefixError(getTipoServizioDefault, e);
  584.             ControlStationCore.logError(msgError, e);
  585.             throw new DriverRegistroServiziException(msgError,e);
  586.         }
  587.     }

  588.     public List<String> getTipiSoggettiGestitiProtocollo(String protocollo) throws DriverRegistroServiziException {
  589.         String nomeMetodo = "getTipiSoggettiGestitiProtocollo";
  590.         try{
  591.            
  592.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().getTipiSoggetti();
  593.            
  594.         }catch (Exception e) {
  595.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  596.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  597.         }
  598.     }
  599.     public String getProtocolloAssociatoTipoSoggetto(String tipoSoggetto) throws DriverRegistroServiziException {
  600.         String nomeMetodo = "getProtocolloAssociatoTipoSoggetto";
  601.         try{
  602.            
  603.             return this.protocolFactoryManager.getProtocolByOrganizationType(tipoSoggetto);
  604.            
  605.         }catch (Exception e) {
  606.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  607.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  608.         }
  609.     }
  610.    
  611.     public String getWebContextProtocolAssociatoTipoSoggetto(String tipoSoggetto) throws DriverRegistroServiziException {
  612.         String nomeMetodo = "getWebContextProtocolAssociatoTipoSoggetto";
  613.         try{
  614.            
  615.             String protocollo = this.getProtocolloAssociatoTipoSoggetto(tipoSoggetto);
  616.             IProtocolFactory<?> pf = this.protocolFactoryManager.getProtocolFactoryByName(protocollo);
  617.             if(pf.getManifest().getWeb().getEmptyContext()!=null && pf.getManifest().getWeb().getEmptyContext().isEnabled()){
  618.                 return "";
  619.             }
  620.             else{
  621.                 return pf.getManifest().getWeb().getContext(0).getName();
  622.             }
  623.            
  624.         }catch (Exception e) {
  625.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  626.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  627.         }
  628.     }
  629.    
  630.     public String getIdentificativoPortaDefault(String protocollo,IDSoggetto soggetto) throws DriverRegistroServiziException {
  631.         String nomeMetodo = "getIdentificativoPortaDefault";
  632.         try{
  633.            
  634.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createTraduttore().getIdentificativoPortaDefault(soggetto);
  635.            
  636.         }catch (Exception e) {
  637.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  638.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  639.         }
  640.     }

  641.     public boolean isSupportatoIdentificativoPorta(String protocollo) throws DriverRegistroServiziException {
  642.         String nomeMetodo = "isSupportatoIdentificativoPorta";
  643.         try{
  644.            
  645.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoIdentificativoPortaSoggetto();
  646.            
  647.         }catch (Exception e) {
  648.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  649.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  650.         }
  651.     }
  652.    
  653.     public boolean isSupportatoCodiceIPA(String protocollo) throws DriverRegistroServiziException {
  654.         String nomeMetodo = "isSupportatoCodiceIPA";
  655.         try{
  656.            
  657.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoCodiceIPA();
  658.            
  659.         }catch (Exception e) {
  660.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  661.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  662.         }
  663.     }
  664.    
  665.     public boolean isSupportatoTrattinoNomeSoggetto(String protocollo) throws DriverRegistroServiziException {
  666.         String nomeMetodo = "isSupportatoTrattinoNomeSoggetto";
  667.         try{
  668.            
  669.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoSoggettoUtilizzoTrattino();
  670.            
  671.         }catch (Exception e) {
  672.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  673.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  674.         }
  675.     }
  676.    
  677.     public boolean isSupportatoAutenticazioneSoggetti(String protocollo) throws DriverRegistroServiziException {
  678.         String nomeMetodo = "isSupportatoAutenticazioneSoggetti";
  679.         try{
  680.            
  681.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoAutenticazioneSoggetti();
  682.            
  683.         }catch (Exception e) {
  684.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  685.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  686.         }
  687.     }
  688.    
  689.     public boolean isSupportatoAutenticazioneApplicativiErogazione(String protocollo) throws DriverRegistroServiziException {
  690.         String nomeMetodo = "isSupportatoAutenticazioneApplicativiErogazione";
  691.         try{
  692.            
  693.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoAutenticazioneApplicativiErogazioni();
  694.            
  695.         }catch (Exception e) {
  696.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  697.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  698.         }
  699.     }
  700.    
  701.     public boolean isSupportatoAutorizzazioneRichiedenteSenzaAutenticazioneErogazione(String protocollo) throws DriverRegistroServiziException {
  702.         String nomeMetodo = "isSupportatoAutorizzazioneRichiedenteSenzaAutenticazioneErogazione";
  703.         try{
  704.            
  705.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportatoAutorizzazioneRichiedenteSenzaAutenticazioneErogazioni();
  706.            
  707.         }catch (Exception e) {
  708.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  709.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  710.         }
  711.     }
  712.    
  713.     public String getCodiceIPADefault(String protocollo,IDSoggetto soggetto,boolean createURI) throws DriverRegistroServiziException {
  714.         String nomeMetodo = "getCodiceIPADefault";
  715.         try{
  716.            
  717.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createTraduttore().getIdentificativoCodiceIPADefault(soggetto,createURI);
  718.            
  719.         }catch (Exception e) {
  720.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  721.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  722.         }
  723.     }
  724.    
  725.     public List<String> soggettiRuoliList(long idSoggetto, ISearch ricerca) throws DriverConfigurazioneException {
  726.         Connection con = null;
  727.         String nomeMetodo = "soggettiRuoliList";
  728.         DriverControlStationDB driver = null;

  729.         try {
  730.             // prendo una connessione
  731.             con = ControlStationCore.dbM.getConnection();
  732.             // istanzio il driver
  733.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  734.             return driver.getDriverRegistroServiziDB().soggettiRuoliList(idSoggetto, ricerca);

  735.         } catch (Exception e) {
  736.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  737.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  738.         } finally {
  739.             ControlStationCore.dbM.releaseConnection(con);
  740.         }

  741.     }
  742.    
  743.     public org.openspcoop2.core.registry.Soggetto soggettoWithCredenzialiBasic(String user, String password, boolean checkPassword) throws DriverConfigurazioneException {
  744.         Connection con = null;
  745.         String nomeMetodo = "soggettoWithCredenzialiBasic";
  746.         DriverControlStationDB driver = null;

  747.         try {
  748.             // prendo una connessione
  749.             con = ControlStationCore.dbM.getConnection();
  750.             // istanzio il driver
  751.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  752.             return driver.getDriverRegistroServiziDB().soggettoWithCredenzialiBasic(user, password, checkPassword);

  753.         }
  754.         catch (Exception e) {
  755.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  756.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  757.         } finally {
  758.             ControlStationCore.dbM.releaseConnection(con);
  759.         }

  760.     }
  761.    
  762.     public String toAppId(String protocollo, IDSoggetto idSoggetto,  boolean multipleApiKeys) throws DriverConfigurazioneException {
  763.        
  764.         Connection con = null;
  765.         String nomeMetodo = "toAppId";
  766.         DriverControlStationDB driver = null;

  767.         try {
  768.             // prendo una connessione
  769.             con = ControlStationCore.dbM.getConnection();
  770.             // istanzio il driver
  771.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  772.             return ApiKeyUtilities.toAppId(protocollo, idSoggetto, multipleApiKeys, driver.getDriverRegistroServiziDB());

  773.         } catch (Exception e) {
  774.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  775.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  776.         } finally {
  777.             ControlStationCore.dbM.releaseConnection(con);
  778.         }
  779.        
  780.     }
  781.    
  782.     public ApiKey newApiKey(String protocollo, IDSoggetto idSoggetto) throws DriverConfigurazioneException {
  783.        
  784.         Connection con = null;
  785.         String nomeMetodo = "newApiKey";
  786.         DriverControlStationDB driver = null;

  787.         try {
  788.             // prendo una connessione
  789.             con = ControlStationCore.dbM.getConnection();
  790.             // istanzio il driver
  791.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  792.             return ApiKeyUtilities.newApiKey(protocollo, idSoggetto, this.getSoggettiApiKeyLunghezzaPasswordGenerate(), driver.getDriverRegistroServiziDB());

  793.         } catch (Exception e) {
  794.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  795.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  796.         } finally {
  797.             ControlStationCore.dbM.releaseConnection(con);
  798.         }
  799.        
  800.     }
  801.    
  802.     public ApiKey newMultipleApiKey() throws DriverConfigurazioneException {
  803.        
  804.         String nomeMetodo = "newMultipleApiKey";
  805.         try {
  806.             return ApiKeyUtilities.newMultipleApiKey(this.getSoggettiApiKeyLunghezzaPasswordGenerate());
  807.         } catch (Exception e) {
  808.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  809.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  810.         }
  811.        
  812.     }
  813.    
  814.     public org.openspcoop2.core.registry.Soggetto soggettoWithCredenzialiApiKey(String user, boolean appId) throws DriverConfigurazioneException {
  815.         Connection con = null;
  816.         String nomeMetodo = "soggettoWithCredenzialiApiKey";
  817.         DriverControlStationDB driver = null;

  818.         try {
  819.             // prendo una connessione
  820.             con = ControlStationCore.dbM.getConnection();
  821.             // istanzio il driver
  822.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  823.             return driver.getDriverRegistroServiziDB().soggettoWithCredenzialiApiKey(user, appId);

  824.         }
  825.         catch (Exception e) {
  826.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  827.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  828.         } finally {
  829.             ControlStationCore.dbM.releaseConnection(con);
  830.         }

  831.     }
  832.    
  833.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistroAutenticatoBasic(String user, String password) throws DriverConfigurazioneException {
  834.         Connection con = null;
  835.         String nomeMetodo = "getSoggettoAutenticatoBasic";
  836.         DriverControlStationDB driver = null;

  837.         try {
  838.             // prendo una connessione
  839.             con = ControlStationCore.dbM.getConnection();
  840.             // istanzio il driver
  841.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  842.             return driver.getDriverRegistroServiziDB().getSoggettoByCredenzialiBasic(user, password, this.getSoggettiPasswordEncrypt());

  843.         }
  844.         catch (DriverRegistroServiziNotFound e) {
  845.             return null;
  846.         }
  847.         catch (Exception e) {
  848.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  849.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  850.         } finally {
  851.             ControlStationCore.dbM.releaseConnection(con);
  852.         }

  853.     }
  854.    
  855.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistroAutenticatoSsl(String subject, String issuer) throws DriverConfigurazioneException {
  856.         Connection con = null;
  857.         String nomeMetodo = "getSoggettoRegistroAutenticatoSsl(subject,issuer)";
  858.         DriverControlStationDB driver = null;

  859.         try {
  860.             // prendo una connessione
  861.             con = ControlStationCore.dbM.getConnection();
  862.             // istanzio il driver
  863.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  864.             return driver.getDriverRegistroServiziDB().getSoggettoByCredenzialiSsl(subject, issuer);

  865.         }
  866.         catch (DriverRegistroServiziNotFound e) {
  867.             return null;
  868.         }
  869.         catch (Exception e) {
  870.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  871.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  872.         } finally {
  873.             ControlStationCore.dbM.releaseConnection(con);
  874.         }

  875.     }
  876.    
  877.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistroAutenticatoSsl(CertificateInfo certificate, boolean strictVerifier) throws DriverConfigurazioneException {
  878.         Connection con = null;
  879.         String nomeMetodo = "getSoggettoRegistroAutenticatoSsl(certificate)";
  880.         DriverControlStationDB driver = null;

  881.         try {
  882.             // prendo una connessione
  883.             con = ControlStationCore.dbM.getConnection();
  884.             // istanzio il driver
  885.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  886.             return driver.getDriverRegistroServiziDB().getSoggettoByCredenzialiSsl(certificate, strictVerifier);

  887.         }
  888.         catch (DriverRegistroServiziNotFound e) {
  889.             return null;
  890.         }
  891.         catch (Exception e) {
  892.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  893.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  894.         } finally {
  895.             ControlStationCore.dbM.releaseConnection(con);
  896.         }

  897.     }
  898.    
  899.     public List<org.openspcoop2.core.registry.Soggetto> soggettoWithCredenzialiSslList(CertificateInfo certificate, boolean strictVerifier) throws DriverConfigurazioneException {
  900.         Connection con = null;
  901.         String nomeMetodo = "getSoggettoRegistroAutenticatoSsl";
  902.         DriverControlStationDB driver = null;

  903.         try {
  904.             // prendo una connessione
  905.             con = ControlStationCore.dbM.getConnection();
  906.             // istanzio il driver
  907.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  908.             return driver.getDriverRegistroServiziDB().soggettoWithCredenzialiSslList(certificate, strictVerifier);

  909.         }
  910.         catch (Exception e) {
  911.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  912.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  913.         } finally {
  914.             ControlStationCore.dbM.releaseConnection(con);
  915.         }

  916.     }
  917.    
  918.     public org.openspcoop2.core.registry.Soggetto getSoggettoRegistroAutenticatoPrincipal(String principal) throws DriverConfigurazioneException {
  919.         Connection con = null;
  920.         String nomeMetodo = "getSoggettoAutenticatoPrincipal";
  921.         DriverControlStationDB driver = null;

  922.         try {
  923.             // prendo una connessione
  924.             con = ControlStationCore.dbM.getConnection();
  925.             // istanzio il driver
  926.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  927.             return driver.getDriverRegistroServiziDB().getSoggettoByCredenzialiPrincipal(principal);

  928.         }
  929.         catch (DriverRegistroServiziNotFound e) {
  930.             return null;
  931.         }
  932.         catch (Exception e) {
  933.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  934.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  935.         } finally {
  936.             ControlStationCore.dbM.releaseConnection(con);
  937.         }

  938.     }
  939.    
  940.     public List<IDSoggettoDB> getSoggettiFromTipoAutenticazione(List<String> tipiSoggetto, String superuser,CredenzialeTipo credenziale, Boolean appId, PddTipologia pddTipologia) throws DriverConfigurazioneException{
  941.         Connection con = null;
  942.         String nomeMetodo = "getSoggettiFromTipoAutenticazione";
  943.         DriverControlStationDB driver = null;
  944.        
  945.         try {
  946.             // prendo una connessione
  947.             con = ControlStationCore.dbM.getConnection();
  948.             // istanzio il driver
  949.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  950.             return driver.getDriverRegistroServiziDB().getSoggettiFromTipoAutenticazione(tipiSoggetto,superuser,credenziale,appId, pddTipologia);

  951.         }
  952.         catch (Exception e) {
  953.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  954.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  955.         } finally {
  956.             ControlStationCore.dbM.releaseConnection(con);
  957.         }
  958.     }
  959.    
  960.    
  961.     public String getDettagliSoggettoInUso(org.openspcoop2.core.registry.Soggetto soggetto, boolean verificaRuoli) throws DriverControlStationException {
  962.         EnumMap<ErrorsHandlerCostant, List<String>> whereIsInUso = new EnumMap<>(ErrorsHandlerCostant.class);
  963.         boolean normalizeObjectIds = true;
  964.         boolean saInUso  = this.isSoggettoInUso(soggetto, whereIsInUso, normalizeObjectIds, verificaRuoli );
  965.        
  966.         StringBuilder inUsoMessage = new StringBuilder();
  967.         if(saInUso) {
  968.            
  969.             IDSoggetto idSoggetto = new IDSoggetto();
  970.             idSoggetto.setTipo(soggetto.getTipo());
  971.             idSoggetto.setNome(soggetto.getNome());
  972.             idSoggetto.setCodicePorta(soggetto.getIdentificativoPorta());
  973.            
  974.             String s = DBOggettiInUsoUtils.toString(idSoggetto , whereIsInUso, false, "\n", normalizeObjectIds);
  975.             if(s!=null && s.startsWith("\n") && s.length()>1) {
  976.                 s = s.substring(1);
  977.             }
  978.             inUsoMessage.append(s);
  979.             inUsoMessage.append("\n");
  980.         } else {
  981.             inUsoMessage.append(SoggettiCostanti.LABEL_IN_USO_BODY_HEADER_NESSUN_RISULTATO);
  982.         }
  983.        
  984.         return inUsoMessage.toString();
  985.     }
  986.     public List<Proprieta> soggettiProprietaList(long idSoggetto, ISearch ricerca) throws DriverConfigurazioneException {
  987.         Connection con = null;
  988.         String nomeMetodo = "soggettiProprietaList";
  989.         DriverControlStationDB driver = null;

  990.         try {
  991.             // prendo una connessione
  992.             con = ControlStationCore.dbM.getConnection();
  993.             // istanzio il driver
  994.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  995.             return driver.getDriverRegistroServiziDB().soggettiProprietaList(idSoggetto, ricerca);

  996.         } catch (Exception e) {
  997.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  998.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  999.         } finally {
  1000.             ControlStationCore.dbM.releaseConnection(con);
  1001.         }
  1002.     }
  1003.    
  1004.     public List<String> nomiProprietaSoggetti(List<String> tipoSoggettiProtocollo) throws DriverConfigurazioneException {
  1005.         Connection con = null;
  1006.         String nomeMetodo = "nomiProprietaSoggetti";
  1007.         DriverControlStationDB driver = null;

  1008.         try {
  1009.             // prendo una connessione
  1010.             con = ControlStationCore.dbM.getConnection();
  1011.             // istanzio il driver
  1012.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  1013.             return driver.getDriverRegistroServiziDB().nomiProprietaSoggetti(tipoSoggettiProtocollo);

  1014.         } catch (Exception e) {
  1015.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  1016.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  1017.         } finally {
  1018.             ControlStationCore.dbM.releaseConnection(con);
  1019.         }
  1020.     }
  1021. }