AccordiServizioParteComuneCore.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.apc;

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

  24. import org.openspcoop2.core.commons.DBUtils;
  25. import org.openspcoop2.core.commons.ErrorsHandlerCostant;
  26. import org.openspcoop2.core.commons.ISearch;
  27. import org.openspcoop2.core.id.IDAccordo;
  28. import org.openspcoop2.core.id.IDAccordoCooperazione;
  29. import org.openspcoop2.core.id.IDPortType;
  30. import org.openspcoop2.core.id.IDPortTypeAzione;
  31. import org.openspcoop2.core.id.IDResource;
  32. import org.openspcoop2.core.id.IDServizio;
  33. import org.openspcoop2.core.id.IDSoggetto;
  34. import org.openspcoop2.core.registry.AccordoServizioParteComune;
  35. import org.openspcoop2.core.registry.AccordoServizioParteComuneServizioCompostoServizioComponente;
  36. import org.openspcoop2.core.registry.Azione;
  37. import org.openspcoop2.core.registry.Documento;
  38. import org.openspcoop2.core.registry.MessagePart;
  39. import org.openspcoop2.core.registry.Operation;
  40. import org.openspcoop2.core.registry.beans.AccordoServizioParteComuneSintetico;
  41. import org.openspcoop2.core.registry.constants.ParameterType;
  42. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  43. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  44. import org.openspcoop2.core.registry.driver.FiltroRicercaAccordi;
  45. import org.openspcoop2.core.registry.driver.FiltroRicercaOperations;
  46. import org.openspcoop2.core.registry.driver.FiltroRicercaPortTypes;
  47. import org.openspcoop2.core.registry.driver.FiltroRicercaResources;
  48. import org.openspcoop2.core.registry.driver.ValidazioneStatoPackageException;
  49. import org.openspcoop2.core.registry.driver.db.DriverRegistroServiziDB;
  50. import org.openspcoop2.core.registry.driver.db.IDAccordoDB;
  51. import org.openspcoop2.message.constants.ServiceBinding;
  52. import org.openspcoop2.protocol.engine.ProtocolFactoryManager;
  53. import org.openspcoop2.protocol.manifest.constants.InterfaceType;
  54. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  55. import org.openspcoop2.protocol.sdk.validator.ValidazioneResult;
  56. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  57. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationDB;
  58. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationException;
  59. import org.openspcoop2.web.ctrlstat.registro.GestoreRegistroServiziRemoto;
  60. import org.openspcoop2.web.ctrlstat.servlet.ConsoleHelper;
  61. import org.openspcoop2.web.lib.mvc.BinaryParameter;

  62. /**
  63.  * AccordiServizioParteComuneCore
  64.  *
  65.  * @author Poli Andrea (apoli@link.it)
  66.  * @author $Author$
  67.  * @version $Rev$, $Date$
  68.  */
  69. public class AccordiServizioParteComuneCore extends ControlStationCore {

  70.     private AccordoServizioParteComuneSoapCore soapCore;
  71.     private AccordoServizioParteComuneRestCore restCore;
  72.     private AccordoServizioParteComuneInUsoCore inUsoCore;
  73.     private AccordoServizioParteComuneSinteticoCore sinteticoCore;
  74.     private AccordoServizioParteComuneServiziCompostiCore serviziCompostiCore;
  75.     private AccordoServizioParteComuneMappingCore mappingCore;
  76.    
  77.     public AccordiServizioParteComuneCore() throws DriverControlStationException {
  78.         super();
  79.         this.soapCore = new AccordoServizioParteComuneSoapCore(this);
  80.         this.restCore = new AccordoServizioParteComuneRestCore(this);
  81.         this.inUsoCore = new AccordoServizioParteComuneInUsoCore(this);
  82.         this.sinteticoCore = new AccordoServizioParteComuneSinteticoCore(this);
  83.         this.serviziCompostiCore = new AccordoServizioParteComuneServiziCompostiCore(this);
  84.         this.mappingCore = new AccordoServizioParteComuneMappingCore(this);
  85.     }
  86.     public AccordiServizioParteComuneCore(ControlStationCore core) throws DriverControlStationException {
  87.         super(core);
  88.         this.soapCore = new AccordoServizioParteComuneSoapCore(this);
  89.         this.restCore = new AccordoServizioParteComuneRestCore(this);
  90.         this.inUsoCore = new AccordoServizioParteComuneInUsoCore(this);
  91.         this.sinteticoCore = new AccordoServizioParteComuneSinteticoCore(this);
  92.         this.serviziCompostiCore = new AccordoServizioParteComuneServiziCompostiCore(this);
  93.         this.mappingCore = new AccordoServizioParteComuneMappingCore(this);
  94.     }

  95.     /* Opzioni */
  96.    
  97.     public boolean isSupportatoSoggettoReferente(String protocollo) throws DriverRegistroServiziException {
  98.         String nomeMetodo = "isSupportatoSoggettoReferente";
  99.         try{
  100.            
  101.             return this.protocolFactoryManager.getProtocolFactoryByName(protocollo).createProtocolConfiguration().isSupportoSoggettoReferenteAccordiParteComune();
  102.            
  103.         }catch (Exception e) {
  104.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  105.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  106.         }
  107.     }
  108.    
  109.     public boolean showWsdlDefinitorio(String protocollo, ServiceBinding serviceBinding, InterfaceType interfaceType) throws DriverRegistroServiziException{
  110.         String nomeMetodo = "showWsdlDefinitorio";
  111.         try {

  112.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  113.             return protocol.createProtocolConfiguration().isSupportoSchemaEsternoInterfaccia(serviceBinding, interfaceType);

  114.         }catch (Exception e) {
  115.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  116.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  117.         }
  118.     }
  119.    
  120.     public boolean showConversazioni(String protocollo, ServiceBinding serviceBinding, InterfaceType interfaceType) throws DriverRegistroServiziException{
  121.         String nomeMetodo = "showConversazioni";
  122.         try {

  123.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  124.             return protocol.createProtocolConfiguration().isSupportoSpecificaConversazioni(serviceBinding,interfaceType);

  125.         }catch (Exception e) {
  126.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  127.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  128.         }
  129.     }
  130.    
  131.     public boolean showPortiAccesso(String protocollo, ServiceBinding serviceBinding, InterfaceType interfaceType) throws DriverRegistroServiziException{
  132.         String nomeMetodo = "showPortiAccesso";
  133.         try {

  134.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  135.             return protocol.createProtocolConfiguration().isSupportoPortiAccessoAccordiParteSpecifica(serviceBinding,interfaceType);

  136.         }catch (Exception e) {
  137.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  138.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  139.         }
  140.     }
  141.    
  142.    
  143.     /* Validazione */
  144.    
  145.     public void validaStatoAccordoServizio(AccordoServizioParteComune as,boolean utilizzoAzioniDiretteInAccordoAbilitato, boolean logValidazioneError) throws DriverRegistroServiziException,ValidazioneStatoPackageException{
  146.         Connection con = null;
  147.         String nomeMetodo = "validaStatoAccordoServizio";
  148.         DriverRegistroServiziDB driver = null;

  149.         try {
  150.             // prendo una connessione
  151.             con = ControlStationCore.dbM.getConnection();
  152.             // istanzio il driver
  153.             driver = new DriverRegistroServiziDB(con, ControlStationCore.log, this.tipoDB);

  154.             driver.validaStatoAccordoServizio(as, utilizzoAzioniDiretteInAccordoAbilitato);

  155.         } catch (ValidazioneStatoPackageException e) {
  156.             if(logValidazioneError) {
  157.                 ControlStationCore.logError("[ControlStationCore::" + nomeMetodo + "] ValidazioneStatoPackageException :" + e.getMessage(), e);
  158.             }
  159.             throw e;
  160.         }  catch (DriverRegistroServiziException e) {
  161.             ControlStationCore.logError("[ControlStationCore::" + nomeMetodo + "] DriverRegistroServiziException :" + e.getMessage(), e);
  162.             throw e;
  163.         } catch (Exception e) {
  164.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  165.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  166.         } finally {
  167.             ControlStationCore.dbM.releaseConnection(con);
  168.         }
  169.     }
  170.    
  171.     public ValidazioneResult validazione(AccordoServizioParteComune as,String protocollo) throws DriverRegistroServiziException {
  172.         String nomeMetodo = "validazione";
  173.         try {
  174.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  175.             return protocol.createValidazioneAccordi().valida(as);
  176.         }catch (Exception e) {
  177.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  178.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  179.         }
  180.     }

  181.     public ValidazioneResult validaInterfacciaWsdlParteComune(AccordoServizioParteComune as,String protocollo) throws DriverRegistroServiziException {
  182.         String nomeMetodo = "validaInterfacciaWsdlParteComune";
  183.         try {
  184.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  185.             return protocol.createValidazioneDocumenti().validaSpecificaInterfaccia(as);
  186.         }catch (Exception e) {
  187.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  188.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  189.         }
  190.     }

  191.     public ValidazioneResult validaSpecificaConversazione(AccordoServizioParteComune as,String protocollo) throws DriverRegistroServiziException {
  192.         String nomeMetodo = "validaSpecificaConversazione";
  193.         try {
  194.             IProtocolFactory<?> protocol = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  195.             return protocol.createValidazioneDocumenti().validaSpecificaConversazione(as);
  196.         }catch (Exception e) {
  197.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  198.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  199.         }
  200.     }
  201.    
  202.    
  203.    
  204.     /* InUso */
  205.    
  206.     public boolean isAccordoInUso(IDAccordo idAccordo, Map<ErrorsHandlerCostant,List<String>> whereIsInUso, boolean normalizeObjectIds) throws DriverRegistroServiziException {
  207.         return this.inUsoCore.isAccordoInUso(idAccordo, whereIsInUso, normalizeObjectIds);
  208.     }
  209.    
  210.     public boolean isAccordoInUso(AccordoServizioParteComune as, Map<ErrorsHandlerCostant,List<String>> whereIsInUso, boolean normalizeObjectIds) throws DriverRegistroServiziException {
  211.         return this.inUsoCore.isAccordoInUso(as, whereIsInUso, normalizeObjectIds);
  212.     }
  213.    
  214.    
  215.    
  216.     /* Gesitone accordi */
  217.    
  218.     public long getIdAccordoServizio(IDAccordo idAccordo) throws DriverRegistroServiziException {
  219.         Connection con = null;
  220.         String nomeMetodo = "getIdAccordoServizio";
  221.         try {
  222.             // prendo una connessione
  223.             con = ControlStationCore.dbM.getConnection();
  224.             return DBUtils.getIdAccordoServizioParteComune(idAccordo, con, this.tipoDB);
  225.         } catch (Exception e) {
  226.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  227.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  228.         } finally {
  229.             ControlStationCore.dbM.releaseConnection(con);
  230.         }
  231.     }
  232.    
  233.     public AccordoServizioParteComune getAccordoServizioFull(IDAccordo idAccordo) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  234.         Connection con = null;
  235.         String nomeMetodo = "getAccordoServizioFull";
  236.         DriverControlStationDB driver = null;

  237.         try {
  238.             if(this.isRegistroServiziLocale()){
  239.                 // prendo una connessione
  240.                 con = ControlStationCore.dbM.getConnection();
  241.                 // istanzio il driver
  242.                 driver = new DriverControlStationDB(con, null, this.tipoDB);

  243.                 return driver.getDriverRegistroServiziDB().getAccordoServizioParteComune(idAccordo);
  244.             }
  245.             else{
  246.                 return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAccordoServizioParteComune(idAccordo);
  247.             }

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

  257.     }

  258.     public AccordoServizioParteComune getAccordoServizioFull(IDAccordo idAccordo,boolean deepRead) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  259.         Connection con = null;
  260.         String nomeMetodo = "getAccordoServizioFull(idAccordo,deepRead)";
  261.         DriverControlStationDB driver = null;

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

  267.             return driver.getDriverRegistroServiziDB().getAccordoServizioParteComune(idAccordo,deepRead,deepRead);
  268.         } catch (DriverRegistroServiziNotFound e) {
  269.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  e), e);
  270.             throw e;
  271.         } catch (DriverRegistroServiziException e) {
  272.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  273.             throw e;
  274.         } catch (Exception e) {
  275.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  276.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  277.         } finally {
  278.             ControlStationCore.dbM.releaseConnection(con);
  279.         }
  280.     }

  281.     public AccordoServizioParteComune[] getAllIdAccordiWithSoggettoReferente(IDSoggetto idsoggetto) throws DriverRegistroServiziException,DriverRegistroServiziNotFound{
  282.         Connection con = null;
  283.         String nomeMetodo = "getAllIdAccordiWithSoggettoReferente";
  284.         DriverControlStationDB driver = null;

  285.         try {
  286.             // prendo una connessione
  287.             con = ControlStationCore.dbM.getConnection();
  288.             // istanzio il driver
  289.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  290.             return driver.getDriverRegistroServiziDB().getAllIdAccordiWithSoggettoReferente(idsoggetto);

  291.         } catch (DriverRegistroServiziNotFound de) {
  292.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  293.             throw de;
  294.         } catch (Exception e) {
  295.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  296.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  297.         } finally {
  298.             ControlStationCore.dbM.releaseConnection(con);
  299.         }

  300.     }

  301.     public List<Documento> accordiAllegatiList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  302.         Connection con = null;
  303.         String nomeMetodo = "accordiAllegatiList";
  304.         DriverControlStationDB driver = null;

  305.         try {
  306.             // prendo una connessione
  307.             con = ControlStationCore.dbM.getConnection();
  308.             // istanzio il driver
  309.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  310.             return driver.getDriverRegistroServiziDB().accordiAllegatiList(idAccordo, ricerca);
  311.         } catch (Exception e) {
  312.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  313.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  314.         } finally {
  315.             ControlStationCore.dbM.releaseConnection(con);
  316.         }
  317.     }
  318.    
  319.     public List<org.openspcoop2.core.registry.Soggetto> accordiErogatoriList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  320.         Connection con = null;
  321.         String nomeMetodo = "accordiErogatoriList";
  322.         DriverControlStationDB driver = null;

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

  328.             return driver.getDriverRegistroServiziDB().accordiErogatoriList(idAccordo, ricerca);

  329.         } catch (Exception e) {
  330.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  331.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  332.         } finally {
  333.             ControlStationCore.dbM.releaseConnection(con);
  334.         }
  335.     }
  336.    
  337.     public List<IDAccordoDB> idAccordiServizioParteComuneList(String superuser, ISearch ricerca,
  338.             boolean soloAccordiConsistentiRest, boolean soloAccordiConsistentiSoap) throws DriverRegistroServiziException {
  339.         Connection con = null;
  340.         String nomeMetodo = "idAccordiServizioParteComuneList";
  341.         DriverControlStationDB driver = null;

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

  347.             return driver.getDriverRegistroServiziDB().idAccordiServizioParteComuneList(superuser, ricerca,
  348.                     soloAccordiConsistentiRest, soloAccordiConsistentiSoap);
  349.         } catch (DriverRegistroServiziException e) {
  350.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  351.             throw e;
  352.         } catch (Exception e) {
  353.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  354.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e), e);
  355.         } finally {
  356.             ControlStationCore.dbM.releaseConnection(con);
  357.         }
  358.     }
  359.    

  360.     public boolean existsAccordoServizio(IDAccordo idAccordo) throws DriverRegistroServiziException {
  361.         Connection con = null;
  362.         String nomeMetodo = "existsAccordoServizio";
  363.         DriverControlStationDB driver = null;

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

  369.             return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComune(idAccordo);

  370.         } catch (Exception e) {
  371.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  372.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  373.         } finally {
  374.             ControlStationCore.dbM.releaseConnection(con);
  375.         }
  376.     }
  377.    
  378.     public List<IDAccordo> getAllIdAccordiServizio(FiltroRicercaAccordi filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  379.         Connection con = null;
  380.         String nomeMetodo = "getAllIdAccordiServizio";
  381.         DriverControlStationDB driver = null;

  382.         try {
  383.             if(this.isRegistroServiziLocale()){
  384.                 // prendo una connessione
  385.                 con = ControlStationCore.dbM.getConnection();
  386.                 // istanzio il driver
  387.                 driver = new DriverControlStationDB(con, null, this.tipoDB);

  388.                 return driver.getDriverRegistroServiziDB().getAllIdAccordiServizioParteComune(filtroRicerca);
  389.             }
  390.             else{
  391.                 return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAllIdAccordiServizioParteComune(filtroRicerca);
  392.             }

  393.         } catch (DriverRegistroServiziNotFound de) {
  394.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  395.             throw de;
  396.         } catch (Exception e) {
  397.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  398.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  399.         } finally {
  400.             ControlStationCore.dbM.releaseConnection(con);
  401.         }
  402.     }

  403.     public IDAccordo getIdAccordoServizio(long id) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  404.         Connection con = null;
  405.         String nomeMetodo = "getIdAccordoServizio";
  406.         DriverControlStationDB driver = null;

  407.         try {
  408.             // prendo una connessione
  409.             con = ControlStationCore.dbM.getConnection();
  410.             // istanzio il driver
  411.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  412.             return driver.getDriverRegistroServiziDB().getIdAccordoServizioParteComune(id);

  413.         } catch (DriverRegistroServiziNotFound de) {
  414.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  415.             throw de;
  416.         } catch (Exception e) {
  417.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  418.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  419.         } finally {
  420.             ControlStationCore.dbM.releaseConnection(con);
  421.         }

  422.     }
  423.    
  424.     public AccordoServizioParteComune getAccordoServizioFull(long id) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  425.         Connection con = null;
  426.         String nomeMetodo = "getAccordoServizio";
  427.         DriverControlStationDB driver = null;

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

  433.             boolean readContenutoAllegati = false;
  434.             boolean readDatiRegistro = true; // servono nelle varie pagine della console
  435.             return driver.getDriverRegistroServiziDB().getAccordoServizioParteComune(id, readContenutoAllegati, readDatiRegistro);

  436.         } catch (DriverRegistroServiziNotFound de) {
  437.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  438.             throw de;
  439.         } catch (Exception e) {
  440.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  441.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  442.         } finally {
  443.             ControlStationCore.dbM.releaseConnection(con);
  444.         }

  445.     }
  446.    
  447.     public int getAccordoServizioParteComuneNextVersion(IDAccordo idAccordo) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  448.         Connection con = null;
  449.         String nomeMetodo = "getAccordoServizioParteComuneNextVersion";
  450.         DriverControlStationDB driver = null;

  451.         try {
  452.             // prendo una connessione
  453.             con = ControlStationCore.dbM.getConnection();
  454.             // istanzio il driver
  455.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  456.             return driver.getDriverRegistroServiziDB().getAccordoServizioParteComuneNextVersion(idAccordo);

  457.         } catch (DriverRegistroServiziNotFound de) {
  458.             ControlStationCore.logDebug(getPrefixError(nomeMetodo,  de),de);
  459.             throw de;
  460.         } catch (Exception e) {
  461.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  462.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  463.         } finally {
  464.             ControlStationCore.dbM.releaseConnection(con);
  465.         }

  466.     }

  467.    
  468.     /* Gesitone accordi SOAP */
  469.    
  470.     public void deleteAzione(long idAccordo, String nomeAzione) throws DriverRegistroServiziException {
  471.         this.soapCore.deleteAzione(idAccordo, nomeAzione);
  472.     }
  473.    
  474.     public List<Azione> accordiAzioniList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  475.         return this.soapCore.accordiAzioniList(idAccordo, ricerca);
  476.     }

  477.     public List<Azione> accordiAzioniList(long idAccordo, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
  478.         return this.soapCore.accordiAzioniList(idAccordo, profiloCollaborazione, ricerca);
  479.     }
  480.    
  481.     public List<org.openspcoop2.core.registry.PortType> accordiPorttypeList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  482.         return this.soapCore.accordiPorttypeList(idAccordo, ricerca);
  483.     }

  484.     public List<org.openspcoop2.core.registry.PortType> accordiPorttypeList(long idAccordo, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
  485.         return this.soapCore.accordiPorttypeList(idAccordo, profiloCollaborazione, ricerca);
  486.     }

  487.     public List<Operation> accordiPorttypeOperationList(long idPortType, ISearch ricerca) throws DriverRegistroServiziException {
  488.         return this.soapCore.accordiPorttypeOperationList(idPortType, ricerca);
  489.     }

  490.     public List<Operation> accordiPorttypeOperationList(long idPortType, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
  491.         return this.soapCore.accordiPorttypeOperationList(idPortType, profiloCollaborazione, ricerca);
  492.     }
  493.    
  494.     public List<MessagePart> accordiPorttypeOperationMessagePartList(long idOperation, boolean isInput, ISearch ricerca) throws DriverRegistroServiziException {
  495.         return this.soapCore.accordiPorttypeOperationMessagePartList(idOperation, isInput, ricerca);
  496.     }

  497.     public boolean existsAccordoServizioPorttype(String nome, long idAccordo) throws DriverRegistroServiziException {
  498.         return this.soapCore.existsAccordoServizioPorttype(nome, idAccordo);
  499.     }

  500.     public boolean existsAccordoServizioPorttypeOperation(String nome, long idPortType) throws DriverRegistroServiziException {
  501.         return this.soapCore.existsAccordoServizioPorttypeOperation(nome, idPortType);
  502.     }

  503.     public boolean existsAccordoServizioPorttypeOperation(String nome, IDAccordo idAccordo, String nomePortType) throws DriverRegistroServiziException {
  504.         return this.soapCore.existsAccordoServizioPorttypeOperation(nome, idAccordo, nomePortType);
  505.     }
  506.    
  507.     public boolean isUnicaAzioneInAccordi(String azione) throws DriverRegistroServiziException {
  508.         return this.soapCore.isUnicaAzioneInAccordi(azione);
  509.     }

  510.     /**
  511.      * Controlla se l'azione e' usata come Azione correlata in qualche azione,
  512.      * dell'accordo con id <i>idAccordo</i>, diversa da <i>owner</i>
  513.      *
  514.      * @param idAccordo
  515.      *            L'id dell'Accordo
  516.      * @param nomeAzione
  517.      *            Il nome dell'azione correlata da cercare
  518.      * @param owner
  519.      *            Il nome dell'azione che contiene <i>nomeAzione</i> come
  520.      *            correlata
  521.      * @return true se l'azione e' usata come correlata, false altrimenti
  522.      * @throws DriverRegistroServiziException
  523.      */
  524.     public boolean isAzioneCorrelata(long idAccordo, String nomeAzione, String owner) throws DriverRegistroServiziException {
  525.         return this.soapCore.isAzioneCorrelata(idAccordo, nomeAzione, owner);
  526.     }

  527.     /**
  528.      * Controlla se l'operation e' usata come Operation correlata in qualche
  529.      * Operation del port-type con id <i>idPortType</i> diversa da <i>owner</i>
  530.      *
  531.      * @param idPortType
  532.      *            L'id del port-type a cui appartengono le operation
  533.      * @param nomeCorrelata
  534.      *            Il nome dell'operation correlata da cercare
  535.      * @param owner
  536.      *            Il nome dell'operation che contiene come correlata
  537.      *            <i>nomeCorrelata</i>
  538.      * @return true se l'operazione e' usata come correlata, false altrimenti
  539.      * @throws DriverRegistroServiziException
  540.      */
  541.     public boolean isOperationCorrelata(long idPortType, String nomeCorrelata, String owner) throws DriverRegistroServiziException {
  542.         return this.soapCore.isOperationCorrelata(idPortType, nomeCorrelata, owner);
  543.     }

  544.     public boolean isOperationCorrelata(String nomePortType,long idPortType,String azioneDaVerificare,long idAzioneDaVerificare) throws DriverRegistroServiziException {
  545.         return this.soapCore.isOperationCorrelata(nomePortType, idPortType, azioneDaVerificare, idAzioneDaVerificare);
  546.     }

  547.     public boolean isOperationCorrelataRichiesta(String nomePortType,long idPortType,String azioneDaVerificare,long idAzioneDaVerificare) throws DriverRegistroServiziException {
  548.         return this.soapCore.isOperationCorrelataRichiesta(nomePortType, idPortType, azioneDaVerificare, idAzioneDaVerificare);
  549.     }
  550.    
  551.     public boolean existsAccordoServizioAzione(long idAzione) throws DriverRegistroServiziException {
  552.         return this.soapCore.existsAccordoServizioAzione(idAzione);
  553.     }

  554.     public boolean existsAccordoServizioOperation(long idAzione) throws DriverRegistroServiziException {
  555.         return this.soapCore.existsAccordoServizioOperation(idAzione);
  556.     }

  557.     public boolean existsAccordoServizioAzione(String nome, long idAccordo) throws DriverRegistroServiziException {
  558.         return this.soapCore.existsAccordoServizioAzione(nome, idAccordo);
  559.     }
  560.    
  561.     public List<IDPortType> getAllIdPortType(FiltroRicercaPortTypes filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  562.         return this.soapCore.getAllIdPortType(filtroRicerca);
  563.     }
  564.    
  565.     public List<IDPortTypeAzione> getAllIdOperation(FiltroRicercaOperations filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  566.         return this.soapCore.getAllIdOperation(filtroRicerca);
  567.     }
  568.    
  569.    
  570.     /* Gesitone accordi REST */
  571.    
  572.     public List<org.openspcoop2.core.registry.Resource> accordiResourceList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  573.         return this.restCore.accordiResourceList(idAccordo, ricerca);
  574.     }
  575.    
  576.     public List<org.openspcoop2.core.registry.ResourceResponse> accordiResourceResponseList(Long idRisorsa, ISearch ricerca) throws DriverRegistroServiziException {
  577.         return this.restCore.accordiResourceResponseList(idRisorsa, ricerca);
  578.     }
  579.    
  580.     public List<org.openspcoop2.core.registry.ResourceRepresentation> accordiResourceRepresentationsList(Long idRisorsa, boolean isRequest, Long idRisposta, ISearch ricerca) throws DriverRegistroServiziException {
  581.         return this.restCore.accordiResourceRepresentationsList(idRisorsa, isRequest, idRisposta, ricerca);
  582.     }
  583.    
  584.     public List<org.openspcoop2.core.registry.ResourceParameter> accordiResourceParametersList(Long idRisorsa, boolean isRequest, Long idRisposta, ISearch ricerca) throws DriverRegistroServiziException {
  585.         return this.restCore.accordiResourceParametersList(idRisorsa, isRequest, idRisposta, ricerca);
  586.     }
  587.    
  588.     public boolean existsAccordoServizioResource(String nome, long idAccordo) throws DriverRegistroServiziException {
  589.         return this.restCore.existsAccordoServizioResource(nome, idAccordo);
  590.     }
  591.    
  592.     public boolean existsAccordoServizioResource(String httpMethod, String path, long idAccordo, String excludeResourceWithName) throws DriverRegistroServiziException {
  593.         return this.restCore.existsAccordoServizioResource(httpMethod, path, idAccordo, excludeResourceWithName);
  594.     }
  595.    
  596.     public boolean existsAccordoServizioResourceResponse(long idRisorsa, int httpStatus) throws DriverRegistroServiziException{
  597.         return this.restCore.existsAccordoServizioResourceResponse(idRisorsa, httpStatus);
  598.     }
  599.    
  600.     public boolean existsAccordoServizioResourceRepresentation(Long idRisorsa, boolean isRequest, Long idResponse, String mediaType) throws DriverRegistroServiziException{
  601.         return this.restCore.existsAccordoServizioResourceRepresentation(idRisorsa, isRequest, idResponse, mediaType);
  602.     }
  603.    
  604.     public boolean existsAccordoServizioResourceParameter(Long idRisorsa, boolean isRequest, Long idResponse, ParameterType tipoParametro, String nome) throws DriverRegistroServiziException{
  605.         return this.restCore.existsAccordoServizioResourceParameter(idRisorsa, isRequest, idResponse, tipoParametro, nome);
  606.     }
  607.    
  608.     public List<IDResource> getAllIdResource(FiltroRicercaResources filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  609.         return this.restCore.getAllIdResource(filtroRicerca);
  610.     }
  611.    
  612.    
  613.     /* Gesitone accordi Sintetici */
  614.    
  615.     public AccordoServizioParteComuneSintetico getAccordoServizioSintetico(IDAccordo idAccordo) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  616.         return this.sinteticoCore.getAccordoServizioSintetico(idAccordo);
  617.     }
  618.    
  619.     public List<AccordoServizioParteComuneSintetico> accordiServizioParteComuneList(String superuser, ISearch ricerca) throws DriverRegistroServiziException {
  620.         return this.sinteticoCore.accordiServizioParteComuneList(superuser, ricerca);
  621.     }
  622.     public List<AccordoServizioParteComuneSintetico> accordiServizioCompostiList(String superuser, ISearch ricerca) throws DriverRegistroServiziException {
  623.         return this.sinteticoCore.accordiServizioCompostiList(superuser, ricerca);
  624.     }
  625.    
  626.     public AccordoServizioParteComuneSintetico getAccordoServizioSintetico(long id) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  627.         return this.sinteticoCore.getAccordoServizioSintetico(id);
  628.     }
  629.    
  630.    
  631.    
  632.     /* Gesitone accordi servizi composti */
  633.    
  634.     public List<IDAccordoDB> idAccordiServizioCompostiList(String superuser, ISearch ricerca,
  635.             boolean soloAccordiConsistentiRest, boolean soloAccordiConsistentiSoap) throws DriverRegistroServiziException {
  636.         return this.serviziCompostiCore.idAccordiServizioCompostiList(superuser, ricerca, soloAccordiConsistentiRest, soloAccordiConsistentiSoap);
  637.     }
  638.    
  639.     public List<AccordoServizioParteComune> accordiServizioServiziComponentiConSoggettoErogatore(IDSoggetto idSoggetto) throws DriverRegistroServiziException {
  640.         return this.serviziCompostiCore.accordiServizioServiziComponentiConSoggettoErogatore(idSoggetto);
  641.     }

  642.     public List<AccordoServizioParteComune> accordiServizioServiziComponenti(IDServizio idServizio) throws DriverRegistroServiziException {
  643.         return this.serviziCompostiCore.accordiServizioServiziComponenti(idServizio);
  644.     }

  645.     public List<AccordoServizioParteComune> accordiServizioWithAccordoCooperazione(IDAccordoCooperazione idAccordoCooperazione) throws DriverRegistroServiziException {
  646.         return this.serviziCompostiCore.accordiServizioWithAccordoCooperazione(idAccordoCooperazione);
  647.     }

  648.     public List<AccordoServizioParteComuneServizioCompostoServizioComponente> accordiComponentiList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
  649.         return this.serviziCompostiCore.accordiComponentiList(idAccordo, ricerca);
  650.     }

  651.     public List<String[]> getAccordiServizioCompostoLabels(AccordoServizioParteComune as, long idAccordoLong, String userLogin,
  652.             List<String> tipiServiziCompatibili, List<String> tipiSoggettiCompatibili, ConsoleHelper helper){
  653.         return this.serviziCompostiCore.getAccordiServizioCompostoLabels(as, idAccordoLong, userLogin, tipiServiziCompatibili, tipiSoggettiCompatibili, helper);
  654.     }

  655.    
  656.    
  657.    
  658.     /* Gesitone accordi rispetto a interfacce e risorse esterne */

  659.     public void mappingAutomatico(String protocollo , AccordoServizioParteComune as, boolean validazioneDocumenti) throws DriverRegistroServiziException {
  660.         this.mappingCore.mappingAutomatico(protocollo, as, validazioneDocumenti);
  661.     }

  662.     public void popolaResourceDaUnAltroASPC(AccordoServizioParteComune aspcDestinazione, AccordoServizioParteComune aspcSorgente,
  663.             boolean aggiornaRisorseEsistenti, boolean eliminaRisorseNonPresentiNuovaInterfaccia, List<IDResource> risorseEliminate) throws DriverRegistroServiziException{
  664.         this.mappingCore.popolaResourceDaUnAltroASPC(aspcDestinazione, aspcSorgente,
  665.                 aggiornaRisorseEsistenti, eliminaRisorseNonPresentiNuovaInterfaccia, risorseEliminate);
  666.     }
  667.        
  668.     public void popolaPorttypeOperationDaUnAltroASPC(AccordoServizioParteComune aspcDestinazione, AccordoServizioParteComune aspcSorgente,
  669.             boolean aggiornaServiziAzioniEsistenti, boolean eliminaServiziAzioniNonPresentiNuovaInterfaccia,
  670.             List<IDPortType> portTypeEliminati, List<IDPortTypeAzione> operationEliminate) throws DriverRegistroServiziException{
  671.         this.mappingCore.popolaPorttypeOperationDaUnAltroASPC(aspcDestinazione, aspcSorgente,
  672.                 aggiornaServiziAzioniEsistenti, eliminaServiziAzioniNonPresentiNuovaInterfaccia,
  673.                 portTypeEliminati, operationEliminate);
  674.     }
  675.    
  676.     public void estraiSchemiFromWSDLTypesAsAllegati(AccordoServizioParteComune as, byte[] wsdl, String tipoWSDL, Map<String, byte[]> schemiAggiuntiInQuestaOperazione) throws Exception{
  677.         this.mappingCore.estraiSchemiFromWSDLTypesAsAllegati(as, wsdl, tipoWSDL, schemiAggiuntiInQuestaOperazione);
  678.     }
  679.    
  680.     public String readEndpoint(AccordoServizioParteComuneSintetico as, String portTypeParam, String servcorr,
  681.             BinaryParameter wsdlimpler, BinaryParameter wsdlimplfru) {
  682.         return this.mappingCore.readEndpoint(as, portTypeParam, servcorr, wsdlimpler, wsdlimplfru);
  683.     }
  684.    
  685.    
  686.    
  687.    
  688.     /* In uso */
  689.    
  690.     public String getDettagliAccordoInUso(IDAccordo idAccordo) throws DriverRegistroServiziException {
  691.         return this.inUsoCore.getDettagliAccordoInUso(idAccordo);
  692.     }
  693.    
  694.     public boolean isRisorsaInUso(IDResource idRisorsa, Map<ErrorsHandlerCostant, List<String>> whereIsInUso, boolean normalizeObjectIds) throws DriverRegistroServiziException {
  695.         return this.inUsoCore.isRisorsaInUso(idRisorsa, whereIsInUso, normalizeObjectIds);
  696.     }
  697.    
  698.     public String getDettagliRisorsaInUso(IDResource idResource) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
  699.         return this.inUsoCore.getDettagliRisorsaInUso(idResource);
  700.     }
  701.    
  702.     public boolean isPortTypeInUso(IDPortType idPT, Map<ErrorsHandlerCostant, List<String>> whereIsInUso, boolean normalizeObjectIds) throws DriverRegistroServiziException {
  703.         return this.inUsoCore.isPortTypeInUso(idPT, whereIsInUso, normalizeObjectIds);
  704.     }
  705.    
  706.     public String getDettagliPortTypeInUso(IDPortType idPT) throws DriverRegistroServiziException {
  707.         return this.inUsoCore.getDettagliPortTypeInUso(idPT);
  708.     }
  709.    
  710.     public boolean isOperazioneInUso(IDPortTypeAzione idOperazione, Map<ErrorsHandlerCostant, List<String>> whereIsInUso, boolean normalizeObjectIds) throws DriverRegistroServiziException {
  711.         return this.inUsoCore.isOperazioneInUso(idOperazione, whereIsInUso, normalizeObjectIds);
  712.     }
  713.    
  714.     public String getDettagliOperazioneInUso(IDPortTypeAzione idOperazione) throws DriverRegistroServiziException {
  715.         return this.inUsoCore.getDettagliOperazioneInUso(idOperazione);
  716.     }
  717.    
  718. }