ErroriIntegrazione.java

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

  21. import java.util.ArrayList;
  22. import java.util.List;

  23. import org.openspcoop2.core.id.IDServizio;
  24. import org.openspcoop2.core.id.IDServizioApplicativo;
  25. import org.openspcoop2.core.id.IDSoggetto;
  26. import org.openspcoop2.message.constants.MessageType;
  27. import org.openspcoop2.message.constants.ServiceBinding;
  28. import org.openspcoop2.message.soap.SOAPFaultCode;
  29. import org.openspcoop2.message.soap.SoapUtils;
  30. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  31. import org.openspcoop2.utils.Utilities;



  32. /**
  33. *
  34. * @author Poli Andrea (apoli@link.it)
  35. * @author $Author$
  36. * @version $Rev$, $Date$
  37. */
  38. public enum ErroriIntegrazione {

  39.     /* 5XX */
  40.    
  41.     ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO(CostantiProtocollo.SISTEMA_NON_DISPONIBILE,
  42.             CodiceErroreIntegrazione.CODICE_500_ERRORE_INTERNO),
  43.            
  44.     ERRORE_516_CONNETTORE_UTILIZZO_CON_ERRORE(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  45.             CodiceErroreIntegrazione.CODICE_516_CONNETTORE_UTILIZZO_CON_ERRORE),
  46.            
  47.     ERRORE_517_RISPOSTA_RICHIESTA_NON_RITORNATA(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  48.             CodiceErroreIntegrazione.CODICE_517_RISPOSTA_RICHIESTA_NON_RITORNATA),
  49.    
  50.     ERRORE_518_RISPOSTA_RICHIESTA_RITORNATA_COME_FAULT(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  51.             CodiceErroreIntegrazione.CODICE_518_RISPOSTA_RICHIESTA_RITORNATA_COME_FAULT),
  52.        
  53.     ERRORE_537_BUSTA_GIA_RICEVUTA("La richiesta assegnata alla busta con ID="+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_ID_BUSTA+" è già stata ricevuta e risulta ancora in processamento",
  54.             CodiceErroreIntegrazione.CODICE_537_BUSTA_GIA_RICEVUTA),
  55.            
  56.     ERRORE_538_RICHIESTA_ASINCRONA_ANCORA_IN_PROCESSAMENTO("Busta asincrona non gestibile poichè risulta ancora in gestione nella porta la precedente richiesta.",
  57.             CodiceErroreIntegrazione.CODICE_538_RICHIESTA_ASINCRONA_ANCORA_IN_PROCESSAMENTO),
  58.            
  59.     ERRORE_539_RICEVUTA_RICHIESTA_ASINCRONA_ANCORA_IN_PROCESSAMENTO("Busta asincrona non gestibile poichè risulta ancora in gestione nella porta la precedente ricevuta alla richiesta.",
  60.             CodiceErroreIntegrazione.CODICE_539_RICEVUTA_RICHIESTA_ASINCRONA_ANCORA_IN_PROCESSAMENTO),
  61.    
  62.     ERRORE_559_RICEVUTA_RISPOSTA_CON_ERRORE_TRASPORTO(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  63.             CodiceErroreIntegrazione.CODICE_559_RICEVUTA_RISPOSTA_CON_ERRORE_TRASPORTO),
  64.    
  65.     ERRORE_5XX_CUSTOM(CostantiProtocollo.KEY_ERRORE_CUSTOM,CodiceErroreIntegrazione.CODICE_5XX_CUSTOM),
  66.    
  67.    
  68.     /* 4XX */
  69.    
  70.     ERRORE_401_PORTA_INESISTENTE("La porta invocata non esiste"+
  71.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_PARAMETRI+": "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  72.             CodiceErroreIntegrazione.CODICE_401_PORTA_INESISTENTE),
  73.    
  74.     ERRORE_402_AUTENTICAZIONE_FALLITA(CostantiProtocollo.PREFISSO_AUTENTICAZIONE_FALLITA+
  75.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  76.             CodiceErroreIntegrazione.CODICE_402_AUTENTICAZIONE_FALLITA),
  77.            
  78.     ERRORE_403_AZIONE_NON_IDENTIFICATA("Identificazione dinamica dell'operazione fallita",
  79.             CodiceErroreIntegrazione.CODICE_403_AZIONE_NON_IDENTIFICATA),
  80.            
  81.     ERRORE_404_AUTORIZZAZIONE_FALLITA_SA("Il servizio applicativo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_IDENTITA_SERVIZIO_APPLICATIVO+
  82.             " non risulta autorizzato a fruire del servizio richiesto"+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  83.             CodiceErroreIntegrazione.CODICE_404_AUTORIZZAZIONE_FALLITA),
  84.    
  85.     ERRORE_404_AUTORIZZAZIONE_FALLITA_SA_ANONIMO("Il chiamante non risulta autorizzato a fruire del servizio richiesto"+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  86.             CodiceErroreIntegrazione.CODICE_404_AUTORIZZAZIONE_FALLITA),
  87.            
  88.     ERRORE_405_SERVIZIO_NON_TROVATO("Servizio richiesto con la porta delegata non trovato nel Registro dei Servizi",
  89.             CodiceErroreIntegrazione.CODICE_405_SERVIZIO_NON_TROVATO),  
  90.            
  91.     ERRORE_406_INTEGRATION_MANAGER_MESSAGGI_FOR_SIL_NON_TROVATI("Non sono stati rilevati messaggi per il servizio applicativo",
  92.             CodiceErroreIntegrazione.CODICE_406_INTEGRATION_MANAGER_MESSAGGI_FOR_SIL_NON_TROVATI),  
  93.            
  94.     ERRORE_407_INTEGRATION_MANAGER_MSG_RICHIESTO_NON_TROVATO("Non è stato rilevato il messaggio richiesto dal servizio applicativo",
  95.             CodiceErroreIntegrazione.CODICE_407_INTEGRATION_MANAGER_MSG_RICHIESTO_NON_TROVATO),
  96.        
  97.     ERRORE_408_SERVIZIO_CORRELATO_NON_TROVATO("Servizio correlato (o azione correlata), associato al servizio richiesto con la porta delegata, non trovato nel Registro dei Servizi",
  98.             CodiceErroreIntegrazione.CODICE_408_SERVIZIO_CORRELATO_NON_TROVATO),
  99.            
  100.     ERRORE_409_RISPOSTA_ASINCRONA_NON_CORRELATA_ALLA_RICHIESTA("Risposta/RichiestaStato non generabile poichè non associata ad una precedente busta di richiesta asincrona",
  101.             CodiceErroreIntegrazione.CODICE_409_RISPOSTA_ASINCRONA_NON_CORRELATA_ALLA_RICHIESTA),
  102.    
  103.     ERRORE_410_AUTENTICAZIONE_RICHIESTA("Autenticazione necessaria per invocare il servizio richiesto",
  104.             CodiceErroreIntegrazione.CODICE_410_AUTENTICAZIONE_RICHIESTA),
  105.    
  106.     ERRORE_411_RICEZIONE_CONTENUTI_ASINCRONA_RICHIESTA("Parametri di consegna della risposta asincrona non presenti nella configurazione del servizio applicativo fruitore",
  107.             CodiceErroreIntegrazione.CODICE_411_RICEZIONE_CONTENUTI_ASINCRONA_RICHIESTA),
  108.        
  109.     ERRORE_412_PD_INVOCABILE_SOLO_PER_RIFERIMENTO("Il servizio applicativo è autorizzato ad invocare la porta delegata solo attraverso una invocazione per riferimento, effettuabile tramite il servizio IntegrationManager",
  110.             CodiceErroreIntegrazione.CODICE_412_PD_INVOCABILE_SOLO_PER_RIFERIMENTO),
  111.            
  112.     ERRORE_413_PD_INVOCABILE_SOLO_SENZA_RIFERIMENTO("Il servizio applicativo non è autorizzato ad invocare la porta delegata tramite una invocazione per riferimento effettuata attraverso il servizio IntegrationManager",
  113.             CodiceErroreIntegrazione.CODICE_413_PD_INVOCABILE_SOLO_SENZA_RIFERIMENTO),
  114.    
  115.     ERRORE_414_CONSEGNA_IN_ORDINE_CON_PROFILO_NO_ONEWAY("Richiesta funzionalità di consegna in ordine con un profilo diverso da OneWay",
  116.             CodiceErroreIntegrazione.CODICE_414_CONSEGNA_IN_ORDINE_CON_PROFILO_NO_ONEWAY),
  117.    
  118.     ERRORE_415_CONSEGNA_IN_ORDINE_SENZA_VINCOLI_RICHIESTI("Richiesta funzionalità di consegna in ordine che non rispetta i vincoli richiesti; è possibile che la richiesta non sia accompagnata dalla funzionalità di gestione dei riscontri, un filtro duplicati o un id di collaborazione",
  119.             CodiceErroreIntegrazione.CODICE_415_CONSEGNA_IN_ORDINE_SENZA_VINCOLI_RICHIESTI),
  120.            
  121.     ERRORE_416_CORRELAZIONE_APPLICATIVA_RICHIESTA_ERRORE("La gestione della funzionalità di correlazione applicativa, per il messaggio di richiesta, ha generato un errore: "+
  122.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  123.             CodiceErroreIntegrazione.CODICE_416_CORRELAZIONE_APPLICATIVA_RICHIESTA_ERRORE),
  124.            
  125.     ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA +" del servizio non definito (o definito non correttamente) nel Registro dei Servizi",
  126.             CodiceErroreIntegrazione.CODICE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA),
  127.            
  128.     ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA("Il contenuto applicativo del messaggio di richiesta non rispetta l'accordo di servizio ("+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA+") definito nel Registro"+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VALIDAZIONE_ERROR_MSG,
  129.             CodiceErroreIntegrazione.CODICE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA),
  130.            
  131.     ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA("Il contenuto applicativo del messaggio di risposta non rispetta l'accordo di servizio ("+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA+") definito nel Registro"+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VALIDAZIONE_ERROR_MSG,
  132.             CodiceErroreIntegrazione.CODICE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA),
  133.            
  134.     ERRORE_420_BUSTA_PRESENTE_RICHIESTA_APPLICATIVA("Il messaggio inviato al servizio di ricezione contenuti applicativi presenta nell'header una busta",
  135.             CodiceErroreIntegrazione.CODICE_420_BUSTA_PRESENTE_RICHIESTA_APPLICATIVA),
  136.            
  137.     ERRORE_421_MSG_SOAP_NON_COSTRUIBILE_TRAMITE_RICHIESTA_APPLICATIVA("I bytes inviati al servizio di ricezione contenuti applicativi non rappresentano un messaggio SOAP: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  138.             CodiceErroreIntegrazione.CODICE_421_MSG_SOAP_NON_PRESENTE_RICHIESTA_APPLICATIVA),
  139.            
  140.     ERRORE_422_IMBUSTAMENTO_SOAP_NON_RIUSCITO_RICHIESTA_APPLICATIVA("I bytes inviati al servizio di ricezione contenuti applicativi non sono utilizzabili per formare un messaggio SOAP tramite la funzionalità di imbustamento SOAP: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  141.             CodiceErroreIntegrazione.CODICE_422_IMBUSTAMENTO_SOAP_NON_RIUSCITO_RICHIESTA_APPLICATIVA),
  142.            
  143.     ERRORE_423_SERVIZIO_CON_AZIONE_SCORRETTA("Azione richiesta non corretta: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  144.             CodiceErroreIntegrazione.CODICE_423_SERVIZIO_CON_AZIONE_SCORRETTA),
  145.            
  146.     ERRORE_424_ALLEGA_BODY("La funzionalità 'allega body' non è riuscita ad utilizzare il messaggio ricevuto: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  147.             CodiceErroreIntegrazione.CODICE_424_ALLEGA_BODY),
  148.            
  149.     ERRORE_425_SCARTA_BODY("La funzionalità 'scarta body' non è riuscita ad utilizzare il messaggio ricevuto: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  150.             CodiceErroreIntegrazione.CODICE_425_SCARTA_BODY),
  151.            
  152.     ERRORE_426_SERVLET_ERROR("Errore durante il processamento del messaggio di "+
  153.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_MESSAGGIO+" da parte del SOAPEngine: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  154.             CodiceErroreIntegrazione.CODICE_426_SERVLET_ERROR),
  155.            
  156.     ERRORE_427_MUSTUNDERSTAND_ERROR("Riscontrati header(s) \"MustUnderstand\" non processabili: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MUST_UNDERSTAND_HEADERS,
  157.             CodiceErroreIntegrazione.CODICE_427_MUSTUNDERSTAND_ERROR),
  158.            
  159.     ERRORE_428_AUTORIZZAZIONE_CONTENUTO_FALLITA("Servizio non invocabile con il contenuto applicativo fornito dal servizio applicativo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_IDENTITA_SERVIZIO_APPLICATIVO,
  160.             CodiceErroreIntegrazione.CODICE_428_AUTORIZZAZIONE_CONTENUTO_FALLITA),
  161.            
  162.     ERRORE_429_CONTENT_TYPE_NON_SUPPORTATO("Il valore dell'header HTTP Content-Type ("+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_TROVATO+") non rientra tra quelli supportati dal protocollo ("+
  163.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_SUPPORTATI+")",
  164.             CodiceErroreIntegrazione.CODICE_429_CONTENT_TYPE_NON_SUPPORTATO),
  165.            
  166.     ERRORE_430_SOAP_ENVELOPE_NAMESPACE_ERROR("SOAP Envelope contiene un namespace ("+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_NAMESPACE_TROVATO
  167.             +") diverso da quello atteso per messaggi "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_VERSION+" ("+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_NAMESPACE_SUPPORTATI+")",
  168.             CodiceErroreIntegrazione.CODICE_430_SOAP_ENVELOPE_NAMESPACE_ERROR),
  169.            
  170.     ERRORE_431_GESTORE_CREDENZIALI_ERROR("Riscontrato errore durante la gestione delle credenziali effettuata tramite il gestore ["+
  171.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_GESTORE_CREDENZIALI+"]: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  172.             CodiceErroreIntegrazione.CODICE_431_GESTORE_CREDENZIALI_ERROR),

  173.     ERRORE_432_PARSING_EXCEPTION_RICHIESTA("Il contenuto applicativo della richiesta ricevuta non è processabile: "+
  174.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  175.             CodiceErroreIntegrazione.CODICE_432_PARSING_EXCEPTION_RICHIESTA),
  176.            
  177.     ERRORE_433_CONTENT_TYPE_NON_PRESENTE("Il messaggio non contiene l'header HTTP Content-Type richiesto dalla specifica SOAP (valori ammessi: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_SUPPORTATI+")",
  178.             CodiceErroreIntegrazione.CODICE_433_CONTENT_TYPE_NON_PRESENTE),        
  179.    
  180.     ERRORE_434_CORRELAZIONE_APPLICATIVA_RISPOSTA_ERRORE("La gestione della funzionalità di correlazione applicativa, per il messaggio di risposta, ha generato un errore: "+
  181.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  182.             CodiceErroreIntegrazione.CODICE_434_CORRELAZIONE_APPLICATIVA_RISPOSTA_ERRORE),
  183.            
  184.     ERRORE_435_LOCAL_FORWARD_CONFIG_NON_VALIDA("La funzionalità local-forward non è utilizzabile nella configurazione richiesta: "+
  185.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  186.             CodiceErroreIntegrazione.CODICE_435_LOCAL_FORWARD_CONFIG_ERROR),
  187.            
  188.     ERRORE_436_TIPO_SOGGETTO_FRUITORE_NOT_SUPPORTED_BY_PROTOCOL("Il tipo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO+
  189.             " associato al soggetto fruitore "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME+
  190.             " non è tra i tipi supportati dal protocollo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL+" (tipi supportati: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,
  191.             CodiceErroreIntegrazione.CODICE_436_TIPO_SOGGETTO_FRUITORE_NOT_SUPPORTED_BY_PROTOCOL),
  192.            
  193.     ERRORE_437_TIPO_SOGGETTO_EROGATORE_NOT_SUPPORTED_BY_PROTOCOL("Il tipo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO+
  194.             " associato al soggetto erogatore "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME+
  195.             " non è tra i tipi supportati dal protocollo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL+" (tipi supportati: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,
  196.             CodiceErroreIntegrazione.CODICE_437_TIPO_SOGGETTO_EROGATORE_NOT_SUPPORTED_BY_PROTOCOL),
  197.            
  198.     ERRORE_438_TIPO_SERVIZIO_NOT_SUPPORTED_BY_PROTOCOL("Il tipo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO+
  199.             " associato al servizio"+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME+
  200.             " versione "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VERSIONE+
  201.             " non è tra i tipi supportati dal protocollo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL+" (tipi supportati: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,
  202.             CodiceErroreIntegrazione.CODICE_438_TIPO_SERVIZIO_NOT_SUPPORTED_BY_PROTOCOL),
  203.            
  204.     ERRORE_439_FUNZIONALITA_NOT_SUPPORTED_BY_PROTOCOL("Il servizio richiede una funzionalità non supportata dal protocollo "+
  205.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL+": "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  206.             CodiceErroreIntegrazione.CODICE_439_FUNZIONALITA_NOT_SUPPORTED_BY_PROTOCOL),
  207.    
  208.     ERRORE_440_PARSING_EXCEPTION_RISPOSTA("Il contenuto applicativo della risposta ricevuta non è processabile: "+
  209.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,
  210.             CodiceErroreIntegrazione.CODICE_440_PARSING_EXCEPTION_RISPOSTA),
  211.    
  212.     ERRORE_441_PORTA_NON_INVOCABILE_DIRETTAMENTE("La porta utilizzata"+
  213.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_PARAMETRI+" non è invocabile direttamente",
  214.             CodiceErroreIntegrazione.CODICE_441_PORTA_NON_INVOCABILE_DIRETTAMENTE),
  215.    
  216.     ERRORE_442_RIFERIMENTO_ID_MESSAGGIO("Tra le informazioni di integrazione non è stato rilevato il riferimento ad un identificativo di un messaggio precedente",
  217.             CodiceErroreIntegrazione.CODICE_442_RIFERIMENTO_ID_MESSAGGIO),
  218.    
  219.     ERRORE_443_TOKEN_NON_PRESENTE("Token non presente",
  220.             CodiceErroreIntegrazione.CODICE_443_TOKEN_NON_PRESENTE),
  221.    
  222.     ERRORE_444_TOKEN_NON_VALIDO("Token non valido",
  223.             CodiceErroreIntegrazione.CODICE_444_TOKEN_NON_VALIDO),
  224.    
  225.     ERRORE_445_TOKEN_AUTORIZZAZIONE_FALLITA("La richiesta presenta un token non sufficiente per fruire del servizio richiesto",
  226.             CodiceErroreIntegrazione.CODICE_445_TOKEN_AUTORIZZAZIONE_FALLITA),

  227.     ERRORE_446_PORTA_SOSPESA("Porta disabilitata",
  228.             CodiceErroreIntegrazione.CODICE_446_SUSPEND),
  229.    
  230.     ERRORE_447_API_NON_INVOCABILE_CONTESTO_UTILIZZATO("L'API invocata possiede un service binding non abilitato sul contesto utilizzato",
  231.             CodiceErroreIntegrazione.CODICE_447_API_NON_INVOCABILE_CONTESTO_UTILIZZATO),
  232.    
  233.     ERRORE_448_API_NON_INVOCABILE_TIPO_SERVIZIO_UTILIZZATO("L'API invocata possiede un service binding non abilitato per il tipo di servizio utilizzato",
  234.             CodiceErroreIntegrazione.CODICE_448_API_NON_INVOCABILE_TIPO_SERVIZIO_UTILIZZATO),
  235.    
  236.     ERRORE_449_TIPO_SOGGETTO_APPLICATIVO_TOKEN_NOT_SUPPORTED_BY_PROTOCOL("Il tipo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO+
  237.             " del soggetto appartenente all'applicativo token "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME+
  238.             " non è tra i tipi supportati dal protocollo "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL+" (tipi supportati: "+CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,
  239.             CodiceErroreIntegrazione.CODICE_449_TIPO_SOGGETTO_APPLICATIVO_TOKEN_NOT_SUPPORTED_BY_PROTOCOL),
  240.    
  241.     // errori spediti in buste errore
  242.    
  243.     ERRORE_450_PA_INESISTENTE("La porta applicativa richiesta dalla busta non esiste",
  244.             CodiceErroreIntegrazione.CODICE_450_PA_INESISTENTE),
  245.    
  246.     ERRORE_451_SOGGETTO_INESISTENTE("Il soggetto richiesto dalla busta non è gestito dalla PdD",
  247.             CodiceErroreIntegrazione.CODICE_451_SOGGETTO_INESISTENTE),
  248.            
  249.     ERRORE_452_BUSTA_GIA_RICEVUTA("La busta è già stata ricevuta",
  250.             CodiceErroreIntegrazione.CODICE_452_BUSTA_GIA_RICEVUTA),
  251.    
  252.     ERRORE_453_SA_INESISTENTE("Il servizio applicativo associato alla porta applicativa richiesta dalla busta non esiste",
  253.             CodiceErroreIntegrazione.CODICE_453_SA_INESISTENTE),
  254.            
  255.     ERRORE_454_BUSTA_PRESENTE_RISPOSTA_APPLICATIVA("Il messaggio inviato al servizio di consegna contenuti applicativi presenta nell'header una busta",
  256.             CodiceErroreIntegrazione.CODICE_454_BUSTA_PRESENTE_RISPOSTA_APPLICATIVA),
  257.    
  258.     ERRORE_455_DATI_BUSTA_DIFFERENTI_PA_INVOCATA( (CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_OGGETTO_DIVERSO_TRA_BUSTA_E_PA+" ("+
  259.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_DATO_BUSTA+") presente nel messaggio di protocollo ricevuto differente da quello definito ("+
  260.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_DATO_PA+") nella porta applicativa invocata ("+
  261.             CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_LOCATION+")"),
  262.             CodiceErroreIntegrazione.CODICE_455_DATI_BUSTA_DIFFERENTI_PA_INVOCATA),

  263.     ERRORE_4XX_CUSTOM(CostantiProtocollo.KEY_ERRORE_CUSTOM,CodiceErroreIntegrazione.CODICE_4XX_CUSTOM);

  264.    
  265.    
  266.     private final String descrizione;
  267.     private final CodiceErroreIntegrazione codiceErrore;
  268.    
  269.     ErroriIntegrazione(String descrizione,CodiceErroreIntegrazione codiceErrore){
  270.         this.descrizione = descrizione;
  271.         this.codiceErrore = codiceErrore;
  272.     }
  273.    
  274.     @Override
  275.     public String toString() {
  276.         return newErroreIntegrazione().toString();
  277.     }
  278.    
  279.     private ErroreIntegrazione newErroreIntegrazione(SOAPFaultCode faultCode, KeyValueObject ... keyValueObjects){
  280.         return newErroreIntegrazione(this.descrizione, this.codiceErrore, faultCode, keyValueObjects);
  281.     }
  282.    
  283.     private ErroreIntegrazione newErroreIntegrazione(KeyValueObject ... keyValueObjects){
  284.         return newErroreIntegrazione(this.descrizione, this.codiceErrore, keyValueObjects);
  285.     }
  286.    
  287.     @SuppressWarnings("unused")
  288.     private ErroreIntegrazione newErroreIntegrazione(String descrizioneParam, KeyValueObject ... keyValueObjects){
  289.         return newErroreIntegrazione(descrizioneParam, this.codiceErrore, keyValueObjects);
  290.     }
  291.     @SuppressWarnings("unused")
  292.     private ErroreIntegrazione newErroreIntegrazione(CodiceErroreIntegrazione codiceParam, KeyValueObject ... keyValueObjects){
  293.         return newErroreIntegrazione(this.descrizione, codiceParam, keyValueObjects);
  294.     }
  295.     private ErroreIntegrazione newErroreIntegrazione(String descrizioneParam,CodiceErroreIntegrazione codiceParam, KeyValueObject ... keyValueObjects){
  296.         String newDescrizione = new String(descrizioneParam!=null ? descrizioneParam : "Internal Error");
  297.         return new ErroreIntegrazione(newDescrizione, codiceParam, keyValueObjects);
  298.     }
  299.    
  300.     private ErroreIntegrazione newErroreIntegrazione(String descrizioneParam,CodiceErroreIntegrazione codiceParam, SOAPFaultCode faultCode, KeyValueObject ... keyValueObjects){
  301.         String newDescrizione = new String(descrizioneParam!=null ? descrizioneParam : "Internal Error");
  302.         return new ErroreIntegrazione(newDescrizione, codiceParam, faultCode, keyValueObjects);
  303.     }
  304.    
  305.     public ErroreIntegrazione getErroreIntegrazione() {
  306.         if( this.equals(ERRORE_401_PORTA_INESISTENTE) ||
  307.             this.equals(ERRORE_402_AUTENTICAZIONE_FALLITA) ||
  308.             this.equals(ERRORE_404_AUTORIZZAZIONE_FALLITA_SA) ||
  309.             this.equals(ERRORE_404_AUTORIZZAZIONE_FALLITA_SA_ANONIMO) ||
  310.             this.equals(ERRORE_416_CORRELAZIONE_APPLICATIVA_RICHIESTA_ERRORE) ||
  311.             this.equals(ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA) ||
  312.             this.equals(ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA) ||
  313.             this.equals(ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA) ||
  314.             this.equals(ERRORE_421_MSG_SOAP_NON_COSTRUIBILE_TRAMITE_RICHIESTA_APPLICATIVA) ||
  315.             this.equals(ERRORE_422_IMBUSTAMENTO_SOAP_NON_RIUSCITO_RICHIESTA_APPLICATIVA) ||
  316.             this.equals(ERRORE_423_SERVIZIO_CON_AZIONE_SCORRETTA) ||
  317.             this.equals(ERRORE_424_ALLEGA_BODY) ||
  318.             this.equals(ERRORE_425_SCARTA_BODY) ||
  319.             this.equals(ERRORE_426_SERVLET_ERROR) ||
  320.             this.equals(ERRORE_427_MUSTUNDERSTAND_ERROR) ||
  321.             this.equals(ERRORE_428_AUTORIZZAZIONE_CONTENUTO_FALLITA) ||
  322.             this.equals(ERRORE_429_CONTENT_TYPE_NON_SUPPORTATO) ||
  323.             this.equals(ERRORE_430_SOAP_ENVELOPE_NAMESPACE_ERROR) ||
  324.             this.equals(ERRORE_431_GESTORE_CREDENZIALI_ERROR) ||
  325.             this.equals(ERRORE_432_PARSING_EXCEPTION_RICHIESTA) ||
  326.             this.equals(ERRORE_433_CONTENT_TYPE_NON_PRESENTE) ||
  327.             this.equals(ERRORE_434_CORRELAZIONE_APPLICATIVA_RISPOSTA_ERRORE) ||
  328.             this.equals(ERRORE_435_LOCAL_FORWARD_CONFIG_NON_VALIDA) ||
  329.             this.equals(ERRORE_436_TIPO_SOGGETTO_FRUITORE_NOT_SUPPORTED_BY_PROTOCOL) ||
  330.             this.equals(ERRORE_437_TIPO_SOGGETTO_EROGATORE_NOT_SUPPORTED_BY_PROTOCOL) ||
  331.             this.equals(ERRORE_438_TIPO_SERVIZIO_NOT_SUPPORTED_BY_PROTOCOL) ||
  332.             this.equals(ERRORE_439_FUNZIONALITA_NOT_SUPPORTED_BY_PROTOCOL) ||
  333.             this.equals(ERRORE_441_PORTA_NON_INVOCABILE_DIRETTAMENTE) ||
  334.             this.equals(ERRORE_455_DATI_BUSTA_DIFFERENTI_PA_INVOCATA) ||
  335.             this.equals(ERRORE_4XX_CUSTOM) ||
  336.             this.equals(ERRORE_516_CONNETTORE_UTILIZZO_CON_ERRORE) ||
  337.             this.equals(ERRORE_517_RISPOSTA_RICHIESTA_NON_RITORNATA) ||
  338.             this.equals(ERRORE_518_RISPOSTA_RICHIESTA_RITORNATA_COME_FAULT) ||
  339.             this.equals(ERRORE_537_BUSTA_GIA_RICEVUTA) ||
  340.             this.equals(ERRORE_5XX_CUSTOM)
  341.             ){
  342.             throw new RuntimeException("Il metodo non può essere utilizzato con il messaggio "+this.name());
  343.         }
  344.         return newErroreIntegrazione();
  345.     }
  346.    
  347.    
  348.     /* 5XX */
  349.        
  350.     public ErroreIntegrazione get5XX_ErroreProcessamento(Exception e) {
  351.         return get5XX_ErroreProcessamento(Utilities.readFirstErrorValidMessageFromException(e), ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.codiceErrore);
  352.     }
  353.     public ErroreIntegrazione get5XX_ErroreProcessamento(String descrizione) {
  354.         return get5XX_ErroreProcessamento(descrizione, ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.codiceErrore);
  355.     }
  356.     public ErroreIntegrazione get5XX_ErroreProcessamento(CodiceErroreIntegrazione codiceErroreIntegrazione) {
  357.         return get5XX_ErroreProcessamento(ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.descrizione, codiceErroreIntegrazione);
  358.     }
  359.     public ErroreIntegrazione get5XX_ErroreProcessamento(Throwable e,CodiceErroreIntegrazione codiceErroreIntegrazione) {
  360.         return get5XX_ErroreProcessamento(Utilities.readFirstErrorValidMessageFromException(e), codiceErroreIntegrazione);
  361.     }
  362.     public ErroreIntegrazione get5XX_ErroreProcessamento(String descrizione,CodiceErroreIntegrazione codiceErroreIntegrazione) {
  363.         if(this.equals(ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO)){
  364.             if(codiceErroreIntegrazione.getCodice()<500){
  365.                 throw new RuntimeException("Il metodo può essere utilizzato solo con un codice maggiore o uguale a 500");  
  366.             }
  367.             return newErroreIntegrazione(descrizione, codiceErroreIntegrazione);
  368.         }else{
  369.             throw new RuntimeException("Il metodo può essere utilizzato solo con il messaggio "+ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.name());
  370.         }
  371.     }
  372.    
  373.     public ErroreIntegrazione get516_ServizioApplicativoNonDisponibile() {
  374.         return get516_ConnettoreUtilizzatoConErrore(CostantiProtocollo.SERVIZIO_APPLICATIVO_NON_DISPONIBILE, null);
  375.     }
  376.     public ErroreIntegrazione get516_PortaDiDominioNonDisponibile(String nomePdd) {
  377.         return get516_ConnettoreUtilizzatoConErrore(CostantiProtocollo.PDD_NON_DISPONIBILE, nomePdd);
  378.     }
  379.     private ErroreIntegrazione get516_ConnettoreUtilizzatoConErrore(String msgErrore,String nomePdd) {
  380.         if(!this.equals(ERRORE_516_CONNETTORE_UTILIZZO_CON_ERRORE)){
  381.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_516_CONNETTORE_UTILIZZO_CON_ERRORE.name());
  382.         }
  383.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  384.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  385.         if(nomePdd!=null){
  386.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONNETTORE_ERRORE_PDD,nomePdd));
  387.         }
  388.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  389.     }
  390.    
  391.     public ErroreIntegrazione get517_RispostaRichiestaNonRitornata() {
  392.         return get517_RispostaRichiestaNonRitornata(CostantiProtocollo.SERVIZIO_APPLICATIVO_NON_DISPONIBILE, null);
  393.     }
  394.     public ErroreIntegrazione get517_RispostaRichiestaNonRitornata(String nomePdd) {
  395.         return get517_RispostaRichiestaNonRitornata(CostantiProtocollo.PDD_NON_DISPONIBILE, nomePdd);
  396.     }
  397.     private ErroreIntegrazione get517_RispostaRichiestaNonRitornata(String msgErrore,String nomePdd) {
  398.         if(!this.equals(ERRORE_517_RISPOSTA_RICHIESTA_NON_RITORNATA)){
  399.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_517_RISPOSTA_RICHIESTA_NON_RITORNATA.name());
  400.         }
  401.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  402.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  403.         if(nomePdd!=null){
  404.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONNETTORE_ERRORE_PDD,nomePdd));
  405.         }
  406.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  407.     }
  408.    
  409.     public ErroreIntegrazione get518_RispostaRichiestaRitornataComeFault() {
  410.         return get518_RispostaRichiestaRitornataComeFault(CostantiProtocollo.SERVIZIO_APPLICATIVO_NON_DISPONIBILE, null);
  411.     }
  412.     public ErroreIntegrazione get518_RispostaRichiestaRitornataComeFault(String nomePdd) {
  413.         return get518_RispostaRichiestaRitornataComeFault(CostantiProtocollo.PDD_NON_DISPONIBILE, nomePdd);
  414.     }
  415.     private ErroreIntegrazione get518_RispostaRichiestaRitornataComeFault(String msgErrore,String nomePdd) {
  416.         if(!this.equals(ERRORE_518_RISPOSTA_RICHIESTA_RITORNATA_COME_FAULT)){
  417.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_518_RISPOSTA_RICHIESTA_RITORNATA_COME_FAULT.name());
  418.         }
  419.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  420.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  421.         if(nomePdd!=null){
  422.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONNETTORE_ERRORE_PDD,nomePdd));
  423.         }
  424.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  425.     }
  426.    
  427.     public ErroreIntegrazione get537_BustaGiaRicevuta(String id) {
  428.         if(!this.equals(ERRORE_537_BUSTA_GIA_RICEVUTA)){
  429.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_537_BUSTA_GIA_RICEVUTA.name());
  430.         }
  431.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  432.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_ID_BUSTA,id));
  433.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  434.     }
  435.    
  436.     public ErroreIntegrazione get559_RicevutaRispostaConErroreTrasporto(String msgErrore) {
  437.         if(!this.equals(ERRORE_559_RICEVUTA_RISPOSTA_CON_ERRORE_TRASPORTO)){
  438.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_559_RICEVUTA_RISPOSTA_CON_ERRORE_TRASPORTO.name());
  439.         }
  440.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  441.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  442.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  443.     }
  444.    
  445.     public ErroreIntegrazione get5XX_Custom(String descrizione,String codiceErroreIntegrazione) {
  446.         if(this.equals(ERRORE_5XX_CUSTOM)){
  447.             if(codiceErroreIntegrazione==null){
  448.                 throw new RuntimeException("Il metodo può essere utilizzato senza fornire un codice errore di integrazione personalizzato");    
  449.             }
  450.             ErroreIntegrazione e = newErroreIntegrazione(descrizione, CodiceErroreIntegrazione.CODICE_5XX_CUSTOM);
  451.             e.setCodiceCustom(codiceErroreIntegrazione);
  452.             return e;
  453.         }else{
  454.             throw new RuntimeException("Il metodo può essere utilizzato solo con il messaggio "+ERRORE_5XX_CUSTOM.name());
  455.         }
  456.     }
  457.    
  458.    
  459.    
  460.     /* 4XX */
  461.    
  462.     public ErroreIntegrazione getErrore401_PortaInesistente(String motivoErroreInvocazione) {
  463.         return getErrore401_PortaInesistente(motivoErroreInvocazione, null, null,null);
  464.     }
  465.     public ErroreIntegrazione getErrore401_PortaInesistente(String motivoErroreInvocazione,String location,String urlInvocazione) {
  466.         return getErrore401_PortaInesistente(motivoErroreInvocazione, location, urlInvocazione,null);
  467.     }
  468.     public ErroreIntegrazione getErrore401_PortaInesistente(String motivoErroreInvocazione,String servizioApplicativo) {
  469.         return getErrore401_PortaInesistente(motivoErroreInvocazione, null, null,servizioApplicativo);
  470.     }
  471.     public ErroreIntegrazione getErrore401_PortaInesistente(String motivoErroreInvocazione,String location,String urlInvocazione,String servizioApplicativo) {
  472.         if(!this.equals(ERRORE_401_PORTA_INESISTENTE)){
  473.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_401_PORTA_INESISTENTE.name());
  474.         }
  475.         StringBuilder bf = new StringBuilder();
  476.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  477.         if(location!=null){
  478.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_LOCATION,location));
  479.             bf.append(" porta["+location+"]");
  480.         }
  481.         if(urlInvocazione!=null){
  482.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_URL_INVOCAZIONE,urlInvocazione));
  483.             bf.append(" urlInvocazione["+urlInvocazione+"]");
  484.         }
  485.         if(servizioApplicativo!=null){
  486.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_SERVIZIO_APPLICATIVO,servizioApplicativo));
  487.             bf.append(" servizioApplicativo["+servizioApplicativo+"]");
  488.         }
  489.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_PARAMETRI,bf.toString()));
  490.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,motivoErroreInvocazione));
  491.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  492.     }
  493.    
  494.     public ErroreIntegrazione getErrore402_AutenticazioneFallita(String msgErrore) {
  495.         return getErrore402_AutenticazioneFallita(msgErrore, null, null, null);
  496.     }
  497.     public ErroreIntegrazione getErrore402_AutenticazioneFallitaBasic(String msgErrore,String username,String password) {
  498.         return getErrore402_AutenticazioneFallita(msgErrore, username, password, null);
  499.     }
  500.     public ErroreIntegrazione getErrore402_AutenticazioneFallitaSsl(String msgErrore,String subject) {
  501.         return getErrore402_AutenticazioneFallita(msgErrore, null, null, subject);
  502.     }
  503.     public ErroreIntegrazione getErrore402_AutenticazioneFallitaPrincipal(String msgErrore,String userId) {
  504.         return getErrore402_AutenticazioneFallita(msgErrore, userId, null, null);
  505.     }
  506.     public ErroreIntegrazione getErrore402_AutenticazioneFallitaToken(String msgErrore,String clientId) {
  507.         return getErrore402_AutenticazioneFallita(msgErrore, clientId, null, null);
  508.     }
  509.     public ErroreIntegrazione getErrore402_AutenticazioneFallita(String msgErrore,String username,String password,String subject) {
  510.         if(!this.equals(ERRORE_402_AUTENTICAZIONE_FALLITA)){
  511.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_402_AUTENTICAZIONE_FALLITA.name());
  512.         }
  513.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  514.         if(username!=null){
  515.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_AUTENTICAZIONE_CREDENZIALE_USERNAME,username));
  516.         }
  517.         if(password!=null){
  518.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_AUTENTICAZIONE_CREDENZIALE_PASSWORD,password));
  519.         }
  520.         if(subject!=null){
  521.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_AUTENTICAZIONE_CREDENZIALE_SUBJECT,subject));
  522.         }
  523.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  524.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  525.     }
  526.        
  527.     public ErroreIntegrazione getErrore404_AutorizzazioneFallitaServizioApplicativo(String servizioApplicativo) {
  528.         return getErrore404_AutorizzazioneFallitaServizioApplicativo(servizioApplicativo, null);
  529.     }
  530.     public ErroreIntegrazione getErrore404_AutorizzazioneFallitaServizioApplicativo(String servizioApplicativo, String msgErrore) {
  531.         if(!this.equals(ERRORE_404_AUTORIZZAZIONE_FALLITA_SA)){
  532.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_404_AUTORIZZAZIONE_FALLITA_SA.name());
  533.         }
  534.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  535.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_IDENTITA_SERVIZIO_APPLICATIVO,servizioApplicativo));
  536.         if(msgErrore!=null){
  537.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,": "+msgErrore));
  538.         }
  539.         else{
  540.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,""));
  541.         }
  542.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  543.     }
  544.    
  545.     public ErroreIntegrazione getErrore404_AutorizzazioneFallitaServizioApplicativoAnonimo() {
  546.         return getErrore404_AutorizzazioneFallitaServizioApplicativoAnonimo(null);
  547.     }
  548.     public ErroreIntegrazione getErrore404_AutorizzazioneFallitaServizioApplicativoAnonimo(String msgErrore) {
  549.         if(!this.equals(ERRORE_404_AUTORIZZAZIONE_FALLITA_SA_ANONIMO)){
  550.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_404_AUTORIZZAZIONE_FALLITA_SA_ANONIMO.name());
  551.         }
  552.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  553.         if(msgErrore!=null){
  554.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE," "+msgErrore));
  555.         }
  556.         else{
  557.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,""));
  558.         }
  559.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  560.     }
  561.    
  562.     public ErroreIntegrazione getErrore416_CorrelazioneApplicativaRichiesta(String msgErrore) {
  563.         if(!this.equals(ERRORE_416_CORRELAZIONE_APPLICATIVA_RICHIESTA_ERRORE)){
  564.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_416_CORRELAZIONE_APPLICATIVA_RICHIESTA_ERRORE.name());
  565.         }
  566.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  567.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  568.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  569.     }
  570.    
  571.     public ErroreIntegrazione getErrore417_CostruzioneValidatoreTramiteInterfacciaFallita(String tipoInterfaccia) {
  572.         if(!this.equals(ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA)){
  573.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA.name());
  574.         }
  575.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  576.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA,tipoInterfaccia));
  577.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  578.     }
  579.    
  580.     public ErroreIntegrazione getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(String tipoInterfaccia, String errorMsg, boolean overwriteMessageError) {
  581.        
  582.         if(overwriteMessageError) {
  583.             return new ErroreIntegrazione(errorMsg, this.codiceErrore);
  584.         }
  585.        
  586.         if(!this.equals(ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA)){
  587.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.name());
  588.         }
  589.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  590.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA,tipoInterfaccia));
  591.        
  592.         String error = "";
  593.         if(errorMsg!=null && !"".equals(errorMsg) && !"null".equals(errorMsg)) {
  594.             error = ": "+errorMsg;
  595.         }
  596.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VALIDAZIONE_ERROR_MSG,error));
  597.            
  598.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  599.     }
  600.    
  601.     public ErroreIntegrazione getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(String tipoInterfaccia, String errorMsg, boolean overwriteMessageError) {
  602.        
  603.         if(overwriteMessageError) {
  604.             return new ErroreIntegrazione(errorMsg, this.codiceErrore);
  605.         }
  606.        
  607.         if(!this.equals(ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA)){
  608.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.name());
  609.         }
  610.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  611.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_INTERFACCIA,tipoInterfaccia));
  612.        
  613.         String error = "";
  614.         if(errorMsg!=null && !"".equals(errorMsg) && !"null".equals(errorMsg)) {
  615.             error = ": "+errorMsg;
  616.         }
  617.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VALIDAZIONE_ERROR_MSG,error));
  618.        
  619.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  620.     }

  621.     public ErroreIntegrazione getErrore421_MessaggioSOAPNonGenerabile(String msgErrore) {
  622.         if(!this.equals(ERRORE_421_MSG_SOAP_NON_COSTRUIBILE_TRAMITE_RICHIESTA_APPLICATIVA)){
  623.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_421_MSG_SOAP_NON_COSTRUIBILE_TRAMITE_RICHIESTA_APPLICATIVA.name());
  624.         }
  625.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  626.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  627.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  628.     }
  629.    
  630.     public ErroreIntegrazione getErrore422_MessaggioSOAPNonGenerabileTramiteImbustamentoSOAP(String msgErrore) {
  631.         if(!this.equals(ERRORE_422_IMBUSTAMENTO_SOAP_NON_RIUSCITO_RICHIESTA_APPLICATIVA)){
  632.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_422_IMBUSTAMENTO_SOAP_NON_RIUSCITO_RICHIESTA_APPLICATIVA.name());
  633.         }
  634.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  635.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  636.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  637.     }
  638.    
  639.     public ErroreIntegrazione getErrore423_ServizioConAzioneScorretta(String msgErrore) {
  640.         if(!this.equals(ERRORE_423_SERVIZIO_CON_AZIONE_SCORRETTA)){
  641.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_423_SERVIZIO_CON_AZIONE_SCORRETTA.name());
  642.         }
  643.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  644.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  645.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  646.     }
  647.    
  648.     public ErroreIntegrazione getErrore424_AllegaBody(String msgErrore) {
  649.         if(!this.equals(ERRORE_424_ALLEGA_BODY)){
  650.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_424_ALLEGA_BODY.name());
  651.         }
  652.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  653.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  654.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  655.     }
  656.    
  657.     public ErroreIntegrazione getErrore425_ScartaBody(String msgErrore) {
  658.         if(!this.equals(ERRORE_425_SCARTA_BODY)){
  659.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_425_SCARTA_BODY.name());
  660.         }
  661.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  662.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  663.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  664.     }
  665.    
  666.     public ErroreIntegrazione getErrore426_ServletError(boolean isRichiesta,Throwable eProcessamento) {
  667.         return getErrore426_ServletError(isRichiesta, null, eProcessamento);
  668.     }
  669.     public ErroreIntegrazione getErrore426_ServletError(boolean isRichiesta,String error) {
  670.         return getErrore426_ServletError(isRichiesta, error, null);
  671.     }
  672.     public ErroreIntegrazione getErrore426_ServletError(boolean isRichiesta,String error,Throwable eProcessamento) {
  673.         if(!this.equals(ERRORE_426_SERVLET_ERROR)){
  674.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_426_SERVLET_ERROR.name());
  675.         }
  676.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  677.         if(isRichiesta){
  678.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_MESSAGGIO,"richiesta"));
  679.         }
  680.         else{
  681.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_MESSAGGIO,"risposta"));
  682.         }
  683.         String msgErrore = null;
  684.         if(error!=null){
  685.             msgErrore = new String(error);
  686.         }
  687.         if(msgErrore==null){
  688.             if(eProcessamento!=null){
  689.                 if(eProcessamento.getMessage()!=null)
  690.                     msgErrore = "ErroreProcessamento: "+eProcessamento.getMessage();
  691.                 else
  692.                     msgErrore ="ErroreProcessamento: "+eProcessamento.toString();
  693.             }
  694.         }else{
  695.             if(eProcessamento!=null){
  696.                 if(eProcessamento.getMessage()!=null)
  697.                     msgErrore = msgErrore+" "+eProcessamento.getMessage();
  698.                 else
  699.                     msgErrore = msgErrore+" "+eProcessamento.toString();
  700.             }
  701.         }
  702.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  703.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  704.     }
  705.    
  706.     public ErroreIntegrazione getErrore427_MustUnderstandHeaders(String headers) {
  707.         if(!this.equals(ERRORE_427_MUSTUNDERSTAND_ERROR)){
  708.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_427_MUSTUNDERSTAND_ERROR.name());
  709.         }
  710.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  711.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MUST_UNDERSTAND_HEADERS,headers));
  712.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  713.     }
  714.    
  715.     public ErroreIntegrazione getErrore428_AutorizzazioneContenutoFallita(String servizioApplicativo) {
  716.         if(!this.equals(ERRORE_428_AUTORIZZAZIONE_CONTENUTO_FALLITA)){
  717.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_428_AUTORIZZAZIONE_CONTENUTO_FALLITA.name());
  718.         }
  719.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  720.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_IDENTITA_SERVIZIO_APPLICATIVO,servizioApplicativo));
  721.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  722.     }
  723.    
  724.     public ErroreIntegrazione getErrore429_ContentTypeNonSupportato(String contentTypeTrovato, List<String> contentTypesSupportati) {
  725.         if(!this.equals(ERRORE_429_CONTENT_TYPE_NON_SUPPORTATO)){
  726.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_429_CONTENT_TYPE_NON_SUPPORTATO.name());
  727.         }
  728.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  729.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_TROVATO,contentTypeTrovato));
  730.         if(contentTypesSupportati!=null && contentTypesSupportati.size()>0){
  731.             StringBuilder bf = new StringBuilder();
  732.             for (int i = 0; i < contentTypesSupportati.size(); i++) {
  733.                 if(bf.length()>0){
  734.                     bf.append(", ");
  735.                 }
  736.                 bf.append(contentTypesSupportati.get(i));
  737.             }
  738.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_SUPPORTATI,bf.toString()));
  739.         }
  740.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  741.     }
  742.    
  743.     public ErroreIntegrazione getErrore430_SoapNamespaceNonSupportato(MessageType messageType, String namespaceTrovato) {
  744.         if(!this.equals(ERRORE_430_SOAP_ENVELOPE_NAMESPACE_ERROR)){
  745.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_430_SOAP_ENVELOPE_NAMESPACE_ERROR.name());
  746.         }
  747.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  748.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_VERSION,messageType.getMessageVersionAsString()));
  749.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_NAMESPACE_TROVATO,namespaceTrovato));
  750.         try{
  751.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_SOAP_NAMESPACE_SUPPORTATI,SoapUtils.getSoapEnvelopeNS(messageType)));
  752.         }catch(Exception e){
  753.             throw new RuntimeException(e.getMessage(),e);
  754.         }
  755.        
  756.         return newErroreIntegrazione(SOAPFaultCode.VersionMismatch, lista.toArray(new KeyValueObject[lista.size()]));
  757.     }
  758.    
  759.     public ErroreIntegrazione getErrore431_ErroreGestoreCredenziali(String tipoGestore,Exception e) {
  760.         if(!this.equals(ERRORE_431_GESTORE_CREDENZIALI_ERROR)){
  761.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_431_GESTORE_CREDENZIALI_ERROR.name());
  762.         }
  763.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  764.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO_GESTORE_CREDENZIALI,tipoGestore));
  765.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,e.getMessage()));
  766.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  767.     }
  768.    
  769.     public ErroreIntegrazione getErrore432_MessaggioRichiestaMalformato(Throwable e) {
  770.         if(!this.equals(ERRORE_432_PARSING_EXCEPTION_RICHIESTA)){
  771.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_432_PARSING_EXCEPTION_RICHIESTA.name());
  772.         }
  773.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  774.         if(e.getMessage()!=null)
  775.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,e.getMessage()));
  776.         else
  777.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,e.toString()));
  778.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  779.     }
  780.    
  781.     public ErroreIntegrazione getErrore433_ContentTypeNonPresente(List<String> contentTypesSupportati) {
  782.         if(!this.equals(ERRORE_433_CONTENT_TYPE_NON_PRESENTE)){
  783.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_433_CONTENT_TYPE_NON_PRESENTE.name());
  784.         }
  785.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  786.         if(contentTypesSupportati!=null && contentTypesSupportati.size()>0){
  787.             StringBuilder bf = new StringBuilder();
  788.             for (int i = 0; i < contentTypesSupportati.size(); i++) {
  789.                 if(bf.length()>0){
  790.                     bf.append(", ");
  791.                 }
  792.                 bf.append(contentTypesSupportati.get(i));
  793.             }
  794.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_CONTENT_TYPE_SUPPORTATI,bf.toString()));
  795.         }
  796.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  797.     }
  798.    
  799.     public ErroreIntegrazione getErrore434_CorrelazioneApplicativaRisposta(String msgErrore) {
  800.         if(!this.equals(ERRORE_434_CORRELAZIONE_APPLICATIVA_RISPOSTA_ERRORE)){
  801.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_434_CORRELAZIONE_APPLICATIVA_RISPOSTA_ERRORE.name());
  802.         }
  803.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  804.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  805.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  806.     }
  807.    
  808.     public ErroreIntegrazione getErrore435_LocalForwardConfigNonValida(String msgErrore) {
  809.         if(!this.equals(ERRORE_435_LOCAL_FORWARD_CONFIG_NON_VALIDA)){
  810.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_435_LOCAL_FORWARD_CONFIG_NON_VALIDA.name());
  811.         }
  812.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  813.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  814.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  815.     }
  816.    
  817.     public ErroreIntegrazione getErrore436_TipoSoggettoFruitoreNotSupportedByProtocol(IDSoggetto fruitore,IProtocolFactory<?> protocolFactory) {
  818.         if(!this.equals(ERRORE_436_TIPO_SOGGETTO_FRUITORE_NOT_SUPPORTED_BY_PROTOCOL)){
  819.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_436_TIPO_SOGGETTO_FRUITORE_NOT_SUPPORTED_BY_PROTOCOL.name());
  820.         }
  821.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  822.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO,fruitore.getTipo()));
  823.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME,fruitore.getNome()));
  824.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL,protocolFactory.getProtocol()));
  825.         try{
  826.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,protocolFactory.createProtocolConfiguration().getTipiSoggetti().toString()));
  827.         }catch(Exception e){
  828.             // ignore
  829.         }
  830.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  831.     }
  832.    
  833.     public ErroreIntegrazione getErrore437_TipoSoggettoErogatoreNotSupportedByProtocol(IDSoggetto erogatore,IProtocolFactory<?> protocolFactory) {
  834.         if(!this.equals(ERRORE_437_TIPO_SOGGETTO_EROGATORE_NOT_SUPPORTED_BY_PROTOCOL)){
  835.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_437_TIPO_SOGGETTO_EROGATORE_NOT_SUPPORTED_BY_PROTOCOL.name());
  836.         }
  837.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  838.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO,erogatore.getTipo()));
  839.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME,erogatore.getNome()));
  840.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL,protocolFactory.getProtocol()));
  841.         try{
  842.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,protocolFactory.createProtocolConfiguration().getTipiSoggetti().toString()));
  843.         }catch(Exception e){
  844.             // ignore
  845.         }
  846.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  847.     }
  848.    
  849.     public ErroreIntegrazione getErrore438_TipoServizioNotSupportedByProtocol(ServiceBinding serviceBinding, IDServizio servizio,IProtocolFactory<?> protocolFactory) {
  850.         if(!this.equals(ERRORE_438_TIPO_SERVIZIO_NOT_SUPPORTED_BY_PROTOCOL)){
  851.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_438_TIPO_SERVIZIO_NOT_SUPPORTED_BY_PROTOCOL.name());
  852.         }
  853.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  854.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO,servizio.getTipo()));
  855.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME,servizio.getNome()));
  856.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_VERSIONE,servizio.getVersione().intValue()+""));
  857.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL,protocolFactory.getProtocol()));
  858.         try{
  859.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,protocolFactory.createProtocolConfiguration().getTipiServizi(serviceBinding).toString()));
  860.         }catch(Exception e){
  861.             // ignore
  862.         }
  863.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  864.     }
  865.    
  866.     public ErroreIntegrazione getErrore439_FunzionalitaNotSupportedByProtocol(String msgErrore,IProtocolFactory<?> protocolFactory) {
  867.         if(!this.equals(ERRORE_439_FUNZIONALITA_NOT_SUPPORTED_BY_PROTOCOL)){
  868.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_439_FUNZIONALITA_NOT_SUPPORTED_BY_PROTOCOL.name());
  869.         }
  870.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  871.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,msgErrore));
  872.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL,protocolFactory.getProtocol()));
  873.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  874.     }
  875.    
  876.     public ErroreIntegrazione getErrore440_MessaggioRispostaMalformato(Throwable e) {
  877.         if(!this.equals(ERRORE_440_PARSING_EXCEPTION_RISPOSTA)){
  878.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_440_PARSING_EXCEPTION_RISPOSTA.name());
  879.         }
  880.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  881.         if(e.getMessage()!=null)
  882.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,e.getMessage()));
  883.         else
  884.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_MSG_ECCEZIONE,e.toString()));
  885.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  886.     }
  887.    
  888.     public ErroreIntegrazione getErrore441_PortaNonInvocabileDirettamente(String location,String urlInvocazione) {
  889.         return getErrore441_PortaNonInvocabileDirettamente(location, urlInvocazione,null);
  890.     }
  891.     public ErroreIntegrazione getErrore441_PortaNonInvocabileDirettamente(String servizioApplicativo) {
  892.         return getErrore441_PortaNonInvocabileDirettamente(null, null,servizioApplicativo);
  893.     }
  894.     public ErroreIntegrazione getErrore441_PortaNonInvocabileDirettamente(String location,String urlInvocazione,String servizioApplicativo) {
  895.         if(!this.equals(ERRORE_441_PORTA_NON_INVOCABILE_DIRETTAMENTE)){
  896.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_401_PORTA_INESISTENTE.name());
  897.         }
  898.         StringBuilder bf = new StringBuilder();
  899.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  900.         if(location!=null){
  901.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_LOCATION,location));
  902.             bf.append(" porta["+location+"]");
  903.         }
  904.         if(urlInvocazione!=null){
  905.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_URL_INVOCAZIONE,urlInvocazione));
  906.             bf.append(" urlInvocazione["+urlInvocazione+"]");
  907.         }
  908.         if(servizioApplicativo!=null){
  909.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_SERVIZIO_APPLICATIVO,servizioApplicativo));
  910.             bf.append(" servizioApplicativo["+servizioApplicativo+"]");
  911.         }
  912.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_PARAMETRI,bf.toString()));
  913.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  914.     }
  915.    
  916.     public ErroreIntegrazione getErrore449_TipoSoggettoApplicativoTokenNotSupportedByProtocol(IDServizioApplicativo idApplicativoToken,IProtocolFactory<?> protocolFactory) {
  917.         if(!this.equals(ERRORE_449_TIPO_SOGGETTO_APPLICATIVO_TOKEN_NOT_SUPPORTED_BY_PROTOCOL)){
  918.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_449_TIPO_SOGGETTO_APPLICATIVO_TOKEN_NOT_SUPPORTED_BY_PROTOCOL.name());
  919.         }
  920.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  921.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPO,idApplicativoToken.getIdSoggettoProprietario().getTipo()));
  922.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_NOME,idApplicativoToken.getNome()+"@"+idApplicativoToken.getIdSoggettoProprietario().toString()));
  923.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PROTOCOL,protocolFactory.getProtocol()));
  924.         try{
  925.             lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_TIPI_SUPPORTATI,protocolFactory.createProtocolConfiguration().getTipiSoggetti().toString()));
  926.         }catch(Exception e){
  927.             // ignore
  928.         }
  929.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  930.     }
  931.    
  932.     public ErroreIntegrazione getErrore455DatiBustaDifferentiDatiPAInvocata(String oggetto,String datoBusta, String datoPA, String locationPA) {
  933.         if(!this.equals(ERRORE_455_DATI_BUSTA_DIFFERENTI_PA_INVOCATA)){
  934.             throw new RuntimeException("Il seguente metodo può solo essere utilizzato con il messaggio "+ERRORE_455_DATI_BUSTA_DIFFERENTI_PA_INVOCATA.name());
  935.         }
  936.         List<KeyValueObject> lista = new ArrayList<KeyValueObject>();
  937.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_OGGETTO_DIVERSO_TRA_BUSTA_E_PA,oggetto));
  938.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_DATO_BUSTA,datoBusta));
  939.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_DATO_PA,datoPA));
  940.         lista.add(new KeyValueObject(CostantiProtocollo.KEY_ERRORE_INTEGRAZIONE_PORTA_LOCATION,locationPA));
  941.         return newErroreIntegrazione(lista.toArray(new KeyValueObject[lista.size()]));
  942.     }

  943.     public ErroreIntegrazione get4XX_Custom(String descrizione,String codiceErroreIntegrazione) {
  944.         if(this.equals(ERRORE_4XX_CUSTOM)){
  945.             if(codiceErroreIntegrazione==null){
  946.                 throw new RuntimeException("Il metodo può essere utilizzato senza fornire un codice errore di integrazione personalizzato");    
  947.             }
  948.             ErroreIntegrazione e = newErroreIntegrazione(descrizione, CodiceErroreIntegrazione.CODICE_4XX_CUSTOM);
  949.             e.setCodiceCustom(codiceErroreIntegrazione);
  950.             return e;
  951.         }else{
  952.             throw new RuntimeException("Il metodo può essere utilizzato solo con il messaggio "+ERRORE_4XX_CUSTOM.name());
  953.         }
  954.     }
  955.    
  956. }