PorteApplicativeHelper.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.pa;

  21. import java.text.MessageFormat;
  22. import java.util.ArrayList;
  23. import java.util.Arrays;
  24. import java.util.Collections;
  25. import java.util.HashMap;
  26. import java.util.Iterator;
  27. import java.util.List;
  28. import java.util.Map;
  29. import java.util.Scanner;
  30. import java.util.Set;

  31. import javax.servlet.http.HttpServletRequest;
  32. import javax.servlet.http.HttpSession;

  33. import org.apache.commons.lang.StringEscapeUtils;
  34. import org.apache.commons.lang.StringUtils;
  35. import org.openspcoop2.core.commons.Filtri;
  36. import org.openspcoop2.core.commons.ISearch;
  37. import org.openspcoop2.core.commons.Liste;
  38. import org.openspcoop2.core.commons.ModalitaIdentificazione;
  39. import org.openspcoop2.core.commons.SearchUtils;
  40. import org.openspcoop2.core.config.Connettore;
  41. import org.openspcoop2.core.config.CorrelazioneApplicativaElemento;
  42. import org.openspcoop2.core.config.CorrelazioneApplicativaRispostaElemento;
  43. import org.openspcoop2.core.config.MessageSecurity;
  44. import org.openspcoop2.core.config.MessageSecurityFlowParameter;
  45. import org.openspcoop2.core.config.MtomProcessorFlowParameter;
  46. import org.openspcoop2.core.config.PortaApplicativa;
  47. import org.openspcoop2.core.config.PortaApplicativaAutorizzazioneServizioApplicativo;
  48. import org.openspcoop2.core.config.PortaApplicativaAutorizzazioneSoggetti;
  49. import org.openspcoop2.core.config.PortaApplicativaAutorizzazioneSoggetto;
  50. import org.openspcoop2.core.config.PortaApplicativaAzione;
  51. import org.openspcoop2.core.config.PortaApplicativaBehaviour;
  52. import org.openspcoop2.core.config.PortaApplicativaServizio;
  53. import org.openspcoop2.core.config.PortaApplicativaServizioApplicativo;
  54. import org.openspcoop2.core.config.PortaApplicativaServizioApplicativoConnettore;
  55. import org.openspcoop2.core.config.Proprieta;
  56. import org.openspcoop2.core.config.ResponseCachingConfigurazioneRegola;
  57. import org.openspcoop2.core.config.ServizioApplicativo;
  58. import org.openspcoop2.core.config.TrasformazioneRegola;
  59. import org.openspcoop2.core.config.TrasformazioneRegolaApplicabilitaRichiesta;
  60. import org.openspcoop2.core.config.TrasformazioneRegolaApplicabilitaRisposta;
  61. import org.openspcoop2.core.config.TrasformazioneRegolaApplicabilitaServizioApplicativo;
  62. import org.openspcoop2.core.config.TrasformazioneRegolaApplicabilitaSoggetto;
  63. import org.openspcoop2.core.config.TrasformazioneRegolaParametro;
  64. import org.openspcoop2.core.config.TrasformazioneRegolaRisposta;
  65. import org.openspcoop2.core.config.Trasformazioni;
  66. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  67. import org.openspcoop2.core.config.constants.MTOMProcessorType;
  68. import org.openspcoop2.core.config.constants.PortaApplicativaAzioneIdentificazione;
  69. import org.openspcoop2.core.config.constants.RuoloContesto;
  70. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  71. import org.openspcoop2.core.config.constants.TipoAutenticazione;
  72. import org.openspcoop2.core.config.constants.TipoAutenticazionePrincipal;
  73. import org.openspcoop2.core.config.constants.TipoBehaviour;
  74. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  75. import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
  76. import org.openspcoop2.core.constants.CostantiDB;
  77. import org.openspcoop2.core.constants.TipiConnettore;
  78. import org.openspcoop2.core.constants.TipoPdD;
  79. import org.openspcoop2.core.controllo_traffico.constants.RuoloPolicy;
  80. import org.openspcoop2.core.id.IDPortaApplicativa;
  81. import org.openspcoop2.core.id.IDServizio;
  82. import org.openspcoop2.core.id.IDServizioApplicativo;
  83. import org.openspcoop2.core.id.IDSoggetto;
  84. import org.openspcoop2.core.mapping.MappingErogazionePortaApplicativa;
  85. import org.openspcoop2.core.plugins.constants.TipoPlugin;
  86. import org.openspcoop2.core.registry.AccordoServizioParteSpecifica;
  87. import org.openspcoop2.core.registry.CredenzialiSoggetto;
  88. import org.openspcoop2.core.registry.Fruitore;
  89. import org.openspcoop2.core.registry.ProprietaOggetto;
  90. import org.openspcoop2.core.registry.Ruolo;
  91. import org.openspcoop2.core.registry.Scope;
  92. import org.openspcoop2.core.registry.Soggetto;
  93. import org.openspcoop2.core.registry.beans.AccordoServizioParteComuneSintetico;
  94. import org.openspcoop2.core.registry.constants.CostantiRegistroServizi;
  95. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  96. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  97. import org.openspcoop2.core.registry.driver.IDAccordoFactory;
  98. import org.openspcoop2.core.registry.driver.IDServizioFactory;
  99. import org.openspcoop2.generic_project.exception.NotFoundException;
  100. import org.openspcoop2.message.constants.ServiceBinding;
  101. import org.openspcoop2.pdd.config.ConfigurazionePriorita;
  102. import org.openspcoop2.pdd.config.UrlInvocazioneAPI;
  103. import org.openspcoop2.pdd.core.behaviour.BehaviourException;
  104. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.LoadBalancerType;
  105. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.health_check.HealthCheckCostanti;
  106. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore;
  107. import org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneGestioneConsegnaNotifiche;
  108. import org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.MessaggioDaNotificare;
  109. import org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault;
  110. import org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto;
  111. import org.openspcoop2.pdd.core.behaviour.conditional.ConditionalUtils;
  112. import org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneSelettoreCondizione;
  113. import org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneSelettoreCondizioneRegola;
  114. import org.openspcoop2.pdd.core.behaviour.conditional.IdentificazioneFallitaConfigurazione;
  115. import org.openspcoop2.pdd.core.dynamic.DynamicHelperCostanti;
  116. import org.openspcoop2.pdd.core.integrazione.GruppoIntegrazione;
  117. import org.openspcoop2.protocol.basic.config.ImplementationConfiguration;
  118. import org.openspcoop2.protocol.engine.ProtocolFactoryManager;
  119. import org.openspcoop2.protocol.engine.utils.DBOggettiInUsoUtils;
  120. import org.openspcoop2.protocol.sdk.ProtocolException;
  121. import org.openspcoop2.protocol.sdk.constants.ConsoleInterfaceType;
  122. import org.openspcoop2.protocol.sdk.constants.FunzionalitaProtocollo;
  123. import org.openspcoop2.utils.BooleanNullable;
  124. import org.openspcoop2.utils.certificate.byok.BYOKManager;
  125. import org.openspcoop2.utils.crypt.PasswordVerifier;
  126. import org.openspcoop2.utils.transport.http.HttpRequestMethod;
  127. import org.openspcoop2.web.ctrlstat.core.ConsoleSearch;
  128. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  129. import org.openspcoop2.web.ctrlstat.core.ControlStationCoreException;
  130. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  131. import org.openspcoop2.web.ctrlstat.plugins.IExtendedListServlet;
  132. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaCore;
  133. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaCostanti;
  134. import org.openspcoop2.web.ctrlstat.servlet.aps.erogazioni.ErogazioniCostanti;
  135. import org.openspcoop2.web.ctrlstat.servlet.config.ConfigurazioneCostanti;
  136. import org.openspcoop2.web.ctrlstat.servlet.connettori.ConnettoriCostanti;
  137. import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateCostanti;
  138. import org.openspcoop2.web.ctrlstat.servlet.protocol_properties.ProtocolPropertiesUtilities;
  139. import org.openspcoop2.web.ctrlstat.servlet.ruoli.RuoliCostanti;
  140. import org.openspcoop2.web.ctrlstat.servlet.sa.ServiziApplicativiCostanti;
  141. import org.openspcoop2.web.ctrlstat.servlet.sa.ServiziApplicativiHelper;
  142. import org.openspcoop2.web.ctrlstat.servlet.scope.ScopeCostanti;
  143. import org.openspcoop2.web.ctrlstat.servlet.soggetti.SoggettiCostanti;
  144. import org.openspcoop2.web.lib.mvc.BinaryParameter;
  145. import org.openspcoop2.web.lib.mvc.CheckboxStatusType;
  146. import org.openspcoop2.web.lib.mvc.Costanti;
  147. import org.openspcoop2.web.lib.mvc.DataElement;
  148. import org.openspcoop2.web.lib.mvc.DataElementImage;
  149. import org.openspcoop2.web.lib.mvc.DataElementInfo;
  150. import org.openspcoop2.web.lib.mvc.DataElementType;
  151. import org.openspcoop2.web.lib.mvc.PageData;
  152. import org.openspcoop2.web.lib.mvc.Parameter;
  153. import org.openspcoop2.web.lib.mvc.ServletUtils;
  154. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  155. /**
  156.  * PorteApplicativeHelper
  157.  *
  158.  * @author Poli Andrea (apoli@link.it)
  159.  * @author $Author$
  160.  * @version $Rev$, $Date$
  161.  */
  162. public class PorteApplicativeHelper extends ServiziApplicativiHelper {

  163.     public PorteApplicativeHelper(HttpServletRequest request, PageData pd,
  164.             HttpSession session) throws Exception {
  165.         super(request, pd,  session);
  166.     }
  167.     public PorteApplicativeHelper(ControlStationCore core, HttpServletRequest request, PageData pd,
  168.             HttpSession session) throws Exception {
  169.         super(core, request, pd,  session);
  170.     }

  171.     // Controlla i dati della porta applicativa
  172.     public boolean porteAppCheckData(TipoOperazione tipoOp, String oldNomePA, boolean isSupportatoAutenticazione, boolean datiAltroPorta,
  173.             ServiceBinding serviceBinding) throws Exception {
  174.         try {
  175.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  176.             String nomePorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA);
  177.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  178.             int soggInt = Integer.parseInt(idsogg);
  179.             String descr = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_DESCRIZIONE);
  180.             String soggvirt = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_VIRTUALE);
  181.             if (soggvirt == null) {
  182.                 soggvirt = "-";
  183.             }
  184.             IDSoggetto idSoggettoVirtuale = null;
  185.             if (!soggvirt.equals("-")){
  186.                 idSoggettoVirtuale = new IDSoggetto(soggvirt.split("/")[0],soggvirt.split("/")[1]);
  187.             }
  188.             String servizio = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SERVIZIO);
  189.             if (servizio == null) {
  190.                 servizio = "";
  191.             }
  192.             String azione = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE);
  193.             String azid = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE_ID);
  194.             String modeaz = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_AZIONE);

  195.             String xsd = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_XSD);

  196.             String behaviour = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_BEHAVIOUR);
  197.            
  198.             String autenticazione = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE);
  199.             String autenticazioneCustom = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM);
  200.             String autenticazioneOpzionale = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_OPZIONALE);
  201.             String autenticazionePrincipalTipo = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TIPO);
  202.             TipoAutenticazionePrincipal autenticazionePrincipal = TipoAutenticazionePrincipal.toEnumConstant(autenticazionePrincipalTipo, false);
  203.             List<String> autenticazioneParametroList = this.convertFromDataElementValue_parametroAutenticazioneList(autenticazione, autenticazionePrincipal);
  204.            
  205.             String autorizzazione = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE);
  206.             String autorizzazioneCustom = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM);
  207.             String autorizzazioneAutenticati = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_AUTENTICAZIONE);
  208.             String autorizzazioneRuoli = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI);
  209.             String autorizzazioneRuoliTipologia = this.getParameter(CostantiControlStation.PARAMETRO_RUOLO_TIPOLOGIA);
  210.             String ruoloMatch = this.getParameter(CostantiControlStation.PARAMETRO_RUOLO_MATCH);
  211.            
  212.             String autorizzazioneContenutiStato = this.getParameter(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO);
  213.             String autorizzazioneContenuti = this.getParameter(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  214.             String autorizzazioneContenutiProperties = this.getParameter(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_PROPERTIES);
  215.                        
  216.             // Campi obbligatori
  217.             if (nomePorta.equals("") || soggvirt.equals("") || servizio.equals("")) {
  218.                 String tmpElenco = "";
  219.                 if (nomePorta.equals("")) {
  220.                     tmpElenco = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME;
  221.                 }
  222.                 if (soggvirt.equals("")) {
  223.                     if (tmpElenco.equals("")) {
  224.                         tmpElenco = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_VIRTUALE;
  225.                     } else {
  226.                         tmpElenco = tmpElenco + ", " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_VIRTUALE;
  227.                     }
  228.                 }
  229.                 if (servizio.equals("")) {
  230.                     if (tmpElenco.equals("")) {
  231.                         tmpElenco = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO;
  232.                     } else {
  233.                         tmpElenco = tmpElenco + ", " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO;
  234.                     }
  235.                 }
  236.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  237.                 return false;
  238.             }

  239.             // Controllo che non ci siano spazi nei campi di testo
  240.             if(!this.core.isConnettoriMultipliEnabled()) {
  241.                 if(behaviour!=null && !"".equals(behaviour)){
  242.                     if (behaviour.indexOf(" ") != -1 || behaviour.indexOf(",") != -1 ) {
  243.                         this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_NE_SPAZI_NE_NEL_CAMPO_BEHAVIOUR);
  244.                         return false;
  245.                     }
  246.                     if(this.checkLength255(behaviour, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_BEHAVIOUR)==false) {
  247.                         return false;
  248.                     }
  249.                 }
  250.             }
  251.            
  252.             // descrizione
  253.             if( (tipoOp.equals(TipoOperazione.CHANGE))
  254.                     &&
  255.                 (descr!=null && StringUtils.isNotEmpty(descr))
  256.                     &&
  257.                 (!this.checkLength4000(descr, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_DESCRIZIONE))
  258.                 ){
  259.                 return false;
  260.             }
  261.            
  262.             // integrazione metadati
  263.             if(tipoOp == TipoOperazione.CHANGE && datiAltroPorta) {
  264.                 boolean validazioneIntegrazione = this.validaIntegrazioneMetadati();
  265.                 if(!validazioneIntegrazione)
  266.                     return false;
  267.             }
  268.            
  269.             // rate limiting
  270.             if(tipoOp == TipoOperazione.CHANGE && datiAltroPorta) {
  271.                 boolean validazioneRT = this.validaOpzioniAvanzateRateLimiting(RuoloPolicy.APPLICATIVA,nomePorta);
  272.                 if(!validazioneRT)
  273.                     return false;
  274.             }
  275.            
  276.             // Controllo che non ci siano spazi nei campi di testo
  277.             if (nomePorta.indexOf(" ") != -1) {
  278.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  279.                 return false;
  280.             }
  281.             if(this.checkIntegrationEntityName(nomePorta,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)==false){
  282.                 return false;
  283.             }

  284.             // Controllo che i campi "select" abbiano uno dei valori ammessi
  285.             if(tipoOp.equals(TipoOperazione.ADD)) {
  286.                 if (!xsd.equals(CostantiControlStation.DEFAULT_VALUE_ABILITATO) && !xsd.equals(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) && !xsd.equals(CostantiControlStation.DEFAULT_VALUE_WARNING_ONLY)) {
  287.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_VALIDAZIONE_XSD_DEV_ESSERE_ABILITATO_DISABILITATO_O_WARNING_ONLY);
  288.                     return false;
  289.                 }
  290.             }

  291.             if(this.core.isRegistroServiziLocale()){
  292.                 // Controllo che il soggvirt appartenga alla lista di soggetti
  293.                 // disponibili
  294.                 boolean trovatoSogg = false;
  295.                 List<Soggetto> lista = this.soggettiCore.soggettiRegistroList("", new ConsoleSearch(true));
  296.                 for (int i = 0; i < lista.size(); i++) {
  297.                     Soggetto singleSogg = lista.get(i);
  298.                     if (soggInt != singleSogg.getId()) {
  299.                         trovatoSogg = true;
  300.                         break;
  301.                     }
  302.                 }
  303.                 if (!trovatoSogg && !soggvirt.equals("-")) {
  304.                     this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_IL_SOGGETTO_VIRTUALE_DEVE_ESSERE_SCELTO_TRA_QUELLI_DEFINITI_NEL_PANNELLO_SOGGETTI);
  305.                     return false;
  306.                 }

  307.                 /*
  308.                     // Controllo che il servizio appartenga alla lista di servizi
  309.                     // disponibili per il soggetto
  310.                     int servInt = Integer.parseInt(servizio);

  311.                     // Prendo il nome e il tipo del soggetto
  312.                     Soggetto mySogg;
  313.                     if (!soggvirt.equals("-"))
  314.                         mySogg = this.soggettiCore.getSoggettoRegistro(idSoggettoVirtuale);
  315.                     else
  316.                         mySogg = this.soggettiCore.getSoggettoRegistro(soggInt);
  317.                     String nomeprov = mySogg.getNome();
  318.                     String tipoprov = mySogg.getTipo();

  319.                     //String nomeserv = "", tiposerv = "";
  320.                     boolean trovatoServ = this.core.existsServizio(servInt);
  321.                     //if (trovatoServ) {
  322.                     //  Servizio myServ = this.core.getServizio(servInt);
  323.                     //  tiposerv = myServ.getTipo();
  324.                     //  nomeserv = myServ.getNome();
  325.                     //}
  326.                     if (!trovatoServ) {
  327.                         this.pd.setMessage("Il Servizio dev'essere scelto tra quelli definiti nel pannello Servizi ed associati al soggetto " + tipoprov + "/" + nomeprov);
  328.                         return false;
  329.                     }*/ // Questo controllo serve??? Il valore è stato preso da una select list!!!

  330.                 // Controllo che l'azione, se definita, appartenga alla lista di
  331.                 // azioni
  332.                 // disponibili per il servizio
  333.                 /*boolean trovataAz = false;
  334.                     if (!azione.equals("-")) {
  335.                         // Prendo il nome, il tipo e l'accordo del servizio
  336.                         Servizio myServ = this.core.getServizio(servInt);
  337.                         //nomeserv = myServ.getNome();
  338.                         //tiposerv = myServ.getTipo();
  339.                         long idAcc = myServ.getIdAccordo();

  340.                         if(myServ.getPortType()!=null){
  341.                             trovataAz = this.core.existsAccordoServizioPorttypeOperation(azione, IDAccordo.getIDAccordoFromUri(myServ.getAccordoServizio()), myServ.getPortType());
  342.                             if (!trovataAz) {
  343.                                 this.pd.setMessage("L'Azione dev'essere scelta tra quelle associate al servizio "+myServ.getPortType()+" dell'accordo di servizio "+myServ.getAccordoServizio());
  344.                                 return false;
  345.                             }
  346.                         }
  347.                         else{
  348.                             trovataAz = this.core.existsAccordoServizioAzione(azione, idAcc);
  349.                             if (!trovataAz) {
  350.                                 this.pd.setMessage("L'Azione dev'essere scelta tra quelle associate all'accordo di servizio "+myServ.getAccordoServizio());
  351.                                 return false;
  352.                             }
  353.                         }
  354.                     }*/ // Questo controllo serve??? Il valore è stato preso da una select list!!!
  355.             }

  356.             // Se tipoOp = add, controllo che la porta applicativa non sia
  357.             // gia' stata registrata
  358.             IDServizio idSE = null;
  359.             if (tipoOp.equals(TipoOperazione.ADD) || TipoOperazione.CHANGE.equals(tipoOp)) {
  360.                 boolean giaRegistrato = false;
  361.                 /*
  362.                  * fix bug 54 Una porta applicativa viene identificata
  363.                  * univocamente dalla tripla: - SoggettoErogatore - Servizio
  364.                  * - Azione
  365.                  *
  366.                  * Dove uno dei possibili valore dell'azione e' NULL.
  367.                  *
  368.                  * Il soggetto erogatore e' normalmente il proprietario
  369.                  * della porta applicativa. Se un soggetto virtuale e'
  370.                  * definito, questo diventa il soggetto erogatore.
  371.                  *
  372.                  * Note: Vengono inoltre effettuati controlli
  373.                  * sull'univocita' del nome la govwayConsole non permette
  374.                  * di inserire porte applicative con stesso nome;
  375.                  */

  376.                 IDPortaApplicativa idPA = new IDPortaApplicativa();
  377.                 idPA.setNome(nomePorta);
  378.                 if (TipoOperazione.ADD.equals(tipoOp)==false) {
  379.                     idPA.setNome(oldNomePA);
  380.                 }
  381.                
  382.                 // se specificato il soggetto virtuale
  383.                 org.openspcoop2.core.config.Soggetto proprietario = null;
  384.                 Soggetto virtuale = null;
  385.                 proprietario = this.soggettiCore.getSoggetto(soggInt);
  386.                 if (!soggvirt.equals("-")) {
  387.                     virtuale = this.soggettiCore.getSoggettoRegistro(idSoggettoVirtuale);
  388.                 }
  389.                 IDSoggetto idSO = new IDSoggetto(proprietario.getTipo(), proprietario.getNome());
  390.                 String [] tmp = servizio.split(" ");
  391.                 idSE = IDServizioFactory.getInstance().getIDServizioFromValues(tmp[1].split("/")[0], tmp[1].split("/")[1],
  392.                         idSO, Integer.parseInt(tmp[1].split("/")[2]));
  393.                
  394.                 if (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT)) {
  395.                     azione = azid;
  396.                 }
  397.                
  398.                 if (azione!=null && !"".equals(azione) && !"-".equals(azione) ) {
  399.                     idSE.setAzione(azione);
  400.                 }

  401.                 // controllo su nome e proprietario in caso di aggiunta
  402.                 // nuova pa
  403.                 // non posso inserire una porta con stesso nome e
  404.                 // proprietario
  405.                 if (TipoOperazione.ADD.equals(tipoOp)) {
  406.                     giaRegistrato = this.porteApplicativeCore.existsPortaApplicativa(idPA);

  407.                     if (giaRegistrato) {
  408.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_ESISTE_GIA_UNA_PORTA_APPLICATIVA_XX_APPARTENENTE_AL_SOGGETTO_YY,
  409.                                 nomePorta, idSO.toString()));
  410.                         return false;
  411.                     }

  412.                     if (!soggvirt.equals("-")) {
  413.                         IDSoggetto idSOVirt = new IDSoggetto(virtuale.getTipo(), virtuale.getNome());
  414.                         giaRegistrato = this.porteApplicativeCore.existsPortaApplicativaVirtuale(idSE, idSOVirt, true);
  415.                     } else {
  416.                         giaRegistrato = this.porteApplicativeCore.existsPortaApplicativa(idSE, true);
  417.                     }

  418.                 } else {
  419.                     PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idPA);
  420.                     PortaApplicativaServizio pa_servizio_precedente = pa.getServizio();
  421.                     PortaApplicativaAzione pa_azione = pa.getAzione();

  422.                     IDServizio idServPrec = IDServizioFactory.getInstance().getIDServizioFromValues(pa_servizio_precedente.getTipo(),
  423.                             pa_servizio_precedente.getNome(), idSO, pa_servizio_precedente.getVersione());
  424.                     if (pa_azione != null)
  425.                         idServPrec.setAzione(pa_azione.getNome());

  426.                     // se e' cambiato il servizio e/o azione
  427.                     // allora devo controllare se esistono altre porte
  428.                     // applicative associate
  429.                     if (!idSE.equals(idServPrec)) {
  430.                         // se presente soggetto virtuale
  431.                         if (!soggvirt.equals("-")) {
  432.                             IDSoggetto idSOVirt = new IDSoggetto(virtuale.getTipo(), virtuale.getNome());
  433.                             giaRegistrato = this.porteApplicativeCore.existsPortaApplicativaVirtuale(idSE, idSOVirt, true);
  434.                         } else {
  435.                             giaRegistrato = this.porteApplicativeCore.existsPortaApplicativa(idSE, true);
  436.                         }

  437.                     }
  438.                 }

  439.                 if (giaRegistrato) {
  440.                    
  441.                     String nomeAzioneMessaggio = idSE.getAzione() != null ? idSE.getAzione() : "not set";
  442.                     String nomeSoggettoVirtualeMessaggio = !soggvirt.equals("-") ? " Virtuale" : "";
  443.                     String nomeSoggettoMessaggio = !soggvirt.equals("-") ? virtuale.getTipo() + "/" + virtuale.getNome() : idSE.getSoggettoErogatore().toString();
  444.                     String nomeServizioMessaggio = idSE.getTipo() + "/" + idSE.getNome() +  "/" + idSE.getVersione();
  445.                     this.pd.setMessage(MessageFormat.format(
  446.                             PorteApplicativeCostanti.MESSAGGIO_ERRORE_ESISTE_GIA_UNA_PORTA_APPLICATIVA_PER_IL_SERVIZIO_XX_CON_AZIONE_YY_EROGATO_DAL_SOGGETTO_ZZ,
  447.                             nomeServizioMessaggio, nomeAzioneMessaggio, nomeSoggettoVirtualeMessaggio, nomeSoggettoMessaggio));

  448.                     // this.pd.setMessage("La porta applicativa " + id + "
  449.                     // &egrave; gi&agrave; stata registrata");
  450.                     return false;
  451.                 }

  452.                
  453.                 if (TipoOperazione.CHANGE.equals(tipoOp)) {
  454.                     if (!nomePorta.equals(oldNomePA)) {
  455.                         IDPortaApplicativa idPANew = new IDPortaApplicativa();
  456.                         idPANew.setNome(nomePorta);
  457.                         boolean exists = this.porteApplicativeCore.existsPortaApplicativa(idPANew);
  458.                         if (exists) {
  459.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_ESISTE_GIA_UNA_PORTA_APPLICATIVA_CON_NOME_XX, nomePorta));
  460.                             return false;
  461.                         }
  462.                     }
  463.                 }
  464.             }
  465.            
  466.             if (modeaz == null) {
  467.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_NON_E_STATA_TROVATA_NESSUNA_MODALITA_AZIONE);
  468.                 return false;
  469.             }
  470.            
  471.             if (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) && (azid == null)) {
  472.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_NON_E_STATA_TROVATA_NESSUNA_AZIONE_ASSOCIATA_AL_SERVIZIO_SCEGLIERE_UNA_DELLE_ALTRE_MODALITA);
  473.                 return false;
  474.             }
  475.             if ((modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED) ||
  476.                     modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED) ||
  477.                     modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED)) && (azione==null || azione.equals(""))) {
  478.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_PATTERN_AZIONE);
  479.                 return false;
  480.             }
  481.            
  482.             if (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED)) {
  483.                 if(this.checkRegexp(azione,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ESPRESSIONE_REGOLARE)==false){
  484.                     return false;
  485.                 }
  486.             }
  487.             if (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED)) {
  488.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  489.                     if(this.checkXPath(azione,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN)==false){
  490.                         return false;
  491.                     }
  492.                 }
  493.                 else {
  494.                     if(this.checkXPathOrJsonPath(azione,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN)==false){
  495.                         return false;
  496.                     }
  497.                 }
  498.             }
  499.            
  500.             if ((modeaz != null) && !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) &&
  501.                     !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INPUT_BASED) &&
  502.                     !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_SOAP_ACTION_BASED) &&
  503.                     !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED) &&
  504.                     !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_DELEGATED_BY) &&
  505.                     (azione != null && azione.indexOf(" ") != -1)) {
  506.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  507.                 return false;
  508.             }

  509. //          // Controllo che i campi "select" abbiano uno dei valori ammessi
  510. //          if ((modeaz != null) && !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED) &&
  511. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) &&
  512. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED) &&
  513. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED) &&
  514. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INPUT_BASED) &&
  515. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_SOAP_ACTION_BASED) &&
  516. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED) &&
  517. //                  !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_WSDL_BASED)) {
  518. //              this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_MODE_AZIONE_DEV_ESSERE_USER_INPUT_REGISTER_INPUT_URL_BASED_CONTENT_BASED_INPUT_BASED_SOAP_ACTION_BASED_PROTOCOL_BASED_O_WSDL_BASED);
  519. //              return false;
  520. //          }
  521.            

  522.             // Se autenticazione = custom, nomeauth dev'essere specificato
  523.             if (CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM.equals(autenticazione) &&
  524.                     (autenticazioneCustom == null || autenticazioneCustom.equals(""))) {
  525.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_INDICARE_UN_NOME_PER_L_AUTENTICAZIONE_XX, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM));
  526.                 return false;
  527.             }

  528.             // Se autorizzazione = custom, nomeautor dev'essere specificato
  529.             if (CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM.equals(autorizzazione) &&
  530.                     (autorizzazioneCustom == null || autorizzazioneCustom.equals(""))) {
  531.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_INDICARE_UN_NOME_PER_L_AUTORIZZAZIONE_XX, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM));
  532.                 return false;
  533.             }
  534.            
  535.             PortaApplicativa pa = null;
  536.             if (TipoOperazione.CHANGE.equals(tipoOp)){
  537.                 pa = this.porteApplicativeCore.getPortaApplicativa(Long.parseLong(idPorta));
  538.             }
  539.            
  540.             List<String> ruoli = new ArrayList<>();
  541.             if(pa!=null && pa.getRuoli()!=null && pa.getRuoli().sizeRuoloList()>0){
  542.                 for (int i = 0; i < pa.getRuoli().sizeRuoloList(); i++) {
  543.                     ruoli.add(pa.getRuoli().getRuolo(i).getNome());
  544.                 }
  545.             }
  546.            
  547.             if (TipoOperazione.ADD.equals(tipoOp)){
  548.                
  549.                
  550.                 String gestioneToken = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN);
  551.                 String gestioneTokenPolicy = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY);
  552.                 String gestioneTokenValidazioneInput = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT);
  553.                 String gestioneTokenIntrospection = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION);
  554.                 String gestioneTokenUserInfo = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO);
  555.                 String gestioneTokenTokenForward = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  556.                 String autorizzazione_token = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN);
  557.                 String autorizzazione_tokenOptions = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_OPTIONS);
  558.                 String autorizzazioneScope = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_SCOPE);
  559.                 String autorizzazioneScopeMatch = this.getParameter(CostantiControlStation.PARAMETRO_SCOPE_MATCH);
  560.                 BinaryParameter allegatoXacmlPolicy = this.getBinaryParameter(CostantiControlStation.PARAMETRO_DOCUMENTO_SICUREZZA_XACML_POLICY);
  561.                
  562.                 String protocollo = ProtocolFactoryManager.getInstance().getProtocolByServiceType(idSE.getTipo());
  563.                
  564.                 String identificazioneAttributiStato = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_STATO);
  565.                 String [] attributeAuthoritySelezionate = this.getParameterValues(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY);
  566.                 String attributeAuthorityAttributi = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI);
  567.                
  568.                 String autorizzazioneAutenticatiToken = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_AUTENTICAZIONE_TOKEN);
  569.                 String autorizzazioneRuoliToken = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_TOKEN);
  570.                
  571.                 if(this.controlloAccessiCheck(tipoOp, autenticazione, autenticazioneOpzionale, autenticazionePrincipal, autenticazioneParametroList,
  572.                         autorizzazione, autorizzazioneAutenticati, autorizzazioneRuoli,
  573.                         autorizzazioneRuoliTipologia, ruoloMatch,
  574.                         isSupportatoAutenticazione, false, pa, ruoli,gestioneToken, gestioneTokenPolicy,
  575.                         gestioneTokenValidazioneInput, gestioneTokenIntrospection, gestioneTokenUserInfo, gestioneTokenTokenForward,
  576.                         autorizzazioneAutenticatiToken, autorizzazioneRuoliToken,
  577.                         autorizzazione_token,autorizzazione_tokenOptions,
  578.                         autorizzazioneScope,autorizzazioneScopeMatch,allegatoXacmlPolicy,
  579.                         autorizzazioneContenutiStato, autorizzazioneContenuti, autorizzazioneContenutiProperties,
  580.                         protocollo,
  581.                         identificazioneAttributiStato, attributeAuthoritySelezionate, attributeAuthorityAttributi)==false){
  582.                     return false;
  583.                 }
  584.             }
  585.            
  586.             if (TipoOperazione.CHANGE.equals(tipoOp) && isSupportatoAutenticazione) {
  587.                
  588.                 if(pa==null) {
  589.                     throw new Exception("Porta applicativa non fornita");
  590.                 }
  591.                
  592.                 if(autenticazione!=null && autenticazione.equals(pa.getAutenticazione())==false &&
  593.                         !TipoAutenticazione.DISABILITATO.equals(autenticazione) &&
  594.                         !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM.equals(autenticazione)){
  595.                     AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idSE);
  596.                     if(this.apsCore.filterFruitoriRispettoAutenticazione(asps)){
  597.                         boolean fruitoriCompatibili = true;
  598.                         for (int i = 0; i < asps.sizeFruitoreList(); i++) {
  599.                             Fruitore fr = asps.getFruitore(i);
  600.                             IDSoggetto idSoggetto = new IDSoggetto(fr.getTipo(), fr.getNome());
  601.                             Soggetto soggetto = this.soggettiCore.getSoggettoRegistro(idSoggetto);
  602.                             if(this.pddCore.isPddEsterna(soggetto.getPortaDominio())) {
  603.                                 // Devo controllare solo i soggetti delle pddEsterne, altrimeni se registro un soggeto operativo come fruitore per fruire del servizio,
  604.                                 // poi il controllo non permette la modifica
  605.                                 CredenzialiSoggetto credenziali = null;
  606.                                 if(soggetto.sizeCredenzialiList()>0) {
  607.                                     credenziali = soggetto.getCredenziali(0);
  608.                                 }
  609.                                 if(credenziali==null || credenziali.getTipo()==null ||
  610.                                         !credenziali.getTipo().equals(autenticazione)){
  611.                                     fruitoriCompatibili = false;
  612.                                     break;
  613.                                 }
  614.                             }
  615.                         }
  616.                         if(fruitoriCompatibili == false){
  617.                             this.pd.setMessage(MessageFormat.format(
  618.                                     PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_E_POSSIBILE_MODIFICARE_IL_TIPO_DI_AUTENTICAZIONE_DA_XX_A_YY_POICHE_RISULTANO_ASSOCIATI_AL_SERVIZIO_DEI_FRUITORI_CON_CREDENZIALI_NON_COMPATIBILI_NELLA_MODALITA_DI_ACCESSO_CON_IL_NUOVO_TIPO_DI_AUTENTICAZIONE,
  619.                                     pa.getAutenticazione(), autenticazione));
  620.                             return false;
  621.                         }
  622.                     }  
  623.                 }
  624.             }
  625.            

  626.             return true;
  627.         } catch (Exception e) {
  628.             this.logError(e.getMessage(), e);
  629.             throw new ControlStationCoreException(e.getMessage(),e);
  630.         }
  631.     }

  632.     // Controlla i dati del servizioApplicativo della porta applicativa
  633.     public boolean porteAppServizioApplicativoCheckData(TipoOperazione tipoOp)
  634.             throws Exception {
  635.         try {
  636.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  637.             int idInt = Integer.parseInt(idPorta);
  638.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  639.             int soggInt = Integer.parseInt(idsogg);
  640.             String servizioApplicativo = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO);
  641.             if (servizioApplicativo == null) {
  642.                 servizioApplicativo = "";
  643.             }

  644.             // Campi obbligatori
  645.             if (servizioApplicativo.equals("")) {
  646.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_SERVIZIO_APPLICATIVO);
  647.                 return false;
  648.             }

  649.             boolean trovatoServizioApplicativo = false;
  650.             long idSA = 0;
  651.             // Controllo che il servizioApplicativo appartenga alla lista di
  652.             // servizioApplicativo disponibili per il soggetto
  653.             // Prendo il nome e il tipo del soggetto
  654.             String nomeprov = null;
  655.             String tipoprov = null;
  656.             if(this.core.isRegistroServiziLocale()){
  657.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(soggInt);
  658.                 nomeprov = mySogg.getNome();
  659.                 tipoprov = mySogg.getTipo();
  660.             }else{
  661.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(soggInt);
  662.                 nomeprov = mySogg.getNome();
  663.                 tipoprov = mySogg.getTipo();
  664.             }

  665.             IDSoggetto ids = new IDSoggetto(tipoprov, nomeprov);
  666.             IDServizioApplicativo idSAObject = new IDServizioApplicativo();
  667.             idSAObject.setIdSoggettoProprietario(ids);
  668.             idSAObject.setNome(servizioApplicativo);
  669.             trovatoServizioApplicativo = this.saCore.existsServizioApplicativo(idSAObject);

  670.             if (trovatoServizioApplicativo)
  671.                 idSA = this.saCore.getIdServizioApplicativo(ids, servizioApplicativo);

  672.             if (!trovatoServizioApplicativo) {
  673.                 String nomeSoggettoMessaggio = tipoprov + "/" + nomeprov;
  674.                 this.pd.setMessage(MessageFormat.format(
  675.                         PorteApplicativeCostanti.MESSAGGIO_ERRORE_IL_SERVIZIO_APPLICATIVO_DEV_ESSERE_SCELTO_TRA_QUELLI_DEFINITI_NEL_PANNELLO_SERVIZI_APPLICATIVI_ED_ASSOCIATI_AL_SOGGETTO_XX,
  676.                         nomeSoggettoMessaggio));
  677.                 return false;
  678.             }

  679.             // Se tipoOp = add, controllo che il servizioApplicativo non sia
  680.             // gia'
  681.             // stato
  682.             // registrato per la porta applicativa
  683.             if (tipoOp.equals(TipoOperazione.ADD)) {
  684.                 boolean giaRegistrato = false;

  685.                 // Prendo il nome della porta applicativa
  686.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  687.                 String nomeporta = pa.getNome();

  688.                 for (int i = 0; i < pa.sizeServizioApplicativoList(); i++) {
  689.                     PortaApplicativaServizioApplicativo tmpSA = pa.getServizioApplicativo(i);
  690.                     if (idSA == tmpSA.getIdServizioApplicativo()) {
  691.                         giaRegistrato = true;
  692.                         break;
  693.                     }
  694.                 }

  695.                 if (giaRegistrato) {
  696.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_IL_SERVIZIO_APPLICATIVO_XX_E_GIA_STATO_ASSOCIATO_ALLA_PORTA_APPLICATIVA_YY, servizioApplicativo, nomeporta));
  697.                     return false;
  698.                 }
  699.             }

  700.             return true;
  701.         } catch (Exception e) {
  702.             this.logError(e.getMessage(), e);
  703.             throw new ControlStationCoreException(e.getMessage(),e);
  704.         }
  705.     }


  706.     // Controlla i dati dell soggetto della porta applicativa
  707.     public boolean porteAppSoggettoCheckData(TipoOperazione tipoOp)
  708.             throws Exception {
  709.         try {
  710.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  711.             int idInt = Integer.parseInt(idPorta);
  712.             String soggetto = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  713.             if (soggetto == null) {
  714.                 soggetto = "";
  715.             }

  716.             // Campi obbligatori
  717.             if (soggetto.equals("")) {
  718.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_SOGGETTO);
  719.                 return false;
  720.             }

  721.             long idSoggetto = Integer.parseInt(soggetto);
  722.             // Controllo che il servizioApplicativo appartenga alla lista di
  723.             // servizioApplicativo disponibili per il soggetto
  724.             // Prendo il nome e il tipo del soggetto
  725.             String nomeSoggettoSelezionato = null;
  726.             String tipoSoggettoSelezionato = null;
  727.             if(this.core.isRegistroServiziLocale()){
  728.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(idSoggetto);
  729.                 nomeSoggettoSelezionato = mySogg.getNome();
  730.                 tipoSoggettoSelezionato = mySogg.getTipo();
  731.             }else{
  732.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(idSoggetto);
  733.                 nomeSoggettoSelezionato = mySogg.getNome();
  734.                 tipoSoggettoSelezionato = mySogg.getTipo();
  735.             }

  736.             // Se tipoOp = add, controllo che il servizioApplicativo non sia
  737.             // gia'
  738.             // stato
  739.             // registrato per la porta applicativa
  740.             if (tipoOp.equals(TipoOperazione.ADD)) {
  741.                 boolean giaRegistrato = false;

  742.                 // Prendo il nome della porta applicativa
  743.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  744.                 String nomeporta = pa.getNome();
  745.                 PortaApplicativaAutorizzazioneSoggetti soggetti = pa.getSoggetti() != null ? pa.getSoggetti() : new PortaApplicativaAutorizzazioneSoggetti();
  746.                

  747.                 for (int i = 0; i < soggetti.sizeSoggettoList(); i++) {
  748.                     PortaApplicativaAutorizzazioneSoggetto tmpSoggetto = soggetti.getSoggetto(i);
  749.                     if (tipoSoggettoSelezionato.equals(tmpSoggetto.getTipo()) && nomeSoggettoSelezionato.equals(tmpSoggetto.getNome())) {
  750.                         giaRegistrato = true;
  751.                         break;
  752.                     }
  753.                 }

  754.                 if (giaRegistrato) {
  755.                     String nomeSoggettoMessaggio = tipoSoggettoSelezionato + "/"+ nomeSoggettoSelezionato;
  756.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_IL_SOGGETTO_XX_EGRAVE_GIA_STATO_ASSOCIATO_ALLA_PORTA_APPLICATIVA_YY,
  757.                             nomeSoggettoMessaggio, nomeporta));
  758.                     return false;
  759.                 }
  760.             }

  761.             return true;
  762.         } catch (Exception e) {
  763.             this.logError(e.getMessage(), e);
  764.             throw new ControlStationCoreException(e.getMessage(),e);
  765.         }
  766.     }


  767.    
  768.     // Controlla i dati dell soggetto della porta applicativa
  769.     public boolean porteAppServizioApplicativoAutorizzatiCheckData(TipoOperazione tipoOp)
  770.                 throws Exception {
  771.         try {
  772.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  773.             @SuppressWarnings("unused")
  774.             int idInt = Integer.parseInt(idPorta);
  775.             String soggetto = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  776.             if (soggetto == null) {
  777.                 soggetto = "";
  778.             }
  779.             String sa = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_AUTORIZZATO);
  780.             if (sa == null) {
  781.                 sa = "";
  782.             }

  783.             // Campi obbligatori
  784.             if (soggetto.equals("")) {
  785.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_SOGGETTO);
  786.                 return false;
  787.             }
  788.             if (sa.equals("")) {
  789.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_APPLICATIVO);
  790.                 return false;
  791.             }

  792.             return true;
  793.         } catch (Exception e) {
  794.             this.logError(e.getMessage(), e);
  795.             throw new ControlStationCoreException(e.getMessage(),e);
  796.         }
  797.     }




  798.     // Controlla i dati della property della porta applicativa
  799.     public boolean porteAppPropCheckData(TipoOperazione tipoOp) throws ControlStationCoreException {
  800.         try {
  801.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  802.             int idInt = Integer.parseInt(idPorta);
  803.             String nome = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME);
  804.             String valore = this.getLockedParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_VALORE, false);

  805.             // Campi obbligatori
  806.             if (nome.equals("") || valore.equals("")) {
  807.                 String tmpElenco = "";
  808.                 if (nome.equals("")) {
  809.                     tmpElenco = "Nome";
  810.                 }
  811.                 if (valore.equals("")) {
  812.                     if (tmpElenco.equals("")) {
  813.                         tmpElenco = "Valore";
  814.                     } else {
  815.                         tmpElenco = tmpElenco + ", Valore";
  816.                     }
  817.                 }
  818.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  819.                 return false;
  820.             }

  821.             if (nome.indexOf(" ") != -1) {
  822.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  823.                 return false;
  824.             }
  825.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  826.                 return false;
  827.             }
  828.            
  829.             if( !this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore) ){
  830.                 if (valore.indexOf(" ") != -1) {
  831.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  832.                     return false;
  833.                 }
  834.                 if(!this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE)) {
  835.                     return false;
  836.                 }
  837.             }
  838.            
  839.             // Se tipoOp = add, controllo che la property non sia gia'
  840.             // stata
  841.             // registrata per la porta applicativa
  842.             if (tipoOp.equals(TipoOperazione.ADD)) {
  843.                 boolean giaRegistrato = false;
  844.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  845.                 String nomeporta = pa.getNome();

  846.                 for (int i = 0; i < pa.sizeProprietaList(); i++) {
  847.                     Proprieta tmpProp = pa.getProprieta(i);
  848.                     if (nome.equals(tmpProp.getNome())) {
  849.                         giaRegistrato = true;
  850.                         break;
  851.                     }
  852.                 }

  853.                 if (giaRegistrato) {
  854.                     this.pd.setMessage(MessageFormat.format(
  855.                             PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY, nome,
  856.                             nomeporta));
  857.                     return false;
  858.                 }
  859.             }

  860.             return true;
  861.         } catch (Exception e) {
  862.             this.logError(e.getMessage(), e);
  863.             throw new ControlStationCoreException(e.getMessage(),e);
  864.         }
  865.     }

  866.     // Controlla i dati del message-security request-flow della porta applicativa
  867.     public boolean porteAppMessageSecurityRequestCheckData(TipoOperazione tipoOp) throws ControlStationCoreException {
  868.         try {
  869.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  870.             int idInt = Integer.parseInt(idPorta);
  871.             String nome = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME);
  872.             String valore = this.getLockedParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_VALORE, false);

  873.             // Campi obbligatori
  874.             if (nome.equals("") || valore.equals("")) {
  875.                 String tmpElenco = "";
  876.                 if (nome.equals("")) {
  877.                     tmpElenco = "Nome";
  878.                 }
  879.                 if (valore.equals("")) {
  880.                     if (tmpElenco.equals("")) {
  881.                         tmpElenco = "Valore";
  882.                     } else {
  883.                         tmpElenco = tmpElenco + ", Valore";
  884.                     }
  885.                 }
  886.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  887.                 return false;
  888.             }

  889.             // Controllo che non ci siano spazi nei campi di testo
  890.             if ((nome.indexOf(" ") != -1) ) {
  891.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_NOMI);
  892.                 return false;
  893.             }
  894.             if(
  895.                     (!this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore))
  896.                     &&
  897.                     (valore.startsWith(" ") || valore.endsWith(" "))
  898.                 ){
  899.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_ALL_INIZIO_O_ALLA_FINE_DEI_VALORI);
  900.                 return false;
  901.             }
  902.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  903.                 return false;
  904.             }

  905.             // Se tipoOp = add, controllo che il message-security non sia gia' stato
  906.             // registrato per la porta applicativa
  907.             if (tipoOp.equals(TipoOperazione.ADD)) {
  908.                 boolean giaRegistrato = false;
  909.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  910.                 String nomeporta = pa.getNome();
  911.                 MessageSecurity messageSecurity = pa.getMessageSecurity();

  912.                 if(messageSecurity!=null &&
  913.                     messageSecurity.getRequestFlow()!=null){
  914.                     for (int i = 0; i < messageSecurity.getRequestFlow().sizeParameterList(); i++) {
  915.                         MessageSecurityFlowParameter tmpMessageSecurity =messageSecurity.getRequestFlow().getParameter(i);
  916.                         if (nome.equals(tmpMessageSecurity.getNome())) {
  917.                             giaRegistrato = true;
  918.                             break;
  919.                         }
  920.                     }
  921.                 }

  922.                 if (giaRegistrato) {
  923.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPRIETA_DI_MESSAGE_SECURITY_XX_E_GIA_STATO_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY,nome, nomeporta));
  924.                     return false;
  925.                 }
  926.             }

  927.             return true;

  928.         } catch (Exception e) {
  929.             this.logError(e.getMessage(), e);
  930.             throw new ControlStationCoreException(e.getMessage(),e);
  931.         }
  932.     }

  933.     // Controlla i dati del message-security response-flow della porta applicativa
  934.     public boolean porteAppMessageSecurityResponseCheckData(TipoOperazione tipoOp) throws ControlStationCoreException {
  935.         try {
  936.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  937.             int idInt = Integer.parseInt(idPorta);
  938.             String nome = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME);
  939.             String valore = this.getLockedParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_VALORE, false);

  940.             // Campi obbligatori
  941.             if (nome.equals("") || valore.equals("")) {
  942.                 String tmpElenco = "";
  943.                 if (nome.equals("")) {
  944.                     tmpElenco = "Nome";
  945.                 }
  946.                 if (valore.equals("")) {
  947.                     if (tmpElenco.equals("")) {
  948.                         tmpElenco = "Valore";
  949.                     } else {
  950.                         tmpElenco = tmpElenco + ", Valore";
  951.                     }
  952.                 }
  953.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  954.                 return false;
  955.             }

  956.             // Controllo che non ci siano spazi nei campi di testo
  957.             if ((nome.indexOf(" ") != -1) ) {
  958.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_NOMI);
  959.                 return false;
  960.             }
  961.             if(
  962.                     (!this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore))
  963.                     &&
  964.                     (valore.startsWith(" ") || valore.endsWith(" "))
  965.                 ){
  966.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_ALL_INIZIO_O_ALLA_FINE_DEI_VALORI);
  967.                 return false;
  968.             }
  969.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  970.                 return false;
  971.             }

  972.             // Se tipoOp = add, controllo che il message-security non sia gia' stato
  973.             // registrato per la porta applicativa
  974.             if (tipoOp.equals(TipoOperazione.ADD)) {
  975.                 boolean giaRegistrato = false;
  976.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  977.                 String nomeporta = pa.getNome();
  978.                 MessageSecurity messageSecurity = pa.getMessageSecurity();

  979.                 if(messageSecurity!=null &&
  980.                     messageSecurity.getResponseFlow()!=null){
  981.                     for (int i = 0; i < messageSecurity.getResponseFlow().sizeParameterList(); i++) {
  982.                         MessageSecurityFlowParameter tmpMessageSecurity =messageSecurity.getResponseFlow().getParameter(i);
  983.                         if (nome.equals(tmpMessageSecurity.getNome())) {
  984.                             giaRegistrato = true;
  985.                             break;
  986.                         }
  987.                     }
  988.                 }

  989.                 if (giaRegistrato) {
  990.                     this.pd.setMessage(
  991.                             MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPRIETA_DI_MESSAGE_SECURITY_XX_E_GIA_STATO_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY,nome, nomeporta));
  992.                     return false;
  993.                 }
  994.             }

  995.             return true;

  996.         } catch (Exception e) {
  997.             this.logError(e.getMessage(), e);
  998.             throw new ControlStationCoreException(e.getMessage(),e);
  999.         }
  1000.     }

  1001.     public List<DataElement> addHiddenFieldCorrelazioneApplicativaToDati(TipoOperazione tipoOp,
  1002.             String idcorrString, List<DataElement> dati) {

  1003.         DataElement de = new DataElement();
  1004.         if(idcorrString != null){
  1005.             de = new DataElement();
  1006.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ID_CORRELAZIONE_APPLICATIVA);
  1007.             de.setValue(idcorrString);
  1008.             de.setType(DataElementType.HIDDEN);
  1009.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_CORRELAZIONE_APPLICATIVA);
  1010.             dati.add(de);
  1011.         }
  1012.         return dati;
  1013.     }


  1014.     public List<DataElement> addPorteAppToDati(TipoOperazione tipoOp,List<DataElement> dati, String nomePorta, String descr, String soggvirt, String[] soggettiList, String[] soggettiListLabel,
  1015.             String servizio, String[] serviziList, String[] serviziListLabel, String azione, String[] azioniList,  String[] azioniListLabel,  String stateless, String ricsim, String ricasim,
  1016.             String idsogg, String idPorta, String statoValidazione, String tipoValidazione, String gestBody, String gestManifest,String integrazioneStato, String integrazione,
  1017.             String[] integrazioneGruppi, List<GruppoIntegrazione> integrazioneGruppiDaVisualizzare, Map<String, List<String>> integrazioneGruppiValoriDeiGruppi,
  1018.             int numCorrApp,String scadcorr,String autorizzazioneContenutiStato, String autorizzazioneContenuti, String autorizzazioneContenutiProperties, String protocollo,
  1019.             int numSA,   int numRuoli, String ruoloMatch,
  1020.             String statoMessageSecurity ,String statoMTOM ,int numCorrelazioneReq , int numCorrelazioneRes, int numProprProt,String applicaMTOM,
  1021.             String behaviour,
  1022.             String[] servizioApplicativoList, String servizioApplicativo, Long idSa,
  1023.             String autenticazione, String autorizzazione,
  1024.             String autenticazioneOpzionale, TipoAutenticazionePrincipal autenticazionePrincipal, List<String> autenticazioneParametroList, String autenticazioneCustom,
  1025.             String autorizzazioneCustom,
  1026.             boolean isSupportatoAutenticazioneSoggetti,
  1027.             String autorizzazioneAutenticati,String autorizzazioneRuoli,String autorizzazioneRuoliTipologia,
  1028.             AccordoServizioParteSpecifica asps, AccordoServizioParteComuneSintetico aspc, ServiceBinding serviceBinding,
  1029.             String statoPorta, String modeaz, String azid, String patternAzione, String forceWsdlBased, boolean usataInConfigurazioni, boolean usataInConfigurazioneDefault,
  1030.             boolean ricercaPortaAzioneDelegata, String nomePortaDelegante,
  1031.             String gestioneToken, String[] gestioneTokenPolicyLabels, String[] gestioneTokenPolicyValues,
  1032.             String gestioneTokenPolicy, String gestioneTokenOpzionale,
  1033.             String gestioneTokenValidazioneInput, String gestioneTokenIntrospection, String gestioneTokenUserInfo, String gestioneTokenForward,
  1034.             String autenticazioneTokenIssuer,String autenticazioneTokenClientId,String autenticazioneTokenSubject,String autenticazioneTokenUsername,String autenticazioneTokenEMail,
  1035.             String autorizzazioneToken, String autorizzazioneTokenOptions,
  1036.             String autorizzazioneScope, int numScope, String autorizzazioneScopeMatch,BinaryParameter allegatoXacmlPolicy,
  1037.             String messageEngine,String canalePorta,
  1038.             String identificazioneAttributiStato, String[] attributeAuthorityLabels, String[] attributeAuthorityValues, String [] attributeAuthoritySelezionate, String attributeAuthorityAttributi,
  1039.             String autorizzazioneAutenticatiToken, String urlAutorizzazioneAutenticatiToken, int numAutenticatiToken,
  1040.             String autorizzazioneRuoliToken,  String urlAutorizzazioneRuoliToken, int numRuoliToken, String autorizzazioneRuoliTipologiaToken, String autorizzazioneRuoliMatchToken,
  1041.             String ctModalitaSincronizzazione, String ctImplementazione, String ctContatori, String ctTipologia,
  1042.             String ctHeaderHttp, String ctHeaderHttpLimit, String ctHeaderHttpRemaining, String ctHeaderHttpReset,
  1043.             String ctHeaderHttpRetryAfter, String ctHeaderHttpRetryAfterBackoff) throws Exception {

  1044.         if(numSA>0 && statoMessageSecurity!=null && statoMTOM!=null && servizioApplicativoList!=null && servizioApplicativo!=null && idSa!=null) {
  1045.             // nop
  1046.         }
  1047.        
  1048.         Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);

  1049.         // Soggetto virtuale?
  1050.         Boolean soggVirt = ServletUtils.getObjectFromSession(this.request, this.session, Boolean.class, CostantiControlStation.SESSION_PARAMETRO_GESTIONE_SOGGETTI_VIRTUALI);
  1051.        
  1052.         Boolean confPers = ServletUtils.getObjectFromSession(this.request, this.session, Boolean.class, CostantiControlStation.SESSION_PARAMETRO_GESTIONE_CONFIGURAZIONI_PERSONALIZZATE);
  1053.        
  1054.         // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  1055.         Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  1056.         if(parentPA == null) parentPA = PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE;
  1057.        
  1058.         boolean isConfigurazione = parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE;
  1059.        
  1060.         boolean datiInvocazione = false;
  1061.         boolean modificaDescrizione = false;
  1062.         boolean datiAltroPorta = false;
  1063.         boolean datiAltroApi = false; // indipendente dalla porta (viene utilizzata sempre la porta di default)
  1064.         if(isConfigurazione) {
  1065.             if(usataInConfigurazioneDefault) {
  1066.                 datiInvocazione = ServletUtils.isCheckBoxEnabled(this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_DATI_INVOCAZIONE));
  1067.             }
  1068.             modificaDescrizione = ServletUtils.isCheckBoxEnabled(this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_DESCRIZIONE));
  1069.             datiAltroPorta = ServletUtils.isCheckBoxEnabled(this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_ALTRO_PORTA));
  1070.             datiAltroApi = ServletUtils.isCheckBoxEnabled(this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_ALTRO_API));
  1071.            
  1072.             DataElement de = new DataElement();
  1073.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_DATI_INVOCAZIONE);
  1074.             de.setType(DataElementType.HIDDEN);
  1075.             de.setValue(datiInvocazione+"");
  1076.             dati.add(de);
  1077.            
  1078.             de = new DataElement();
  1079.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_DESCRIZIONE);
  1080.             de.setType(DataElementType.HIDDEN);
  1081.             de.setValue(modificaDescrizione+"");
  1082.             dati.add(de);
  1083.            
  1084.             de = new DataElement();
  1085.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_ALTRO_PORTA);
  1086.             de.setType(DataElementType.HIDDEN);
  1087.             de.setValue(datiAltroPorta+"");
  1088.             dati.add(de);
  1089.            
  1090.             de = new DataElement();
  1091.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_ALTRO_API);
  1092.             de.setType(DataElementType.HIDDEN);
  1093.             de.setValue(datiAltroApi+"");
  1094.             dati.add(de);
  1095.         }
  1096.        

  1097.            
  1098.         Parameter pIdSogg = null, pIdPorta = null, pIdAsps = null, pNomePorta = null;

  1099.         if(!tipoOp.equals(TipoOperazione.ADD)) {
  1100.             pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  1101.             pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  1102.             pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, asps.getId()+ "");
  1103.             pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, nomePorta);
  1104.         }
  1105.        
  1106.         // servicebinding hidden
  1107.         dati.add(this.getServiceBindingDataElement(serviceBinding));
  1108.        
  1109.        
  1110.         // *************** Nome/Descrizione *********************
  1111.        
  1112.         if(datiInvocazione || (!datiAltroPorta && !datiAltroApi)) {
  1113.             DataElement de = new DataElement();
  1114.             if(datiInvocazione) {
  1115.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_TITOLO_PORTE_APPLICATIVE_DATI_INVOCAZIONE);
  1116.             }
  1117.             else if(modificaDescrizione) {
  1118.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_TITOLO_PORTE_APPLICATIVE_DESCRIZIONE);
  1119.             }
  1120.             else {
  1121.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_TITOLO_PORTE_APPLICATIVE_DATI_GENERALI);
  1122.             }
  1123.             de.setType(DataElementType.TITLE);
  1124.             dati.add(de);
  1125.         }
  1126.                
  1127.         DataElement de = new DataElement();
  1128.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1129.         de.setValue(nomePorta);
  1130.         if(isConfigurazione) {
  1131.             de.setType(DataElementType.HIDDEN);
  1132.         }
  1133.         else {              
  1134.             de.setType(DataElementType.TEXT_EDIT);
  1135.             de.setRequired(true);
  1136.         }
  1137.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA);
  1138.         dati.add(de);

  1139.         if(datiInvocazione) {
  1140.            
  1141.             IDSoggetto soggettoOperativo = null;
  1142.             if(asps!=null) {
  1143.                 soggettoOperativo = new IDSoggetto(asps.getTipoSoggettoErogatore(), asps.getNomeSoggettoErogatore());
  1144.             }
  1145.             boolean analizeProxyPassRules = true;
  1146.             UrlInvocazioneAPI urlInvocazione = this.confCore.getConfigurazioneUrlInvocazione(protocollo, RuoloContesto.PORTA_APPLICATIVA, serviceBinding, nomePorta, soggettoOperativo,
  1147.                     aspc, canalePorta,
  1148.                     analizeProxyPassRules);
  1149.            
  1150.             de = new DataElement();
  1151.             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  1152.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_URL_INVOCAZIONE);
  1153.             }
  1154.             else {
  1155.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_BASE_URL_INVOCAZIONE);
  1156.             }
  1157.             String urlInvocazioneAPI = urlInvocazione.getUrl();
  1158.             de.setValue(urlInvocazioneAPI);
  1159.             de.setType(DataElementType.TEXT);
  1160.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA+"___LABEL");
  1161.             dati.add(de);
  1162.            
  1163.             UrlInvocazioneAPI urlInvocazioneDefault = this.confCore.getConfigurazioneUrlInvocazione(protocollo, RuoloContesto.PORTA_APPLICATIVA, serviceBinding, nomePorta, soggettoOperativo,
  1164.                     aspc, canalePorta,
  1165.                     !analizeProxyPassRules);
  1166.            
  1167.             if(urlInvocazioneDefault!=null && urlInvocazioneDefault.getUrl()!=null && !urlInvocazioneDefault.getUrl().equals(urlInvocazioneAPI)) {
  1168.                 de = new DataElement();
  1169.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  1170.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_URL_INVOCAZIONE_INTERNA);
  1171.                 }
  1172.                 else {
  1173.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_BASE_URL_INVOCAZIONE_INTERNA);
  1174.                 }
  1175.                 String urlInvocazioneAPIdefault = urlInvocazioneDefault.getUrl();
  1176.                 de.setValue(urlInvocazioneAPIdefault);
  1177.                 de.setType(DataElementType.TEXT);
  1178.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA+"___LABEL_INTERNA");
  1179.                 dati.add(de);
  1180.             }
  1181.         }
  1182.        
  1183.         de = new DataElement();
  1184.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_DESCRIZIONE);
  1185.         if(modificaDescrizione && ImplementationConfiguration.isDescriptionDefault(descr)) {
  1186.             de.setValue(null);
  1187.         }
  1188.         else {
  1189.             de.setValue(descr);
  1190.         }
  1191.         if(isConfigurazione && !modificaDescrizione) {
  1192.             de.setType(DataElementType.HIDDEN);
  1193.         } else {
  1194.             if(modificaDescrizione) {
  1195.                 de.setType(DataElementType.TEXT_AREA);
  1196.                 de.setRows(CostantiControlStation.TEXT_AREA_DESCRIZIONE_ROWS);
  1197.                 de.setLabel(CostantiControlStation.LABEL_PROPRIETA_DESCRIZIONE_EMPTY);
  1198.             }
  1199.             else {
  1200.                 de.setType(DataElementType.TEXT_EDIT);
  1201.             }
  1202.         }
  1203.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_DESCRIZIONE);
  1204.         dati.add(de);

  1205.         de = new DataElement();
  1206.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_STATO_PORTA);
  1207.         if(statoPorta==null || "".equals(statoPorta)){
  1208.             statoPorta = CostantiConfigurazione.ABILITATO.toString();
  1209.         }
  1210.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_STATO_PORTA);
  1211.         if(!isConfigurazione) {
  1212.             List<String> statoValues = new ArrayList<>();
  1213.             statoValues.add(CostantiConfigurazione.ABILITATO.toString());
  1214.             statoValues.add(CostantiConfigurazione.DISABILITATO.toString());
  1215.             de.setValues(statoValues);
  1216.             de.setSelected(statoPorta);
  1217.             de.setType(DataElementType.SELECT);
  1218.         }
  1219.         else {
  1220.             de.setValue(statoPorta);
  1221.             de.setType(DataElementType.HIDDEN);
  1222.         }
  1223.         dati.add(de);

  1224.        
  1225.        
  1226.         if(!isConfigurazione) {
  1227.             de = new DataElement();
  1228.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_TITOLO_PORTE_APPLICATIVE_DATI_SERVIZIO);
  1229.             de.setType(DataElementType.TITLE);
  1230.             dati.add(de);
  1231.         }
  1232.        
  1233.        
  1234.        
  1235.         // *************** Soggetto Virtuale *********************
  1236.        
  1237.         if (soggVirt) {
  1238.             if(!isConfigurazione) {
  1239.                 de = new DataElement();
  1240.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_VIRTUALE);
  1241.                 de.setType(DataElementType.SUBTITLE);
  1242.                 dati.add(de);
  1243.             }
  1244.         }
  1245.        
  1246.         de = new DataElement();
  1247.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1248.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_VIRTUALE);
  1249.         if (soggVirt) {
  1250.             if(!isConfigurazione) {
  1251.                 de.setType(DataElementType.SELECT);
  1252.                 de.setValues(soggettiList);
  1253.                 de.setLabels(soggettiListLabel);
  1254.                 de.setSelected(soggvirt);
  1255.                 de.setPostBack(true);
  1256.             }
  1257.             else {
  1258.                 de.setValue(soggvirt);
  1259.                 de.setType(DataElementType.HIDDEN);
  1260.             }
  1261.         }else{
  1262.             de.setValue("-");
  1263.             de.setType(DataElementType.HIDDEN);
  1264.         }
  1265.         dati.add(de);

  1266.        
  1267.        
  1268.         // *************** Servizio *********************
  1269.        
  1270.         if(!isConfigurazione) {
  1271.             de = new DataElement();
  1272.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO);
  1273.             de.setType(DataElementType.SUBTITLE);
  1274.             dati.add(de);
  1275.         }

  1276.         de = new DataElement();
  1277.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1278.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SERVIZIO);
  1279.         if(!usataInConfigurazioni) {
  1280.             de.setPostBack(true);
  1281.             de.setType(DataElementType.SELECT);
  1282.             de.setValues(serviziList);
  1283.             de.setLabels(serviziListLabel);
  1284.             de.setSelected(servizio);
  1285.         } else {
  1286.            
  1287.             de.setType(DataElementType.HIDDEN);
  1288.             de.setValue(servizio);
  1289.             dati.add(de);
  1290.            
  1291.             if(this.isModalitaCompleta()) {
  1292.                 DataElement deLabel = new DataElement();
  1293.                 deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1294.                 deLabel.setType(DataElementType.TEXT);
  1295.                 for (int i = 0; i < serviziList.length; i++) {
  1296.                     if(serviziList[i]!=null && serviziList[i].equals(servizio)){
  1297.                         deLabel.setValue(serviziListLabel[i]);
  1298.                         break;
  1299.                     }
  1300.                 }
  1301.                 dati.add(deLabel);
  1302.             }
  1303.         }      
  1304.         dati.add(de);
  1305.        
  1306.        
  1307.         // *************** Azione *********************
  1308.         List<PortaApplicativaAzioneIdentificazione> allImplementationIdentificationResourceModes = getModalitaIdentificazionePorta(protocollo, serviceBinding);
  1309.        
  1310.         List<String> azTmp = new ArrayList<>();
  1311.         String[] tipoModeAzione = null;
  1312.         String[] tipoModeAzioneLabel = null;
  1313.        
  1314.         if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && !usataInConfigurazioni)) {
  1315.             azTmp.add(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT);
  1316.         }
  1317.         else if(datiInvocazione && ServiceBinding.SOAP.equals(serviceBinding)) {
  1318.             if(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT.equals(modeaz)) {
  1319.                 azTmp.add(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT); // era stata impostata precedentemente
  1320.             }
  1321.             else {
  1322.                 Map<String,String> azioni = this.porteApplicativeCore.getAzioniConLabel(asps, aspc, false, true, new ArrayList<>());
  1323.                 if(azioni==null || azioni.size()<=1) {
  1324.                     azTmp.add(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT);
  1325.                 }
  1326.             }
  1327.         }
  1328.        
  1329.        
  1330.         if(allImplementationIdentificationResourceModes != null && allImplementationIdentificationResourceModes.size() >0) {
  1331.            
  1332.            
  1333.             for (int i = 0; i < allImplementationIdentificationResourceModes.size(); i++) {
  1334.                 PortaApplicativaAzioneIdentificazione pdAi = allImplementationIdentificationResourceModes.get(i);
  1335.                 azTmp.add(pdAi.toString());
  1336.             }
  1337.            
  1338.             Collections.sort(azTmp);
  1339.                        
  1340.             tipoModeAzione = new String [azTmp.size()];
  1341.             tipoModeAzioneLabel = new String [azTmp.size()];
  1342.            
  1343.             for (int i = 0; i < azTmp.size(); i++) {
  1344.                 String azMod = azTmp.get(i);
  1345.                 tipoModeAzione[i] = azMod;
  1346.                 tipoModeAzioneLabel[i] = this.getPortaApplicativaAzioneIdentificazioneLabel(azMod);
  1347.             }
  1348.         }
  1349.        
  1350.         boolean disableSaveButtonForDatiInvocazione = true;
  1351.        
  1352.         if(!isConfigurazione || datiInvocazione) {
  1353.             de = new DataElement();
  1354.             if(datiInvocazione) {
  1355.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  1356.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTA_RISORSA_MODALITA);
  1357.                 }
  1358.                 else {
  1359.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTA_AZIONE_MODALITA);
  1360.                 }
  1361.             }
  1362.             else {
  1363.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  1364.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RISORSA);
  1365.                 }
  1366.                 else {
  1367.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AZIONE);
  1368.                 }
  1369.             }
  1370.             de.setType(DataElementType.SUBTITLE);
  1371.             dati.add(de);
  1372.         }
  1373.        
  1374.         boolean viewOnlyModeDatiAzione = datiInvocazione && modeaz!=null && !"".equals(modeaz) && this.isModalitaStandard() &&
  1375.                 !azTmp.contains(modeaz);
  1376.         // se true viewOnlyModeDatiAzione e' stato usato un valore modificato in avanzato e non supportato in standard
  1377.        
  1378.         // Fix per standard visualizzazione anche su soap
  1379.         // fornisco interfaceMode direttamente come per rest se cmq è abilitato sia il riconoscimento per url che anche per forceInterface.
  1380.         boolean visualizzazioneSpecialeSoapPerEssereUgualeARest = false;
  1381.         if(this.isModalitaStandard() && ServiceBinding.SOAP.equals(serviceBinding) &&
  1382.                 PortaApplicativaAzioneIdentificazione.URL_BASED.getValue().equals(modeaz) &&
  1383.                 (ServletUtils.isCheckBoxEnabled(forceWsdlBased) || CostantiRegistroServizi.ABILITATO.equals(forceWsdlBased))
  1384.                 && (aspc.getByteWsdlConcettuale()!=null)
  1385.                 ) {
  1386.             visualizzazioneSpecialeSoapPerEssereUgualeARest = true;
  1387.         }
  1388.        
  1389.         de = new DataElement();
  1390.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE);
  1391.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_AZIONE);
  1392.         if(!usataInConfigurazioni || datiInvocazione) {
  1393.             if(viewOnlyModeDatiAzione || (tipoModeAzione!=null && tipoModeAzione.length==1) || visualizzazioneSpecialeSoapPerEssereUgualeARest) {
  1394.                 de.setType(DataElementType.HIDDEN);
  1395.                 de.setValue(modeaz);
  1396.                 dati.add(de);
  1397.                
  1398.                 de = new DataElement();
  1399.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE);
  1400.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_AZIONE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  1401.                 de.setType(DataElementType.TEXT);
  1402.                 if(visualizzazioneSpecialeSoapPerEssereUgualeARest) {
  1403.                     de.setValue(this.getPortaApplicativaAzioneIdentificazioneLabel(PortaApplicativaAzioneIdentificazione.INTERFACE_BASED.getValue()));
  1404.                 }
  1405.                 else {
  1406.                     de.setValue(this.getPortaApplicativaAzioneIdentificazioneLabel(modeaz));
  1407.                 }
  1408.             }
  1409.             else {
  1410.                 de.setType(DataElementType.SELECT);
  1411.                 de.setValues(tipoModeAzione);
  1412.                 de.setLabels(tipoModeAzioneLabel);
  1413.                 de.setSelected(modeaz);
  1414.                 de.setPostBack(true);
  1415.                
  1416.                 disableSaveButtonForDatiInvocazione = false;
  1417.             }
  1418.         } else {
  1419.             de.setType(DataElementType.HIDDEN);
  1420.             de.setValue(modeaz);
  1421.         }
  1422.        
  1423.         dati.add(de);
  1424.        
  1425.         boolean addHiddenAzione = false;
  1426.        
  1427.         if(!usataInConfigurazioni || datiInvocazione) {
  1428.    
  1429.             if(!usataInConfigurazioni && PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_DELEGATED_BY.equals(modeaz)) {
  1430.                
  1431.                 // azione non modificabile, metto la lista delle azioni
  1432.                 de = new DataElement();
  1433.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1434.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE);
  1435.                 de.setValue(azione);
  1436.                 dati.add(de);
  1437.                
  1438.                 addHiddenAzione = true;
  1439.                
  1440.             }
  1441.             else {
  1442.            
  1443.                 if ( (!visualizzazioneSpecialeSoapPerEssereUgualeARest) &&
  1444.                         (modeaz != null) &&
  1445.                         modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT)) {
  1446.                     de = new DataElement();
  1447.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1448.                     de.setType(DataElementType.SELECT);
  1449.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE_ID);
  1450.                     de.setValues(azioniList);
  1451.                     de.setLabels(azioniListLabel);
  1452.                     de.setSelected(azid);
  1453.                     dati.add(de);
  1454.                    
  1455.                     disableSaveButtonForDatiInvocazione = false;
  1456.                    
  1457.                 } else {
  1458.        
  1459.                     de = new DataElement();
  1460.                     if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED))) {
  1461.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ESPRESSIONE_REGOLARE);
  1462.                         de.setValue(patternAzione);
  1463.                         de.setRequired(true);
  1464.                     }
  1465.                     else if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED))) {
  1466.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  1467.                         de.setValue(patternAzione);
  1468.                         de.setRequired(true);
  1469.                     }
  1470.                     else if ((modeaz != null) && modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED)
  1471.                             ) {
  1472.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1473.                         de.setValue(patternAzione);
  1474.                         de.setRequired(true);
  1475.                     }
  1476.                     else {
  1477.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1478.                         de.setValue(azione);
  1479.                     }
  1480.        
  1481.                     if ( (!visualizzazioneSpecialeSoapPerEssereUgualeARest) &&
  1482.                             !PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INPUT_BASED.equals(modeaz) &&
  1483.                             !PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_SOAP_ACTION_BASED.equals(modeaz) &&
  1484.                             !PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED.equals(modeaz) &&
  1485.                             !PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INTERFACE_BASED.equals(modeaz) ){
  1486.                         if(viewOnlyModeDatiAzione) {
  1487.                             de.setType(DataElementType.TEXT);
  1488.                             de.setRequired(false);
  1489.                         }
  1490.                         else {
  1491.                             if(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED.equals(modeaz) ||
  1492.                                     PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED.equals(modeaz) ) {
  1493.                                 de.setType(DataElementType.TEXT_AREA);
  1494.                             }
  1495.                             else {
  1496.                                 de.setType(DataElementType.TEXT_EDIT);
  1497.                             }
  1498.                            
  1499.                             disableSaveButtonForDatiInvocazione = false;
  1500.                         }
  1501.                     }else
  1502.                         de.setType(DataElementType.HIDDEN);
  1503.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE);
  1504.                     dati.add(de);
  1505.                 }
  1506.        
  1507.                 // se non e' selezionata la modalita userInput / wsdlbased / registerInput faccio vedere il check box forceWsdlbased
  1508.                 de = new DataElement();
  1509.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED_LEFT);
  1510.                 if( (!visualizzazioneSpecialeSoapPerEssereUgualeARest) &&
  1511.                         modeaz!= null &&
  1512.                         (
  1513.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) &&
  1514.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED) &&
  1515.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INTERFACE_BASED)
  1516.                         )
  1517.                     ){
  1518.        
  1519.                     if(viewOnlyModeDatiAzione) {
  1520.                         de.setType(DataElementType.TEXT);
  1521.                         if( ServletUtils.isCheckBoxEnabled(forceWsdlBased) || CostantiRegistroServizi.ABILITATO.equals(forceWsdlBased) ){
  1522.                             de.setValue(CostantiConfigurazione.ABILITATO.getValue());
  1523.                         }
  1524.                         else {
  1525.                             de.setValue(CostantiConfigurazione.DISABILITATO.getValue());
  1526.                         }
  1527.                     }
  1528.                     else {
  1529.                         de.setType(DataElementType.CHECKBOX);
  1530.                         de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED_RIGHT);
  1531.                         if( ServletUtils.isCheckBoxEnabled(forceWsdlBased) || CostantiRegistroServizi.ABILITATO.equals(forceWsdlBased) ){
  1532.                             de.setSelected(true);
  1533.                         }
  1534.                        
  1535.                         disableSaveButtonForDatiInvocazione = false;
  1536.                     }
  1537.                 }
  1538.                 else{
  1539.                     de.setType(DataElementType.HIDDEN);
  1540.                     de.setValue(forceWsdlBased);
  1541.                 }
  1542.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED);
  1543.                 dati.add(de);
  1544.                
  1545.                 if( (!visualizzazioneSpecialeSoapPerEssereUgualeARest) &&
  1546.                         modeaz!= null &&
  1547.                         (
  1548.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) &&
  1549.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED) &&
  1550.                             !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INTERFACE_BASED)
  1551.                         )
  1552.                 ){
  1553.                     de = new DataElement();
  1554.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_LIST_AZIONI_READ_ONLY);
  1555.                     de.setLabel(this.getLabelAzioni(serviceBinding));
  1556.                     Map<String,String> azioni = this.porteApplicativeCore.getAzioniConLabel(asps, aspc, false, true, new ArrayList<>());
  1557.                     StringBuilder bf = new StringBuilder();
  1558.                     for (String az : azioni.keySet()) {
  1559.                         if(bf.length()>0) {
  1560.                             bf.append("\n");
  1561.                         }
  1562.                         bf.append(azioni.get(az));
  1563.                     }
  1564.                     de.setType(DataElementType.TEXT_AREA_NO_EDIT);
  1565.                     if(azioni.size()<=CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_AZIONI_SIZE) {
  1566.                         de.setRows(azioni.size());
  1567.                     }
  1568.                     else {
  1569.                         de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_AZIONI_SIZE);
  1570.                     }
  1571.                     de.setValue(bf.toString());
  1572.                     dati.add(de);
  1573.                 }
  1574.             }
  1575.        
  1576.         }
  1577.         else {
  1578.            
  1579.             addHiddenAzione = true;
  1580.            
  1581.         }
  1582.        
  1583.         if(addHiddenAzione) {
  1584.        
  1585.             de = new DataElement();
  1586.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1587.             de.setType(DataElementType.HIDDEN);
  1588.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE_ID);
  1589.             de.setValue(azid);
  1590.             dati.add(de);
  1591.            
  1592.             if(this.isModalitaCompleta()) {
  1593.                 DataElement deLabel = new DataElement();
  1594.                 deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE);
  1595.                 deLabel.setType(DataElementType.TEXT);
  1596.                 deLabel.setValue(modeaz);
  1597.                 dati.add(deLabel);
  1598.             }
  1599.            
  1600.             de = new DataElement();
  1601.             if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED)
  1602.                     || modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED))) {
  1603.                 de.setValue(patternAzione);
  1604.             }
  1605.             else if ((modeaz != null) && modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED)
  1606.                     ) {
  1607.                 de.setValue(patternAzione);
  1608.             }
  1609.             else {
  1610.                 de.setValue(azione);
  1611.             }
  1612.             de.setType(DataElementType.HIDDEN);
  1613.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_AZIONE);
  1614.             dati.add(de);
  1615.            
  1616.             if(this.isModalitaCompleta()) {
  1617.                 DataElement deLabel = new DataElement();
  1618.                 deLabel.setType(DataElementType.TEXT);
  1619.                 if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED))) {
  1620.                     deLabel.setType(DataElementType.TEXT_AREA_NO_EDIT);
  1621.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ESPRESSIONE_REGOLARE);
  1622.                     deLabel.setValue(patternAzione);
  1623.                 }
  1624.                 else if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED))) {
  1625.                     deLabel.setType(DataElementType.TEXT_AREA_NO_EDIT);
  1626.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  1627.                     deLabel.setValue(patternAzione);
  1628.                 }
  1629.                 else if ((modeaz != null) && modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED)
  1630.                         ) {
  1631.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1632.                     deLabel.setValue(patternAzione);
  1633.                 }
  1634.                 else {
  1635.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  1636.                     deLabel.setValue(azione);
  1637.                 }
  1638.                 dati.add(deLabel);
  1639.             }
  1640.            
  1641.             if(this.isModalitaCompleta()) {
  1642.                 if ((modeaz != null) && (modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_DELEGATED_BY))){
  1643.                     de = new DataElement();
  1644.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PORTA_DELEGANTE);
  1645.                     de.setType(DataElementType.TEXT);
  1646.                     de.setValue(nomePortaDelegante);
  1647.                     dati.add(de);
  1648.                 }
  1649.                 else {
  1650.                     DataElement deLabel = new DataElement();
  1651.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RICERCA_PORTA_AZIONE_DELEGATA);
  1652.                     deLabel.setType(DataElementType.TEXT);
  1653.                     deLabel.setValue(ricercaPortaAzioneDelegata ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue() );
  1654.                     dati.add(deLabel);
  1655.                 }
  1656.             }
  1657.            
  1658.             de = new DataElement();
  1659.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED_LEFT);
  1660.             de.setType(DataElementType.HIDDEN);
  1661.             de.setValue(forceWsdlBased);
  1662.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED);
  1663.             dati.add(de);
  1664.            
  1665.             if(this.isModalitaCompleta()) {
  1666.                 if( modeaz!= null && (
  1667.                         !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT) &&
  1668.                         !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED) &&
  1669.                         !modeaz.equals(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE_INTERFACE_BASED))
  1670.                 ){
  1671.                     DataElement deLabel = new DataElement();
  1672.                     deLabel.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_FORCE_INTERFACE_BASED_LEFT);
  1673.                     deLabel.setType(DataElementType.TEXT);
  1674.                     deLabel.setValue(ServletUtils.isCheckBoxEnabled(forceWsdlBased) ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue() );
  1675.                     dati.add(deLabel);
  1676.                 }
  1677.             }
  1678.            
  1679.         }
  1680.        
  1681.         if(datiInvocazione && disableSaveButtonForDatiInvocazione) {
  1682.             this.pd.disableEditMode();
  1683.         }
  1684.        
  1685.        
  1686.        
  1687.         // *************** ServizioApplicativo Erogatore *********************
  1688.        
  1689. /**     if(!isConfigurazione && TipoOperazione.CHANGE.equals(tipoOp)){
  1690.                
  1691.             // Il link richiede ulteriori parametri.
  1692.            
  1693. //          de = new DataElement();
  1694. //          de.setType(DataElementType.TITLE);
  1695. //          de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZI_APPLICATIVI_EROGATORI);
  1696. //          dati.add(de);
  1697. //          
  1698. //          de = new DataElement();
  1699. //          de.setType(DataElementType.LINK);
  1700. //          
  1701. //          de.setUrl(ServiziApplicativiCostanti.SERVLET_NAME_SERVIZI_APPLICATIVI_ENDPOINT, pIdSogg, pIdPorta, pIdAsps,
  1702. //                  new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_NOME_SERVIZIO_APPLICATIVO, servizioApplicativo),
  1703. //                  new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_ID_SERVIZIO_APPLICATIVO, idSa+""));
  1704. //          ServletUtils.setDataElementVisualizzaLabel(de);
  1705. //
  1706. //
  1707. //          dati.add(de);*/
  1708.        
  1709.            
  1710.         //}
  1711.        
  1712.         // *************** Controllo degli Accessi *********************
  1713.    
  1714.         if(!tipoOp.equals(TipoOperazione.ADD)) {
  1715.             if(!isConfigurazione) {
  1716.                
  1717.                 // Il link richiede ulteriori parametri.
  1718.                
  1719. /**             this.controlloAccessi(dati);
  1720. //              //  controllo accessi
  1721. //              de = new DataElement();
  1722. //              de.setType(DataElementType.LINK);
  1723. //              de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI, pIdSogg, pIdPorta, pIdAsps);
  1724. //              String statoControlloAccessi = this.getLabelStatoControlloAccessi(gestioneToken,autenticazione, autenticazioneOpzionale, autenticazioneCustom, autorizzazione, autorizzazioneContenuti,autorizzazioneCustom);
  1725. //              ServletUtils.setDataElementCustomLabel(de, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI, statoControlloAccessi);
  1726. //              dati.add(de);*/
  1727.             }
  1728.         }else {
  1729.             // Pintori 29/11/2017 Gestione Accessi spostata nella servlet PorteApplicativeControlloAccessi,  in ADD devo mostrare comunque la form.
  1730.            
  1731.             String servletChiamante = PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_ADD;
  1732.            
  1733.             boolean forceAutenticato = false;
  1734.             boolean forceHttps = false;
  1735.             boolean forceDisableOptional = false;
  1736.             boolean forceGestioneToken = false;
  1737.             if(this.isProfiloModIPA(protocollo)) {
  1738.                 forceAutenticato = true; // in modI ci vuole sempre autenticazione https sull'erogazione (cambia l'opzionalita' o meno)
  1739.                 forceHttps = forceAutenticato;
  1740.                
  1741.                 boolean forcePDND = false;
  1742.                 boolean forceOAuth = false;
  1743.                
  1744.                 BooleanNullable forceHttpsClientWrapper = BooleanNullable.NULL();
  1745.                 BooleanNullable forcePDNDWrapper = BooleanNullable.NULL();
  1746.                 BooleanNullable forceOAuthWrapper = BooleanNullable.NULL();
  1747.                
  1748.                 this.readModIConfiguration(forceHttpsClientWrapper, forcePDNDWrapper, forceOAuthWrapper,
  1749.                         IDAccordoFactory.getInstance().getIDAccordoFromAccordo(aspc),asps!=null ? asps.getPortType() : null,
  1750.                         null);
  1751.                
  1752.                 if(forceHttpsClientWrapper.getValue()!=null) {
  1753.                     forceDisableOptional = forceHttpsClientWrapper.getValue().booleanValue();
  1754.                 }
  1755.                 if(forcePDNDWrapper.getValue()!=null) {
  1756.                     forcePDND = forcePDNDWrapper.getValue().booleanValue();
  1757.                 }
  1758.                 if(forceOAuthWrapper.getValue()!=null) {
  1759.                     forceOAuth = forceOAuthWrapper.getValue().booleanValue();
  1760.                 }

  1761.                 if (forcePDND || forceOAuth) {
  1762.                    
  1763.                     forceGestioneToken = true;
  1764.                    
  1765.                     if(forcePDND) {
  1766.                         List<String> tokenPolicies = this.getTokenPolicyGestione(true, false,
  1767.                                 true,
  1768.                                 gestioneTokenPolicy, tipoOp);
  1769.                         if(tokenPolicies!=null && !tokenPolicies.isEmpty()) {
  1770.                             gestioneTokenPolicyLabels = tokenPolicies.toArray(new String[1]);
  1771.                             gestioneTokenPolicyValues = tokenPolicies.toArray(new String[1]);
  1772.                         }
  1773.                     }
  1774.                     else {
  1775.                         List<String> tokenPolicies = this.getTokenPolicyGestione(false, true,
  1776.                                 true,
  1777.                                 gestioneTokenPolicy, tipoOp);
  1778.                         if(tokenPolicies!=null && !tokenPolicies.isEmpty()) {
  1779.                             gestioneTokenPolicyLabels = tokenPolicies.toArray(new String[1]);
  1780.                             gestioneTokenPolicyValues = tokenPolicies.toArray(new String[1]);
  1781.                         }
  1782.                     }
  1783.                    
  1784.                 }
  1785.             }
  1786.            
  1787.             this.controlloAccessiGestioneToken(dati, tipoOp, gestioneToken, gestioneTokenPolicyLabels, gestioneTokenPolicyValues,
  1788.                     gestioneTokenPolicy, gestioneTokenOpzionale, gestioneTokenValidazioneInput, gestioneTokenIntrospection, gestioneTokenUserInfo, gestioneTokenForward, null,protocollo,false,
  1789.                     forceGestioneToken);

  1790.             this.controlloAccessiAutenticazione(dati, tipoOp, servletChiamante, null,protocollo,
  1791.                     autenticazione, autenticazioneCustom, autenticazioneOpzionale,
  1792.                     autenticazionePrincipal, autenticazioneParametroList,
  1793.                     confPers, isSupportatoAutenticazioneSoggetti,false,
  1794.                     gestioneToken, gestioneTokenPolicy, autenticazioneTokenIssuer, autenticazioneTokenClientId, autenticazioneTokenSubject, autenticazioneTokenUsername, autenticazioneTokenEMail,
  1795.                     false, null, 0,
  1796.                     forceHttps, forceDisableOptional);
  1797.            
  1798.             String urlAutorizzazioneAutenticati = null;
  1799.             String urlAutorizzazioneErogazioneApplicativiAutenticati = null;
  1800.             String urlAutorizzazioneRuoli = null;
  1801.             String urlAutorizzazioneScope = null;
  1802.             String urlAutorizzazioneErogazioneCustomPropertiesList = null;
  1803.             String urlAutorizzazioneContenutiErogazioneCustomPropertiesList = null;
  1804.            
  1805.             this.controlloAccessiAutorizzazione(dati, tipoOp, servletChiamante, null,protocollo,
  1806.                     autenticazione, autenticazioneCustom,
  1807.                     autorizzazione, autorizzazioneCustom,
  1808.                     autorizzazioneAutenticati, urlAutorizzazioneAutenticati, 0, null, null,
  1809.                     autorizzazioneRuoli,  urlAutorizzazioneRuoli, numRuoli, null,
  1810.                     autorizzazioneRuoliTipologia, ruoloMatch,
  1811.                     confPers, isSupportatoAutenticazioneSoggetti, contaListe, false, false,autorizzazioneScope,urlAutorizzazioneScope,numScope,null,autorizzazioneScopeMatch,
  1812.                     gestioneToken, gestioneTokenPolicy, autorizzazioneToken, autorizzazioneTokenOptions,allegatoXacmlPolicy,
  1813.                     urlAutorizzazioneErogazioneApplicativiAutenticati, 0, urlAutorizzazioneErogazioneCustomPropertiesList , 0,
  1814.                     identificazioneAttributiStato, attributeAuthorityLabels, attributeAuthorityValues, attributeAuthoritySelezionate, attributeAuthorityAttributi,
  1815.                     autorizzazioneAutenticatiToken, urlAutorizzazioneAutenticatiToken, numAutenticatiToken,
  1816.                     autorizzazioneRuoliToken,  urlAutorizzazioneRuoliToken, numRuoliToken, autorizzazioneRuoliTipologiaToken, autorizzazioneRuoliMatchToken);
  1817.            
  1818.             this.controlloAccessiAutorizzazioneContenuti(dati, tipoOp, false, null,protocollo,
  1819.                     autorizzazioneContenutiStato,
  1820.                     autorizzazioneContenuti, autorizzazioneContenutiProperties, serviceBinding,
  1821.                     false, urlAutorizzazioneContenutiErogazioneCustomPropertiesList, 0,
  1822.                     confPers);
  1823.         }
  1824.        
  1825.        
  1826.        
  1827.         // *************** Validazione Contenuti *********************
  1828.         if(!tipoOp.equals(TipoOperazione.ADD)) {
  1829.             if(!isConfigurazione) {
  1830.                
  1831.                 // Il link richiede ulteriori parametri.
  1832.                
  1833. //              de = new DataElement();
  1834. //              de.setType(DataElementType.TITLE);
  1835. //              de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALIDAZIONE_CONTENUTI);
  1836. //              dati.add(de);
  1837. //              
  1838. //              
  1839. //              // Validazione Contenuti
  1840. //              de = new DataElement();
  1841. //              de.setType(DataElementType.LINK);
  1842. //              de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_VALIDAZIONE_CONTENUTI, pIdSogg, pIdPorta, pIdAsps);
  1843. //              ServletUtils.setDataElementCustomLabel(de, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALIDAZIONE_CONTENUTI, statoValidazione);
  1844. //              dati.add(de);
  1845.             }
  1846.         }else {
  1847.             //  Pintori 08/02/2018 Validazione Contenuti spostata nella servlet PorteApplicativeValidazione, in ADD devo mostrare comunque la form.
  1848.             this.validazioneContenuti(tipoOp, dati, true, false, statoValidazione, tipoValidazione, applicaMTOM,
  1849.                     serviceBinding, aspc.getFormatoSpecifica());
  1850.         }
  1851.        
  1852.         // *************** Integrazione *********************
  1853.        
  1854.         List<DataElement> deIntegrazione = new ArrayList<>();
  1855.                
  1856.         boolean nascondiSezioneOpzioniAvanzate = (this.isModalitaStandard() || (isConfigurazione && !datiAltroPorta));
  1857.        
  1858.         if (tipoOp.equals(TipoOperazione.CHANGE)) {
  1859.             addIntegrazioneMetadatiToDati(dati, integrazioneStato, integrazione, integrazioneGruppi, integrazioneGruppiDaVisualizzare,  integrazioneGruppiValoriDeiGruppi, deIntegrazione, nascondiSezioneOpzioniAvanzate, false, serviceBinding);
  1860.         }
  1861.        
  1862.         String[] tipoStateless = {
  1863.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_STATELESS_DEFAULT,
  1864.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_STATELESS_ABILITATO,
  1865.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_STATELESS_DISABILITATO
  1866.         };
  1867.         de = new DataElement();
  1868.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_STATELESS);
  1869.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_STATELESS);
  1870.         if(!this.core.isShowJ2eeOptions() || (isConfigurazione && !datiAltroPorta)){
  1871.             de.setType(DataElementType.HIDDEN);
  1872.             de.setValue(stateless);
  1873.             dati.add(de);
  1874.         }else{
  1875.             de.setType(DataElementType.SELECT);
  1876.             de.setValues(tipoStateless);
  1877.             de.setSelected(stateless);
  1878.             deIntegrazione.add(de);
  1879.         }  
  1880.        
  1881.                
  1882.         de = new DataElement();
  1883.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_BEHAVIOUR);
  1884.         de.setValue(behaviour);
  1885.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_BEHAVIOUR);
  1886.         if(this.core.isConnettoriMultipliEnabled()) {
  1887.             de.setType(DataElementType.HIDDEN);
  1888.             dati.add(de);
  1889.         } else if (!this.isModalitaAvanzata() || (isConfigurazione && !datiAltroPorta)) {
  1890.             de.setType(DataElementType.HIDDEN);
  1891.             dati.add(de);
  1892.         }
  1893.         else{
  1894.             de.setType(DataElementType.TEXT_EDIT);
  1895.             deIntegrazione.add(de);
  1896.         }
  1897.            
  1898.         if (tipoOp.equals(TipoOperazione.CHANGE)) {
  1899.             if( (this.isModalitaAvanzata() || this.porteApplicativeCore.isProprietaErogazioniShowModalitaStandard()) && !isConfigurazione){
  1900.                 de = new DataElement();
  1901.                 de.setType(DataElementType.LINK);
  1902.                 de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_PROPRIETA_PROTOCOLLO_LIST,pIdSogg,pIdPorta, pIdAsps);

  1903.                 if (contaListe) {
  1904.                     ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES,Long.valueOf(numProprProt));
  1905.                 } else
  1906.                     ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES);

  1907.                 deIntegrazione.add(de);
  1908.             }
  1909.         }
  1910.        
  1911.         if(deIntegrazione.size()>0){
  1912.            
  1913.             if(!isConfigurazione || datiAltroPorta) {
  1914.                 de = new DataElement();
  1915.                 de.setType(DataElementType.TITLE);
  1916.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_INTEGRAZIONE);
  1917.                 dati.add(de);
  1918.                
  1919.                 for (int i = 0; i < deIntegrazione.size(); i++) {
  1920.                     dati.add(deIntegrazione.get(i));
  1921.                 }
  1922.             }
  1923.         }
  1924.        
  1925.        
  1926.         // Rate Limiting
  1927.         if(tipoOp.equals(TipoOperazione.CHANGE) && datiAltroPorta) {
  1928.             addOpzioniAvanzateRateLimitingToDati(dati,
  1929.                     true,
  1930.                     nascondiSezioneOpzioniAvanzate,
  1931.                     ctModalitaSincronizzazione, ctImplementazione, ctContatori, ctTipologia,
  1932.                     ctHeaderHttp, ctHeaderHttpLimit, ctHeaderHttpRemaining, ctHeaderHttpReset,
  1933.                     ctHeaderHttpRetryAfter, ctHeaderHttpRetryAfterBackoff);
  1934.         }
  1935.        
  1936.        
  1937.        
  1938.         // Message Handlers
  1939.         if (tipoOp.equals(TipoOperazione.CHANGE)) {
  1940.             boolean visualizzaHandlers = this.confCore.isConfigurazioneHandlersEnabled();
  1941.             if(!nascondiSezioneOpzioniAvanzate && visualizzaHandlers) {
  1942.                 this.visualizzaLinkHandlers(dati, false, TipoPdD.APPLICATIVA, Long.parseLong(idPorta), serviceBinding);
  1943.             }
  1944.         }
  1945.        
  1946.        
  1947.         // *************** CorrelazioneApplicativa *********************
  1948.         boolean show = false; // aggiunto link in trattamento messaggio
  1949.         if (show && tipoOp.equals(TipoOperazione.CHANGE)) {
  1950.        
  1951.             de = new DataElement();
  1952.             de.setType(DataElementType.TITLE);
  1953.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA);
  1954.             dati.add(de);
  1955.            
  1956.             boolean riuso = false; // riuso non abilitato nella porta applicativa
  1957.             if (numCorrApp > 0 && riuso) {
  1958.                 de = new DataElement();
  1959.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_LABEL);
  1960.                 de.setNote(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_NOTE);
  1961.                 de.setValue(scadcorr);
  1962.                 de.setType(DataElementType.TEXT_EDIT);
  1963.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SCADENZA_CORRELAZIONE_APPLICATIVA);
  1964.                 dati.add(de);
  1965.             }
  1966.            
  1967.            

  1968.             de = new DataElement();
  1969.             de.setType(DataElementType.LINK);
  1970.             de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_REQUEST_LIST,pIdSogg,pIdPorta,pNomePorta, pIdAsps);
  1971.             if (contaListe) {
  1972.                 ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RICHIESTA,Long.valueOf(numCorrelazioneReq));
  1973.             } else
  1974.                 ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RICHIESTA);

  1975.             dati.add(de);

  1976.             de = new DataElement();
  1977.             de.setType(DataElementType.LINK);
  1978.             de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RESPONSE_LIST,pIdSogg,pIdPorta,pNomePorta, pIdAsps);
  1979.             if (contaListe) {
  1980.                 ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RISPOSTA,Long.valueOf(numCorrelazioneRes));
  1981.             } else
  1982.                 ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RISPOSTA);

  1983.             dati.add(de);
  1984.                        
  1985.         }

  1986.        

  1987.        
  1988.        
  1989.        
  1990.        
  1991.         // *************** Gestione Messaggio *********************
  1992.        
  1993.         if (tipoOp.equals(TipoOperazione.CHANGE)) {
  1994.             if(!isConfigurazione) {
  1995.                
  1996.                 // Il link richiede ulteriori parametri.
  1997.                
  1998. //              de = new DataElement();
  1999. //              de.setType(DataElementType.TITLE);
  2000. //              de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_MESSAGGIO);
  2001. //              dati.add(de);
  2002. //  
  2003. //              de = new DataElement();
  2004. //              de.setType(DataElementType.LINK);
  2005. //              de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA,pIdSogg,pIdPorta,pNomePorta, pIdAsps);
  2006. //              String statoCorrelazioneApplicativa = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  2007. //              if(numCorrelazioneReq>0 || numCorrelazioneRes>0){
  2008. //                  statoCorrelazioneApplicativa = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_ABILITATA;
  2009. //              }
  2010. //              ServletUtils.setDataElementCustomLabel(de, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, statoCorrelazioneApplicativa);
  2011. //              dati.add(de);
  2012. //              
  2013. //              de = new DataElement();
  2014. //              de.setType(DataElementType.LINK);
  2015. //              de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY,pIdSogg,pIdPorta, pIdAsps);
  2016. //              ServletUtils.setDataElementCustomLabel(de, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY, statoMessageSecurity);
  2017. //              dati.add(de);
  2018. //              
  2019. //              //if (InterfaceType.AVANZATA.equals(ServletUtils.getUserFromSession(this.session).getInterfaceType())) {
  2020. //              de = new DataElement();
  2021. //              de.setType(DataElementType.LINK);
  2022. //              de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM, pIdSogg,pIdPorta, pIdAsps);
  2023. //              ServletUtils.setDataElementCustomLabel(de, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM, statoMTOM);
  2024. //              dati.add(de);
  2025.                 //}
  2026.             }
  2027.         }
  2028.        
  2029.        
  2030.         // *************** Asincroni *********************
  2031.        
  2032.         boolean supportoAsincroni = this.core.isProfiloDiCollaborazioneAsincronoSupportatoDalProtocollo(protocollo,serviceBinding);
  2033.         if(supportoAsincroni) {
  2034.             de = new DataElement();
  2035.             if ( nascondiSezioneOpzioniAvanzate) {
  2036.                 de.setType(DataElementType.HIDDEN);
  2037.             }else{
  2038.                 de.setType(DataElementType.TITLE);
  2039.             }
  2040.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_ASINCRONA );
  2041.             dati.add(de);
  2042.    
  2043.             String[] tipoRicsim = {
  2044.                     PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_ABILITATO,
  2045.                     PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_DISABILITATO
  2046.             };
  2047.             de = new DataElement();
  2048.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RICEVUTA_ASINCRONA_SIMMETRICA);
  2049.             if (nascondiSezioneOpzioniAvanzate) {
  2050.                 de.setType(DataElementType.HIDDEN);
  2051.                 de.setValue(ricsim);
  2052.             }else{
  2053.                 de.setType(DataElementType.SELECT);
  2054.                 de.setValues(tipoRicsim);
  2055.                 de.setSelected(ricsim);
  2056.             }
  2057.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RICEVUTA_ASINCRONA_SIMMETRICA);
  2058.             dati.add(de);
  2059.    
  2060.             String[] tipoRicasim = {
  2061.                     PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_ABILITATO,
  2062.                     PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_DISABILITATO
  2063.             };
  2064.             de = new DataElement();
  2065.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RICEVUTA_ASINCRONA_ASIMMETRICA);
  2066.             if (nascondiSezioneOpzioniAvanzate) {
  2067.                 de.setType(DataElementType.HIDDEN);
  2068.                 de.setValue(ricsim);
  2069.             }else{
  2070.                 de.setType(DataElementType.SELECT);
  2071.                 de.setValues(tipoRicasim);
  2072.                 de.setSelected(ricasim);
  2073.             }
  2074.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RICEVUTA_ASINCRONA_ASIMMETRICA);
  2075.             dati.add(de);
  2076.         }
  2077.        
  2078.        
  2079.        
  2080.        
  2081.        
  2082.        
  2083.        
  2084.         // ***************  SOAP With Attachments *********************

  2085.         boolean viewSoapWithAttachments = this.isModalitaAvanzata() && (!isConfigurazione || datiAltroPorta) && ServiceBinding.SOAP.equals(serviceBinding);
  2086.        
  2087.         if (viewSoapWithAttachments) {

  2088.             de = new DataElement();
  2089.             de.setType(DataElementType.TITLE);
  2090.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOAP_WITH_ATTACHMENTS);
  2091.             dati.add(de);
  2092.            
  2093.         }
  2094.    
  2095.         String[] tipoGestBody = {
  2096.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_BODY_NONE,
  2097.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_BODY_ALLEGA,
  2098.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_BODY_SCARTA
  2099.         };
  2100.         de = new DataElement();
  2101.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_BODY);
  2102.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_GESTIONE_BODY);
  2103.         if (viewSoapWithAttachments) {
  2104.             de.setType(DataElementType.SELECT);
  2105.             de.setValues(tipoGestBody);
  2106.             de.setSelected(gestBody);
  2107.         }
  2108.         else {
  2109.             de.setType(DataElementType.HIDDEN);
  2110.             de.setValue(gestBody);
  2111.         }
  2112.         dati.add(de);

  2113.         String[] tipoGestManifest = {
  2114.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_MANIFEST_DEFAULT,
  2115.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_MANIFEST_ABILITATO,
  2116.                 PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_MANIFEST_DISABILITATO
  2117.         };
  2118.         de = new DataElement();
  2119.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_MANIFEST);
  2120.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_GESTIONE_MANIFEST);
  2121.         if(this.isFunzionalitaProtocolloSupportataDalProtocollo(protocollo, serviceBinding, FunzionalitaProtocollo.MANIFEST_ATTACHMENTS)){
  2122.             if(viewSoapWithAttachments) {
  2123.                 de.setType(DataElementType.SELECT);
  2124.                 de.setValues(tipoGestManifest);
  2125.                 de.setSelected(gestManifest);
  2126.             }
  2127.             else {
  2128.                 de.setType(DataElementType.HIDDEN);
  2129.                 de.setValue(gestManifest);
  2130.             }
  2131.         }else {
  2132.             de.setType(DataElementType.HIDDEN);
  2133.             de.setValue(PorteApplicativeCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_APPLICATIVE_GEST_MANIFEST_DISABILITATO );
  2134.         }
  2135.         dati.add(de);
  2136.            
  2137.        
  2138. //      if(configurazioneStandardNonApplicabile){
  2139. //          this.pd.setMessage(CostantiControlStation.LABEL_CONFIGURAZIONE_IMPOSTATA_MODALITA_AVANZATA_LONG_MESSAGE, Costanti.MESSAGE_TYPE_INFO);
  2140. //          this.pd.disableEditMode();
  2141. //      }
  2142.        

  2143.        
  2144.        
  2145.        
  2146.        
  2147.         // ***************  MESSAGE FACTORY *********************
  2148.        
  2149.         if(!this.isModalitaStandard() && datiAltroApi) {
  2150.             de = new DataElement();
  2151.             de.setType(DataElementType.TITLE);
  2152.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_ENGINE);
  2153.             dati.add(de);
  2154.         }
  2155.        
  2156.         de = new DataElement();
  2157.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_GESTIONE_MESSAGE_ENGINE);
  2158.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_MESSAGE_ENGINE);
  2159.         if(!this.isModalitaStandard() && datiAltroApi) {
  2160.             de.setType(DataElementType.SELECT);
  2161.             List<String> lS = new ArrayList<>();
  2162.             lS.add(CostantiControlStation.GESTIONE_MESSAGE_ENGINE_DEFAULT);
  2163.             lS.addAll(this.porteApplicativeCore.getMessageEngines());
  2164.             de.setValues(lS);
  2165.             if(messageEngine==null || !lS.contains(messageEngine)) {
  2166.                 messageEngine = CostantiControlStation.GESTIONE_MESSAGE_ENGINE_DEFAULT;
  2167.             }
  2168.             de.setSelected(messageEngine);
  2169.         }
  2170.         else {
  2171.             de.setType(DataElementType.HIDDEN);
  2172.             de.setValue(messageEngine);
  2173.         }
  2174.         dati.add(de);


  2175.        
  2176.         return dati;
  2177.     }

  2178.     public List<PortaApplicativaAzioneIdentificazione> getModalitaIdentificazionePorta(String protocollo, ServiceBinding serviceBinding)
  2179.             throws ProtocolException, DriverConfigurazioneException {
  2180.         return getModalitaIdentificazionePorta(protocollo, serviceBinding, ProtocolPropertiesUtilities.getTipoInterfaccia(this));
  2181.     }
  2182.     public List<PortaApplicativaAzioneIdentificazione> getModalitaIdentificazionePorta(String protocollo, ServiceBinding serviceBinding, ConsoleInterfaceType consoleInterfaceType)
  2183.             throws ProtocolException, DriverConfigurazioneException {
  2184.        
  2185.         if(consoleInterfaceType==null) {
  2186.             consoleInterfaceType = ProtocolPropertiesUtilities.getTipoInterfaccia(this);
  2187.         }
  2188.        
  2189.         if(serviceBinding == null) {
  2190.             List<ServiceBinding> serviceBindingListProtocollo = this.core.getServiceBindingListProtocollo(protocollo);
  2191.            
  2192.             List<PortaApplicativaAzioneIdentificazione> listaModalita = new ArrayList<PortaApplicativaAzioneIdentificazione>();
  2193.             if(serviceBindingListProtocollo != null && serviceBindingListProtocollo.size() > 0) {
  2194.                 for (ServiceBinding serviceBinding2 : serviceBindingListProtocollo) {
  2195.                     List<PortaApplicativaAzioneIdentificazione> listaModalitaTmp = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo).
  2196.                             createProtocolIntegrationConfiguration().getAllImplementationIdentificationResourceModes(serviceBinding2,
  2197.                                     consoleInterfaceType );
  2198.                    
  2199.                     for (PortaApplicativaAzioneIdentificazione tipoTmp : listaModalitaTmp) {
  2200.                         if(!listaModalita.contains(tipoTmp))
  2201.                             listaModalita.add(tipoTmp);
  2202.                     }
  2203.                 }
  2204.             }
  2205.             return listaModalita;
  2206.         } else {
  2207.             return ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo).
  2208.                     createProtocolIntegrationConfiguration().getAllImplementationIdentificationResourceModes(serviceBinding,
  2209.                             consoleInterfaceType);
  2210.         }
  2211.     }
  2212.    
  2213.     public void preparePorteAppList(ISearch ricerca, List<PortaApplicativa> lista, int idLista)
  2214.             throws Exception {
  2215.         try {
  2216.             Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);

  2217.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  2218.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  2219.             if(parentPA == null) parentPA = PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE;
  2220.            
  2221.             IExtendedListServlet extendedServletList = this.core.getExtendedServletPortaApplicativa();
  2222.            
  2223.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  2224.            
  2225.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  2226.             if(idAsps == null)
  2227.                 idAsps = "";

  2228.             int limit = ricerca.getPageSize(idLista);
  2229.             int offset = ricerca.getIndexIniziale(idLista);
  2230.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  2231.             this.pd.setIndex(offset);
  2232.             this.pd.setPageSize(limit);
  2233.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  2234.             // setto la barra del titolo
  2235.             List<Parameter> lstParam = new ArrayList<>();
  2236.            
  2237.             boolean useIdSogg = false;
  2238.             switch (parentPA) {
  2239.             case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE:
  2240.                 // In teoria non dovrei mai trovarmi qui
  2241.                
  2242. //              // Prendo il nome e il tipo del servizio
  2243. //              AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(Integer.parseInt(idAsps));
  2244. //              String servizioTmpTile = asps.getTipoSoggettoErogatore() + "/" + asps.getNomeSoggettoErogatore() + "-" + asps.getTipo() + "/" + asps.getNome();
  2245. //              Parameter pIdServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID, asps.getId()+ "");
  2246. //              Parameter pNomeServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SERVIZIO, asps.getNome());
  2247. //              Parameter pTipoServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SERVIZIO, asps.getTipo());
  2248. //              
  2249. //              lstParam.add(new Parameter(AccordiServizioParteSpecificaCostanti.LABEL_APS, null));
  2250. //              lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_ELENCO, AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_LIST));
  2251. //              lstParam.add(new Parameter(servizioTmpTile, AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_CHANGE, pIdServizio,pNomeServizio, pTipoServizio));
  2252. //              
  2253. //              if(search.equals("")){
  2254. //                  this.pd.setSearchDescription("");
  2255. //                  lstParam.add(new Parameter(AccordiServizioParteSpecificaCostanti.LABEL_APS_PORTE_APPLICATIVE,null));
  2256. //              }else{
  2257. //                  lstParam.add(new Parameter(AccordiServizioParteSpecificaCostanti.LABEL_APS_PORTE_APPLICATIVE,
  2258. //                          AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_PORTE_APPLICATIVE_LIST ,pIdServizio));
  2259. //                  lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2260. //              }
  2261.                
  2262.                 break;
  2263.             case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_SOGGETTO:
  2264.                 ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE,
  2265.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, id));
  2266.                 // Prendo il soggetto
  2267.                 String tmpTitle;
  2268.                 if(this.core.isRegistroServiziLocale()){
  2269.                     Soggetto tmpSogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(id));
  2270.                     String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(tmpSogg.getTipo());
  2271.                     tmpTitle = this.getLabelNomeSoggetto(protocollo, tmpSogg.getTipo() , tmpSogg.getNome());
  2272.                 }else{
  2273.                     org.openspcoop2.core.config.Soggetto tmpSogg = this.soggettiCore.getSoggetto(Integer.parseInt(id));
  2274.                     String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(tmpSogg.getTipo());
  2275.                     tmpTitle = this.getLabelNomeSoggetto(protocollo, tmpSogg.getTipo() , tmpSogg.getNome());
  2276.                 }
  2277.                 lstParam.add(new Parameter(SoggettiCostanti.LABEL_SOGGETTI, SoggettiCostanti.SERVLET_NAME_SOGGETTI_LIST));
  2278.                
  2279.                 if(search.equals("")){
  2280.                     this.pd.setSearchDescription("");
  2281.                     lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PORTE_APPLICATIVE_DI + tmpTitle,null));
  2282.                 }else{
  2283.                     lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PORTE_APPLICATIVE_DI + tmpTitle,
  2284.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_LIST ,
  2285.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, id)));
  2286.                     lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2287.                 }
  2288.                 useIdSogg = true;
  2289.                 break;
  2290.             case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE:
  2291.             default:
  2292.                 ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE);
  2293.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_LIST));
  2294.                
  2295.                 if(search.equals("")){
  2296.                     this.pd.setSearchDescription("");
  2297.                 }
  2298.                 else{
  2299.                     lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2300.                 }
  2301.                 break;
  2302.             }
  2303.            
  2304.             if(useIdSogg==false){
  2305.                 addFilterProtocol(ricerca, idLista);
  2306.             }

  2307.             // setto la barra del titolo
  2308.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));

  2309.             // controllo eventuali risultati ricerca
  2310.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  2311.             if (!search.equals("")) {
  2312.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE, search);
  2313.             }

  2314.             boolean showProtocolli = this.core.countProtocolli(this.request, this.session)>1;
  2315.            
  2316.             List<String> listaLabel = new ArrayList<>();

  2317.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  2318.             if(useIdSogg==false){
  2319.                 listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  2320.                 if( showProtocolli ) {
  2321.                     listaLabel.add(CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO);
  2322.                 }
  2323.             }

  2324.             //listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_DESCRIZIONE);
  2325.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZI_APPLICATIVI);
  2326.            
  2327.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI);
  2328.            
  2329.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY);
  2330.             //if(isModalitaAvanzata){
  2331.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM);
  2332.             //}
  2333.             listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA);
  2334.             if((this.isModalitaAvanzata() || this.porteApplicativeCore.isProprietaErogazioniShowModalitaStandard()))
  2335.                 listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES);
  2336. //          if(this.core.isRegistroServiziLocale()){
  2337. //              //listaLabel.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO);
  2338. //              listaLabel.add(AccordiServizioParteSpecificaCostanti.LABEL_APS_MENU_VISUALE_AGGREGATA);
  2339. //          }
  2340.             if(extendedServletList!=null && extendedServletList.showExtendedInfo(this, null)){
  2341.                 listaLabel.add(extendedServletList.getListTitle(this));
  2342.             }
  2343.            
  2344.             listaLabel.add(PorteApplicativeCostanti.LABEL_COLUMN_PORTE_APPLICATIVE_STATO_PORTA);
  2345.            
  2346.             String[] labels = listaLabel.toArray(new String[listaLabel.size()]);
  2347.             this.pd.setLabels(labels);

  2348.             // preparo i dati
  2349.             List<List<DataElement>> dati = new ArrayList<>();

  2350.             if (lista != null) {
  2351.                 Iterator<PortaApplicativa> it = lista.iterator();
  2352.                 while (it.hasNext()) {
  2353.                     PortaApplicativa pa = it.next();

  2354.                     List<DataElement> e = new ArrayList<>();

  2355.                     Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA, pa.getNome());
  2356.                     Parameter pIdNome = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, ""+pa.getNome());
  2357.                     Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, pa.getIdSoggetto() + "");
  2358.                     Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, ""+pa.getId());
  2359.                     Parameter pIdAsps = null;
  2360.                     if(idAsps==null || "".equals(idAsps)) {
  2361.                         IDServizio idServizioObject = IDServizioFactory.getInstance().getIDServizioFromValues(pa.getServizio().getTipo(), pa.getServizio().getNome(),
  2362.                                 pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
  2363.                                 pa.getServizio().getVersione());
  2364.                         AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizioObject);
  2365.                         pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, asps.getId()+"");
  2366.                     }
  2367.                     else {
  2368.                         pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  2369.                     }

  2370.                     String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(pa.getTipoSoggettoProprietario());
  2371.                    
  2372.                     DataElement de = new DataElement();
  2373.                     de.setType(DataElementType.HIDDEN);
  2374.                     de.setValue("" + pa.getId());
  2375.                     e.add(de);

  2376.                     de = new DataElement();
  2377.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CHANGE, pIdSogg, pNomePorta, pIdPorta, pIdAsps);
  2378.                     de.setValue(pa.getNome());
  2379.                     de.setIdToRemove(pa.getId().toString());
  2380.                     de.setToolTip(pa.getDescrizione());
  2381.                     e.add(de);
  2382.                    
  2383.                     if(useIdSogg==false){
  2384.                         de = new DataElement();
  2385.                         de.setValue(this.getLabelNomeSoggetto(protocollo, pa.getTipoSoggettoProprietario() , pa.getNomeSoggettoProprietario()));
  2386.                         e.add(de);
  2387.                        
  2388.                         if( showProtocolli ) {
  2389.                             de = new DataElement();
  2390.                             de.setValue(this.getLabelProtocollo(protocollo));
  2391.                             e.add(de);
  2392.                         }
  2393.                     }
  2394.                    
  2395. //                  de = new DataElement();
  2396. //                  de.setValue(pa.getDescrizione());
  2397. //                  e.add(de);

  2398.                     de = new DataElement();
  2399.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_LIST, pIdSogg, pIdPorta, pIdAsps);
  2400.                     if (contaListe) {
  2401.                         int numSA = pa.sizeServizioApplicativoList();
  2402.                         ServletUtils.setDataElementVisualizzaLabel(de,Long.valueOf(numSA));
  2403.                     } else
  2404.                         ServletUtils.setDataElementVisualizzaLabel(de);
  2405.                     e.add(de);
  2406.                    
  2407.                    
  2408.                     // controllo accessi
  2409.                     de = new DataElement();
  2410.                     //fix: idsogg e' il soggetto proprietario della porta applicativa, e nn il soggetto virtuale
  2411.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI, pIdSogg, pIdPorta, pIdAsps);
  2412.                     String statoControlloAccessi = this.getStatoControlloAccessiPortaApplicativa(protocollo, pa);
  2413.                     de.setValue(statoControlloAccessi);
  2414.                     e.add(de);
  2415.                    

  2416.                     de = new DataElement();
  2417.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY, pIdSogg, pIdPorta,pIdAsps);
  2418.                     de.setValue(pa.getStatoMessageSecurity());
  2419.                     e.add(de);
  2420.                    
  2421.                     //if(isModalitaAvanzata){
  2422.                     de = new DataElement();
  2423.                     de.setUrl(
  2424.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM,pIdPorta, pIdSogg,pIdAsps);

  2425.                     boolean isMTOMAbilitatoReq = false;
  2426.                     boolean isMTOMAbilitatoRes= false;
  2427.                     if(pa.getMtomProcessor()!= null){
  2428.                         if(pa.getMtomProcessor().getRequestFlow() != null){
  2429.                             if(pa.getMtomProcessor().getRequestFlow().getMode() != null){
  2430.                                 MTOMProcessorType mode = pa.getMtomProcessor().getRequestFlow().getMode();
  2431.                                 if(!mode.equals(MTOMProcessorType.DISABLE))
  2432.                                     isMTOMAbilitatoReq = true;
  2433.                             }
  2434.                         }

  2435.                         if(pa.getMtomProcessor().getResponseFlow() != null){
  2436.                             if(pa.getMtomProcessor().getResponseFlow().getMode() != null){
  2437.                                 MTOMProcessorType mode = pa.getMtomProcessor().getResponseFlow().getMode();
  2438.                                 if(!mode.equals(MTOMProcessorType.DISABLE))
  2439.                                     isMTOMAbilitatoRes = true;
  2440.                             }
  2441.                         }
  2442.                     }

  2443.                     if(isMTOMAbilitatoReq || isMTOMAbilitatoRes)
  2444.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_ABILITATO);
  2445.                     else
  2446.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_DISABILITATO);
  2447.                     e.add(de);
  2448.                     //}

  2449.                     de = new DataElement();
  2450.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, pIdSogg, pIdPorta, pIdNome,pIdAsps);
  2451.                    
  2452.                     boolean isCorrelazioneApplicativaAbilitataReq = false;
  2453.                     boolean isCorrelazioneApplicativaAbilitataRes = false;
  2454.                    
  2455.                     if (pa.getCorrelazioneApplicativa() != null)
  2456.                         isCorrelazioneApplicativaAbilitataReq = pa.getCorrelazioneApplicativa().sizeElementoList() > 0;

  2457.                     if (pa.getCorrelazioneApplicativaRisposta() != null)
  2458.                         isCorrelazioneApplicativaAbilitataRes = pa.getCorrelazioneApplicativaRisposta().sizeElementoList() > 0;
  2459.                    
  2460.                     if(isCorrelazioneApplicativaAbilitataReq || isCorrelazioneApplicativaAbilitataRes)
  2461.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_ABILITATA);
  2462.                     else
  2463.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_DISABILITATA);
  2464.                     e.add(de);

  2465.                     if((this.isModalitaAvanzata() || this.porteApplicativeCore.isProprietaErogazioniShowModalitaStandard())){
  2466.                         de = new DataElement();
  2467.                         de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_PROPRIETA_PROTOCOLLO_LIST, pIdSogg, pIdPorta, pIdAsps);
  2468.                         if (contaListe) {
  2469.                             int numProp = pa.sizeProprietaList();
  2470.                             ServletUtils.setDataElementVisualizzaLabel(de,Long.valueOf(numProp));
  2471.                         } else
  2472.                             ServletUtils.setDataElementVisualizzaLabel(de);
  2473.                         e.add(de);
  2474.                     }

  2475. //                  if(this.core.isRegistroServiziLocale()){
  2476. //                      /*
  2477. //                       * Visualizzo SoggettoErogatore/Servizio I soggetti
  2478. //                       * erogatori possono essere identificati con due casi 1. PA
  2479. //                       * che hanno soggetto proprietario, servizio e non hanno
  2480. //                       * definito il soggetto virtuale. In questo caso il soggetto
  2481. //                       * erogatore e' il soggetto proprietario. 2. PA che hanno un
  2482. //                       * soggetto virtuale. In questo caso il soggetto erogatore
  2483. //                       * e' il soggetto virtuale
  2484. //                       */
  2485. //                      int idSoggEr = 0;
  2486. //                      PortaApplicativaSoggettoVirtuale pasv = pa.getSoggettoVirtuale();
  2487. //                      if (pasv != null)
  2488. //                          idSoggEr = pasv.getId().intValue();
  2489. //                      else
  2490. //                          idSoggEr = pa.getIdSoggetto().intValue();
  2491. //                      PortaApplicativaServizio pas = pa.getServizio();
  2492. //                      int idServ = pas.getId().intValue();
  2493. //                      Soggetto soggEr = null;
  2494. //                      AccordoServizioParteSpecifica asps = null;
  2495. //                      try {
  2496. //                          soggEr = this.soggettiCore.getSoggettoRegistro(idSoggEr);
  2497. //                          asps = this.apsCore.getAccordoServizioParteSpecifica(idServ);
  2498. //                      } catch (DriverRegistroServiziNotFound drsnf) {
  2499. //                          // ok
  2500. //                      } catch (DriverRegistroServiziException drse) {
  2501. //                          // ok
  2502. //                      }
  2503. //                      String tmpAz = "";
  2504. //                      PortaApplicativaAzione paa = pa.getAzione();
  2505. //                      if (paa != null && paa.getNome()!=null)
  2506. //                          tmpAz = "-" + paa.getNome();
  2507. //                      de = new DataElement();
  2508. //                      Parameter pId2 = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID, ""+ idServ);
  2509. //                      Parameter pNomeServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SERVIZIO, asps.getNome());
  2510. //                      Parameter pTipoServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SERVIZIO, asps.getTipo());
  2511. //                      Parameter pVersioneServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_VERSIONE, asps.getVersione().intValue()+"");
  2512. //
  2513. //                      de.setUrl(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_CHANGE,
  2514. //                              pId2, pNomeServizio, pTipoServizio, pVersioneServizio);
  2515. //                      IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(asps.getTipo(), asps.getNome(),
  2516. //                              soggEr.getTipo(),soggEr.getNome(),
  2517. //                              asps.getVersione());
  2518. //                      de.setValue(IDServizioFactory.getInstance().getUriFromIDServizio(idServizio) + tmpAz);
  2519. //
  2520. //                      e.add(de);
  2521. //                  }

  2522.                    
  2523.                     if(extendedServletList!=null && extendedServletList.showExtendedInfo(this, null)){
  2524.                         de = new DataElement();
  2525.                         de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_EXTENDED_LIST,
  2526.                                 pIdPorta,pIdNome,pIdPorta, pIdSogg, pIdAsps
  2527.                                 );
  2528.                         if (contaListe) {
  2529.                             int numExtended = extendedServletList.sizeList(pa);
  2530.                             ServletUtils.setDataElementVisualizzaLabel(de,Long.valueOf(numExtended));
  2531.                         } else
  2532.                             ServletUtils.setDataElementVisualizzaLabel(de);
  2533.                         e.add(de);
  2534.                     }
  2535.                    
  2536.                     de = new DataElement();
  2537.                     boolean abilitatoPorta = pa.getStato()!=null ? CostantiConfigurazione.ABILITATO.equals(pa.getStato()) : true;
  2538.                     de.setType(DataElementType.CHECKBOX);
  2539.                     de.setSelected(abilitatoPorta);
  2540.                     de.setToolTip(abilitatoPorta?CostantiConfigurazione.ABILITATO.getValue():CostantiConfigurazione.DISABILITATO.getValue());
  2541.                     de.setValue(abilitatoPorta+"");
  2542.                     e.add(de);
  2543.                    
  2544.                     dati.add(e);
  2545.                 }
  2546.             }

  2547.             this.pd.setDati(dati);
  2548.             // le porte applicative non si possono piu' creare dalle liste PA e PA di un soggetto
  2549.             if(!this.isModalitaCompleta() || !useIdSogg) {
  2550.                 this.pd.setAddButton(false);
  2551.             }
  2552.            
  2553.             if (useIdSogg){
  2554.                 if(this.isModalitaStandard()){
  2555.                     this.pd.setRemoveButton(false);
  2556.                     this.pd.setSelect(false);
  2557.                 }
  2558.             }

  2559.         } catch (Exception e) {
  2560.             this.logError(e.getMessage(), e);
  2561.             throw new ControlStationCoreException(e.getMessage(),e);
  2562.         }
  2563.     }

  2564.     // Prepara la lista di  properties delle porte applicative
  2565.     public void preparePorteAppPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista)
  2566.             throws Exception {
  2567.         try {
  2568.             if(nomePorta!=null) {
  2569.                 // nop
  2570.             }
  2571.            
  2572.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  2573.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);

  2574.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  2575.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  2576.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  2577.             if(idAsps == null)
  2578.                 idAsps = "";

  2579.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_PROPRIETA_PROTOCOLLO,
  2580.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2581.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2582.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  2583.             int idLista = Liste.PORTE_APPLICATIVE_PROP;
  2584.             int limit = ricerca.getPageSize(idLista);
  2585.             int offset = ricerca.getIndexIniziale(idLista);
  2586.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  2587.             this.pd.setIndex(offset);
  2588.             this.pd.setPageSize(limit);
  2589.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  2590.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  2591.             String idporta = myPA.getNome();

  2592.             // setto la barra del titolo
  2593.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  2594.            
  2595.             String labelPerPorta = null;
  2596.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  2597.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  2598.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES_CONFIG_DI,
  2599.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES,
  2600.                         myPA);
  2601.             }
  2602.             else {
  2603.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES_CONFIG_DI+idporta;
  2604.             }
  2605.            
  2606.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  2607.             if(search.equals("")){
  2608.                 this.pd.setSearchDescription("");
  2609.                 lstParam.add(new Parameter(labelPerPorta,null));
  2610.             }else{
  2611.                 lstParam.add(new Parameter(labelPerPorta,
  2612.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_PROPRIETA_PROTOCOLLO_LIST ,
  2613.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2614.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2615.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  2616.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2617.             }

  2618.             // setto la barra del titolo
  2619.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  2620.            
  2621.             // imposta menu' contestuale
  2622.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  2623.             // controllo eventuali risultati ricerca
  2624.             if (!search.equals("")) {
  2625.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES, search);
  2626.             }

  2627.             // setto le label delle colonne
  2628.             String valueLabel = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE;
  2629.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME, valueLabel };
  2630.             this.pd.setLabels(labels);

  2631.             // preparo i dati
  2632.             List<List<DataElement>> dati = new ArrayList<>();

  2633.             if (lista != null) {
  2634.                 Iterator<Proprieta> it = lista.iterator();
  2635.                 while (it.hasNext()) {
  2636.                     Proprieta ssp = it.next();

  2637.                     List<DataElement> e = new ArrayList<>();

  2638.                     DataElement de = new DataElement();
  2639.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_PROPRIETA_PROTOCOLLO_CHANGE,
  2640.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2641.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2642.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, ssp.getNome()),
  2643.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  2644.                     de.setValue(ssp.getNome());
  2645.                     de.setIdToRemove(ssp.getNome());
  2646.                     de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
  2647.                     e.add(de);

  2648.                     de = new DataElement();
  2649.                     if(ssp.getValore()!=null) {
  2650.                         if(StringUtils.isNotEmpty(ssp.getValore()) &&
  2651.                                 BYOKManager.isEnabledBYOK() &&
  2652.                                 this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(ssp.getValore())) {
  2653.                             de.setValue(CostantiControlStation.VALORE_CIFRATO);
  2654.                         }
  2655.                         else {
  2656.                             de.setValue(ssp.getValore());
  2657.                         }
  2658.                     }
  2659.                     e.add(de);

  2660.                     dati.add(e);
  2661.                 }
  2662.             }

  2663.             this.pd.setDati(dati);
  2664.             this.pd.setAddButton(true);

  2665.         } catch (Exception e) {
  2666.             this.logError(e.getMessage(), e);
  2667.             throw new ControlStationCoreException(e.getMessage(),e);
  2668.         }
  2669.     }


  2670.     // Prepara la lista di sil delle porte applicative
  2671.     public void preparePorteAppServizioApplicativoList(String nomePorta, ISearch ricerca, List<ServizioApplicativo> lista)
  2672.             throws Exception {
  2673.         try {

  2674.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  2675.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  2676.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  2677.             if(idAsps == null)
  2678.                 idAsps = "";

  2679.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  2680.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  2681.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO,
  2682.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2683.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2684.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  2685.             int idLista = Liste.PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO;
  2686.             int limit = ricerca.getPageSize(idLista);
  2687.             int offset = ricerca.getIndexIniziale(idLista);
  2688.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  2689.             this.pd.setIndex(offset);
  2690.             this.pd.setPageSize(limit);
  2691.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  2692.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  2693.             String idporta = myPA.getNome();

  2694.             // setto la barra del titolo
  2695.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  2696.            
  2697.             String labelPerPorta = null;
  2698.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  2699.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  2700.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_CONFIG_DI,
  2701.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO,
  2702.                         myPA);
  2703.             }
  2704.             else {
  2705.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_CONFIG_DI+idporta;
  2706.             }
  2707.            
  2708.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  2709.             if(search.equals("")){
  2710.                 this.pd.setSearchDescription("");
  2711.                 lstParam.add(new Parameter(labelPerPorta,null));
  2712.             }else{
  2713.                 lstParam.add(new Parameter(labelPerPorta,
  2714.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_LIST ,
  2715.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2716.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2717.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  2718.                
  2719.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2720.             }

  2721.             // setto la barra del titolo
  2722.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  2723.            
  2724.             // imposta menu' contestuale
  2725.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  2726.             // controllo eventuali risultati ricerca
  2727.             if (!search.equals("")) {
  2728.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZI_APPLICATIVI, search);
  2729.             }

  2730.             // setto le label delle colonne
  2731.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO};
  2732.             this.pd.setLabels(labels);

  2733.             // preparo i dati
  2734.             List<List<DataElement>> dati = new ArrayList<>();

  2735.             if (lista != null) {
  2736.                 Iterator<ServizioApplicativo> it = lista.iterator();
  2737.                 while (it.hasNext()) {
  2738.                     ServizioApplicativo sa = it.next();

  2739.                     List<DataElement> e = new ArrayList<>();

  2740.                     DataElement de = new DataElement();
  2741.                     de.setUrl(
  2742.                             ServiziApplicativiCostanti.SERVLET_NAME_SERVIZI_APPLICATIVI_CHANGE,
  2743.                             new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_ID, ""+sa.getId()),
  2744.                             new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_PROVIDER, ""+idsogg),
  2745.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  2746.                     de.setValue(sa.getNome());
  2747.                     de.setIdToRemove(sa.getNome());
  2748.                     e.add(de);

  2749.                     dati.add(e);
  2750.                 }
  2751.             }

  2752.             this.pd.setDati(dati);
  2753.             this.pd.setAddButton(true);

  2754.         } catch (Exception e) {
  2755.             this.logError(e.getMessage(), e);
  2756.             throw new ControlStationCoreException(e.getMessage(),e);
  2757.         }
  2758.     }

  2759.     public void preparePorteApplicativeCorrAppList(String nomePorta, ISearch ricerca, List<CorrelazioneApplicativaElemento> lista)
  2760.             throws Exception {
  2761.         try {

  2762.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  2763.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  2764.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  2765.             if(idAsps == null)
  2766.                 idAsps = "";

  2767.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  2768.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  2769.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_REQUEST,
  2770.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2771.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2772.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  2773.             int idLista = Liste.PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA;
  2774.             int limit = ricerca.getPageSize(idLista);
  2775.             int offset = ricerca.getIndexIniziale(idLista);
  2776.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  2777.             this.pd.setIndex(offset);
  2778.             this.pd.setPageSize(limit);
  2779.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  2780.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  2781.             String idporta = myPA.getNome();

  2782.             // setto la barra del titolo
  2783.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  2784.             String labelPerPorta = null;
  2785.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  2786.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  2787.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_CONFIG_DI,
  2788.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRACCIAMENTO,
  2789.                         myPA);
  2790.             }
  2791.             else {
  2792.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_CONFIG_DI+idporta;
  2793.             }
  2794.             lstParam.add(new Parameter(labelPerPorta,
  2795.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA,
  2796.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2797.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2798.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, idporta),
  2799.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2800.                     ));
  2801.            
  2802.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  2803.             if(search.equals("")){
  2804.                 this.pd.setSearchDescription("");
  2805.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RICHIESTA_DI, // + idporta,
  2806.                         null));
  2807.             }else{
  2808.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RICHIESTA_DI, // + idporta,
  2809.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_REQUEST_LIST ,
  2810.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2811.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2812.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, idporta),
  2813.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2814.                         ));
  2815.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2816.             }

  2817.             // setto la barra del titolo
  2818.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  2819.            
  2820.             // imposta menu' contestuale
  2821.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  2822.             // controllo eventuali risultati ricerca
  2823.             if (!search.equals("")) {
  2824.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RICHIESTA_DI, search);
  2825.             }

  2826.             // setto le label delle colonne
  2827.             String[] labels = {
  2828.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML,
  2829.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE
  2830.             };
  2831.             this.pd.setLabels(labels);

  2832.             // preparo i dati
  2833.             List<List<DataElement>> dati = new ArrayList<>();

  2834.             if (lista != null) {
  2835.                 Iterator<CorrelazioneApplicativaElemento> it = lista.iterator();
  2836.                 while (it.hasNext()) {
  2837.                     CorrelazioneApplicativaElemento cae = it.next();

  2838.                     List<DataElement> e = new ArrayList<>();

  2839.                     DataElement de = new DataElement();
  2840.                     de.setType(DataElementType.HIDDEN);
  2841.                     de.setValue("" + cae.getId());
  2842.                     e.add(de);

  2843.                     de = new DataElement();
  2844.                     de.setUrl(
  2845.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_REQUEST_CHANGE,
  2846.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2847.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2848.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_CORRELAZIONE_APPLICATIVA, "" + cae.getId()),
  2849.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2850.                             );
  2851.                     //String nomeElemento = "(*)";
  2852.                     String nomeElemento = CostantiControlStation.LABEL_PORTE_CORRELAZIONE_APPLICATIVA_QUALSIASI;
  2853.                     if (cae.getNome() != null && !"".equals(cae.getNome()))
  2854.                         nomeElemento = cae.getNome();
  2855.                     de.setValue(nomeElemento);
  2856.                     de.setIdToRemove("" + cae.getId());
  2857.                     e.add(de);

  2858.                     de = new DataElement();
  2859.                     if(cae.getIdentificazione()!=null) {
  2860.                         //de.setValue(cae.getIdentificazione().toString());
  2861.                         switch (cae.getIdentificazione()) {
  2862.                         case DISABILITATO:
  2863.                             de.setValue(CostantiControlStation.LABEL_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO);
  2864.                             break;
  2865.                         case HEADER_BASED:
  2866.                             de.setValue(ModalitaIdentificazione.HEADER_BASED.getLabel());
  2867.                             break;
  2868.                         case URL_BASED:
  2869.                             de.setValue(ModalitaIdentificazione.URL_BASED.getLabel());
  2870.                             break;
  2871.                         case CONTENT_BASED:
  2872.                             de.setValue(ModalitaIdentificazione.CONTENT_BASED.getLabel());
  2873.                             break;
  2874.                         case INPUT_BASED:
  2875.                             de.setValue(ModalitaIdentificazione.INPUT_BASED.getLabel());
  2876.                             break;
  2877.                         case TEMPLATE:
  2878.                             de.setValue(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  2879.                             break;
  2880.                         case FREEMARKER_TEMPLATE:
  2881.                             de.setValue(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  2882.                             break;
  2883.                         case VELOCITY_TEMPLATE:
  2884.                             de.setValue(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  2885.                             break;
  2886.                         }
  2887.                     }
  2888.                     e.add(de);

  2889.                     dati.add(e);
  2890.                 }
  2891.             }

  2892.             this.pd.setDati(dati);
  2893.             this.pd.setAddButton(true);
  2894.         } catch (Exception e) {
  2895.             this.logError(e.getMessage(), e);
  2896.             throw new ControlStationCoreException(e.getMessage(),e);
  2897.         }
  2898.     }


  2899.     public void preparePorteApplicativeCorrAppRispostaList(String nomePorta, ISearch ricerca, List<CorrelazioneApplicativaRispostaElemento> lista)
  2900.             throws Exception {
  2901.         try {

  2902.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  2903.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  2904.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  2905.             if(idAsps == null)
  2906.                 idAsps = "";

  2907.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  2908.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  2909.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RESPONSE,
  2910.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2911.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2912.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  2913.             int idLista = Liste.PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RISPOSTA;
  2914.             int limit = ricerca.getPageSize(idLista);
  2915.             int offset = ricerca.getIndexIniziale(idLista);
  2916.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  2917.             this.pd.setIndex(offset);
  2918.             this.pd.setPageSize(limit);
  2919.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  2920.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  2921.             String idporta = myPA.getNome();

  2922.             // setto la barra del titolo
  2923.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  2924.             String labelPerPorta = null;
  2925.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  2926.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  2927.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_CONFIG_DI,
  2928.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRACCIAMENTO,
  2929.                         myPA);
  2930.             }
  2931.             else {
  2932.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_CONFIG_DI+idporta;
  2933.             }
  2934.             lstParam.add(new Parameter(labelPerPorta,
  2935.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA,
  2936.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2937.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2938.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, idporta),
  2939.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2940.                     ));
  2941.            
  2942.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  2943.             if(search.equals("")){
  2944.                 this.pd.setSearchDescription("");
  2945.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RISPOSTA_DI, // + idporta,
  2946.                         null));
  2947.             }else{
  2948.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RISPOSTA_DI, // + idporta,
  2949.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RESPONSE_LIST ,
  2950.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2951.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2952.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, idporta),
  2953.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2954.                         ));
  2955.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  2956.             }

  2957.             // setto la barra del titolo
  2958.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));

  2959.             // imposta menu' contestuale
  2960.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  2961.             // controllo eventuali risultati ricerca
  2962.             if (!search.equals("")) {
  2963.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONI_APPLICATIVE_RISPOSTA_DI, search);
  2964.             }

  2965.             // setto le label delle colonne
  2966.             String[] labels = {
  2967.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML,
  2968.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE
  2969.             };
  2970.             this.pd.setLabels(labels);

  2971.             // preparo i dati
  2972.             List<List<DataElement>> dati = new ArrayList<>();

  2973.             if (lista != null) {
  2974.                 Iterator<CorrelazioneApplicativaRispostaElemento> it = lista.iterator();
  2975.                 while (it.hasNext()) {
  2976.                     CorrelazioneApplicativaRispostaElemento cae = it.next();

  2977.                     List<DataElement> e = new ArrayList<>();

  2978.                     DataElement de = new DataElement();
  2979.                     de.setType(DataElementType.HIDDEN);
  2980.                     de.setValue("" + cae.getId());
  2981.                     e.add(de);

  2982.                     de = new DataElement();
  2983.                     de.setUrl(
  2984.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RESPONSE_CHANGE,
  2985.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  2986.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  2987.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_CORRELAZIONE_APPLICATIVA, cae.getId() + ""),
  2988.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  2989.                             );
  2990.                     //String nomeElemento = "(*)";
  2991.                     String nomeElemento = CostantiControlStation.LABEL_PORTE_CORRELAZIONE_APPLICATIVA_QUALSIASI;
  2992.                     if (cae.getNome() != null && !"".equals(cae.getNome()))
  2993.                         nomeElemento = cae.getNome();
  2994.                     de.setValue(nomeElemento);
  2995.                     de.setIdToRemove("" + cae.getId());
  2996.                     e.add(de);

  2997.                     de = new DataElement();
  2998.                     if(cae.getIdentificazione()!=null) {
  2999.                         //de.setValue(cae.getIdentificazione().toString());
  3000.                         switch (cae.getIdentificazione()) {
  3001.                         case DISABILITATO:
  3002.                             de.setValue(CostantiControlStation.LABEL_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO);
  3003.                             break;
  3004.                         case HEADER_BASED:
  3005.                             de.setValue(ModalitaIdentificazione.HEADER_BASED.getLabel());
  3006.                             break;
  3007.                         case CONTENT_BASED:
  3008.                             de.setValue(ModalitaIdentificazione.CONTENT_BASED.getLabel());
  3009.                             break;
  3010.                         case INPUT_BASED:
  3011.                             de.setValue(ModalitaIdentificazione.INPUT_BASED.getLabel());
  3012.                             break;
  3013.                         case TEMPLATE:
  3014.                             de.setValue(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  3015.                             break;
  3016.                         case FREEMARKER_TEMPLATE:
  3017.                             de.setValue(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  3018.                             break;
  3019.                         case VELOCITY_TEMPLATE:
  3020.                             de.setValue(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  3021.                             break;
  3022.                         }
  3023.                     }
  3024.                     e.add(de);

  3025.                     dati.add(e);
  3026.                 }
  3027.             }

  3028.             this.pd.setDati(dati);
  3029.             this.pd.setAddButton(true);
  3030.         } catch (Exception e) {
  3031.             this.logError(e.getMessage(), e);
  3032.             throw new ControlStationCoreException(e.getMessage(),e);
  3033.         }
  3034.     }


  3035.     // Prepara la lista di Message-Security request-flow delle porte applicative
  3036.     public void preparePorteAppMessageSecurityRequestList(String nomePorta, ISearch ricerca, List<MessageSecurityFlowParameter> lista)
  3037.             throws Exception {
  3038.         try {
  3039.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  3040.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  3041.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  3042.             if(idAsps == null)
  3043.                 idAsps = "";

  3044.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  3045.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  3046.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST,
  3047.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3048.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3049.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  3050.             int idLista = Liste.PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST;
  3051.             int limit = ricerca.getPageSize(idLista);
  3052.             int offset = ricerca.getIndexIniziale(idLista);
  3053.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  3054.             this.pd.setIndex(offset);
  3055.             this.pd.setPageSize(limit);
  3056.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  3057.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  3058.             String idporta = myPA.getNome();

  3059.             // setto la barra del titolo
  3060.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  3061.             String labelPerPorta = null;
  3062.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  3063.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  3064.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_CONFIG_DI,
  3065.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY,
  3066.                         myPA);
  3067.             }
  3068.             else {
  3069.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_CONFIG_DI+idporta;
  3070.             }
  3071.             lstParam.add(new Parameter(labelPerPorta,
  3072.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY ,
  3073.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3074.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3075.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  3076.            
  3077.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3078.             if(search.equals("")){
  3079.                 this.pd.setSearchDescription("");
  3080.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST_FLOW_DI, // + idporta,
  3081.                         null));
  3082.             }else{
  3083.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST_FLOW_DI, // + idporta,
  3084.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST_LIST ,
  3085.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3086.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3087.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3088.                         ));
  3089.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  3090.             }

  3091.             // setto la barra del titolo
  3092.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  3093.            
  3094.             // imposta menu' contestuale
  3095.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  3096.             // controllo eventuali risultati ricerca
  3097.             if (!search.equals("")) {
  3098.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST_FLOW_DI, search);
  3099.             }

  3100.             // setto le label delle colonne
  3101.             String[] labels = {
  3102.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME,
  3103.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE
  3104.             };
  3105.             this.pd.setLabels(labels);

  3106.             // preparo i dati
  3107.             List<List<DataElement>> dati = new ArrayList<>();

  3108.             if (lista != null) {
  3109.                 Iterator<MessageSecurityFlowParameter> it = lista.iterator();
  3110.                 while (it.hasNext()) {
  3111.                     MessageSecurityFlowParameter wsrfp = it.next();

  3112.                     List<DataElement> e = new ArrayList<>();

  3113.                     DataElement de = new DataElement();
  3114.                     de.setUrl(
  3115.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_REQUEST_CHANGE,
  3116.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3117.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3118.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, wsrfp.getNome()),
  3119.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  3120.                     de.setValue(wsrfp.getNome());
  3121.                     de.setIdToRemove(wsrfp.getNome());
  3122.                     e.add(de);

  3123.                     de = new DataElement();
  3124.                     if(wsrfp.getValore()!=null && StringUtils.isNotEmpty(wsrfp.getValore()) &&
  3125.                             BYOKManager.isEnabledBYOK() &&
  3126.                             this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(wsrfp.getValore())) {
  3127.                         de.setValue(CostantiControlStation.VALORE_CIFRATO);
  3128.                     }
  3129.                     else {
  3130.                         de.setValue(wsrfp.getValore());
  3131.                     }
  3132.                     e.add(de);

  3133.                     dati.add(e);
  3134.                 }
  3135.             }

  3136.             this.pd.setDati(dati);
  3137.             this.pd.setAddButton(true);

  3138.         } catch (Exception e) {
  3139.             this.logError(e.getMessage(), e);
  3140.             throw new ControlStationCoreException(e.getMessage(),e);
  3141.         }
  3142.     }

  3143.     // Prepara la lista di Message-Security response-flow delle porte applicative
  3144.     public void preparePorteAppMessageSecurityResponseList(String nomePorta, ISearch ricerca, List<MessageSecurityFlowParameter> lista)
  3145.             throws Exception {
  3146.         try {
  3147.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  3148.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  3149.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  3150.             if(idAsps == null)
  3151.                 idAsps = "";

  3152.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  3153.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  3154.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE,
  3155.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3156.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3157.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  3158.             int idLista = Liste.PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE;
  3159.             int limit = ricerca.getPageSize(idLista);
  3160.             int offset = ricerca.getIndexIniziale(idLista);
  3161.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  3162.             this.pd.setIndex(offset);
  3163.             this.pd.setPageSize(limit);
  3164.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  3165.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  3166.             String idporta = myPA.getNome();

  3167.             // setto la barra del titolo
  3168.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  3169.            
  3170.             String labelPerPorta = null;
  3171.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  3172.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  3173.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_CONFIG_DI,
  3174.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY,
  3175.                         myPA);
  3176.             }
  3177.             else {
  3178.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_CONFIG_DI+idporta;
  3179.             }
  3180.             lstParam.add(new Parameter(labelPerPorta,
  3181.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY ,
  3182.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3183.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3184.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  3185.            
  3186.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3187.             if(search.equals("")){
  3188.                 this.pd.setSearchDescription("");
  3189.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE_FLOW_DI, // + idporta,
  3190.                         null));
  3191.             }else{
  3192.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE_FLOW_DI, // + idporta,
  3193.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE_LIST ,
  3194.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3195.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3196.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3197.                         ));
  3198.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  3199.             }

  3200.             // setto la barra del titolo
  3201.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  3202.            
  3203.             // imposta menu' contestuale
  3204.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  3205.             // controllo eventuali risultati ricerca
  3206.             if (!search.equals("")) {
  3207.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE_FLOW_DI, search);
  3208.             }

  3209.             // setto le label delle colonne
  3210.             String[] labels = {PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME,
  3211.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE };
  3212.             this.pd.setLabels(labels);

  3213.             // preparo i dati
  3214.             List<List<DataElement>> dati = new ArrayList<>();

  3215.             if (lista != null) {
  3216.                 Iterator<MessageSecurityFlowParameter> it = lista.iterator();
  3217.                 while (it.hasNext()) {
  3218.                     MessageSecurityFlowParameter wsrfp = it.next();

  3219.                     List<DataElement> e = new ArrayList<>();

  3220.                     DataElement de = new DataElement();
  3221.                     de.setUrl(
  3222.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MESSAGE_SECURITY_RESPONSE_CHANGE,
  3223.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3224.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3225.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, wsrfp.getNome()),
  3226.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3227.                             );
  3228.                     de.setValue(wsrfp.getNome());
  3229.                     de.setIdToRemove(wsrfp.getNome());
  3230.                     e.add(de);

  3231.                     de = new DataElement();
  3232.                     if(wsrfp.getValore()!=null && StringUtils.isNotEmpty(wsrfp.getValore()) &&
  3233.                             BYOKManager.isEnabledBYOK() &&
  3234.                             this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(wsrfp.getValore())) {
  3235.                         de.setValue(CostantiControlStation.VALORE_CIFRATO);
  3236.                     }
  3237.                     else {
  3238.                         de.setValue(wsrfp.getValore());
  3239.                     }
  3240.                     e.add(de);

  3241.                     dati.add(e);
  3242.                 }
  3243.             }

  3244.             this.pd.setDati(dati);
  3245.             this.pd.setAddButton(true);

  3246.         } catch (Exception e) {
  3247.             this.logError(e.getMessage(), e);
  3248.             throw new ControlStationCoreException(e.getMessage(),e);
  3249.         }
  3250.     }
  3251.    
  3252.    
  3253.    
  3254.     // Prepara la lista di soggetti associati alla pa
  3255.     public void preparePorteAppSoggettoList(String nomePorta, ISearch ricerca, List<PortaApplicativaAutorizzazioneSoggetto> lista) throws Exception {
  3256.         try {
  3257.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  3258.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  3259.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  3260.             if(idAsps == null)
  3261.                 idAsps = "";

  3262.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  3263.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  3264.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_SOGGETTO,
  3265.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3266.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3267.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  3268.             int idLista = Liste.PORTE_APPLICATIVE_SOGGETTO;
  3269.             int limit = ricerca.getPageSize(idLista);
  3270.             int offset = ricerca.getIndexIniziale(idLista);
  3271.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  3272.             this.pd.setIndex(offset);
  3273.             this.pd.setPageSize(limit);
  3274.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  3275.             String protocollo = null;
  3276.             if(this.core.isRegistroServiziLocale()){
  3277.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  3278.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  3279.             }
  3280.             else{
  3281.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  3282.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  3283.             }

  3284.             boolean modipa = this.porteApplicativeCore.isProfiloModIPA(protocollo);
  3285.            
  3286.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  3287.             String idporta = myPA.getNome();

  3288.             // setto la barra del titolo
  3289.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  3290.             String labelPerPorta = null;
  3291.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  3292.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  3293.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  3294.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  3295.                         myPA);
  3296.             }
  3297.             else {
  3298.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  3299.             }
  3300.            
  3301.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  3302.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3303.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3304.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  3305.            
  3306.             String labelPag =
  3307.                     (
  3308.                             modipa ?
  3309.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE
  3310.                             :
  3311.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO
  3312.                     )
  3313.                     + " - " +
  3314.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO_CONFIG;
  3315.            
  3316.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3317.             if(search.equals("")){
  3318.                 this.pd.setSearchDescription("");
  3319.                 lstParam.add(new Parameter(labelPag,null));
  3320.             }else{
  3321.                 lstParam.add(new Parameter(labelPag,
  3322.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_SOGGETTO_LIST ,
  3323.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3324.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3325.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  3326.                
  3327.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  3328.             }

  3329.             // setto la barra del titolo
  3330.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));

  3331.             // imposta menu' contestuale
  3332.             this.impostaComandiMenuContestualePA(idsogg, idAsps);
  3333.                        
  3334.             // controllo eventuali risultati ricerca
  3335. //          if (!search.equals("")) {
  3336. //              this.pd.setSearch("on");
  3337. //              this.pd.setSearchDescription("Soggetti contenenti la stringa '" + search + "'");
  3338. //          }

  3339.             // setto le label delle colonne
  3340.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO};
  3341.             this.pd.setLabels(labels);

  3342.             // preparo i dati
  3343.             List<List<DataElement>> dati = new ArrayList<>();

  3344.             if (lista != null) {
  3345.                 Iterator<PortaApplicativaAutorizzazioneSoggetto> it = lista.iterator();
  3346.                 while (it.hasNext()) {
  3347.                     PortaApplicativaAutorizzazioneSoggetto sog = it.next();

  3348.                     List<DataElement> e = new ArrayList<>();

  3349.                     Long idSoggetto =this.soggettiCore.getIdSoggetto(sog.getNome(), sog.getTipo());
  3350.                     DataElement de = new DataElement();
  3351.                     String labelNomeSoggetto = this.getLabelNomeSoggetto(protocollo, sog.getTipo() , sog.getNome());
  3352.                    
  3353.                     String url = new Parameter("", SoggettiCostanti.SERVLET_NAME_SOGGETTI_CHANGE,
  3354.                             new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID,idSoggetto+""),
  3355.                             new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_NOME,sog.getNome()),
  3356.                             new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_TIPO,sog.getTipo())).getValue();
  3357.                     if(this.isModalitaCompleta()) {
  3358.                         de.setUrl(url);
  3359.                     }else {
  3360.                         this.newDataElementVisualizzaInNuovoTab(de, url, labelNomeSoggetto);
  3361.                     }
  3362.                     de.setValue(labelNomeSoggetto);
  3363.                     de.setIdToRemove(sog.getTipo() + "/" + sog.getNome());
  3364.                     e.add(de);

  3365.                     dati.add(e);
  3366.                 }
  3367.             }

  3368.             this.pd.setDati(dati);
  3369.             this.pd.setAddButton(true);

  3370.         } catch (Exception e) {
  3371.             this.logError(e.getMessage(), e);
  3372.             throw new ControlStationCoreException(e.getMessage(),e);
  3373.         }
  3374.     }

  3375.     public void preparePorteAppServizioApplicativoAutorizzatoList(String nomePorta, ISearch ricerca, List<PortaApplicativaAutorizzazioneServizioApplicativo> lista) throws Exception {
  3376.         try {
  3377.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  3378.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  3379.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  3380.             if(idAsps == null)
  3381.                 idAsps = "";

  3382.             String idPorta = this.request.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  3383.             String idsogg = this.request.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  3384.             String autorizzazioneModi = this.request.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA);
  3385.             String token = this.request.getParameter(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION);
  3386.             //boolean modipaEnabled = "true".equalsIgnoreCase(modipa);
  3387.            
  3388.             List<Parameter> listP = new ArrayList<>();
  3389.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta));
  3390.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg));
  3391.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  3392.             if(token!=null) {
  3393.                 listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TOKEN_AUTHORIZATION, token));
  3394.             }
  3395.             if(autorizzazioneModi!=null) {
  3396.                 listP.add(new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, autorizzazioneModi));
  3397.             }
  3398.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_AUTORIZZATO,
  3399.                     listP);

  3400.             boolean isToken = token!=null && !"".equals(token) && Boolean.valueOf(token);
  3401.             boolean isAutorizzazioneModi = autorizzazioneModi!=null && !"".equals(autorizzazioneModi) && Boolean.valueOf(autorizzazioneModi);
  3402.            
  3403.             String protocollo = null;
  3404.             if(this.core.isRegistroServiziLocale()){
  3405.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  3406.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  3407.             }
  3408.             else{
  3409.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  3410.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  3411.             }
  3412.             boolean modi = this.porteApplicativeCore.isProfiloModIPA(protocollo);
  3413.            
  3414.             boolean isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocollo);
  3415.            
  3416.             int idLista = Liste.PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_AUTORIZZATO;
  3417.             if(isToken && !modi) {
  3418.                 idLista = Liste.PORTE_APPLICATIVE_TOKEN_SERVIZIO_APPLICATIVO;
  3419.             }
  3420.             int limit = ricerca.getPageSize(idLista);
  3421.             int offset = ricerca.getIndexIniziale(idLista);
  3422.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  3423.             this.pd.setIndex(offset);
  3424.             this.pd.setPageSize(limit);
  3425.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  3426.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  3427.             String idporta = myPA.getNome();

  3428.             // setto la barra del titolo
  3429.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  3430.             String labelPerPorta = null;
  3431.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  3432.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  3433.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  3434.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  3435.                         myPA);
  3436.             }
  3437.             else {
  3438.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  3439.             }
  3440.            
  3441.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  3442.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3443.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3444.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  3445.            
  3446.             String labelPag =
  3447.                     (
  3448.                             (isToken && !modi) ?
  3449.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN :
  3450.                                 modi ?
  3451.                                         CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO
  3452.                                         :
  3453.                                         CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO
  3454.                     )
  3455.                     + " - " +
  3456.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_APPLICATIVI_CONFIG;
  3457.            
  3458.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3459.             if(search.equals("")){
  3460.                 this.pd.setSearchDescription("");
  3461.                 lstParam.add(new Parameter(labelPag,null));
  3462.             }else{
  3463.                 lstParam.add(new Parameter(labelPag,
  3464.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_AUTORIZZATO_LIST,
  3465.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  3466.                         new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3467.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  3468.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TOKEN_AUTHORIZATION, isToken+""),
  3469.                         new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, isAutorizzazioneModi+"")));
  3470.                
  3471.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  3472.             }

  3473.             // setto la barra del titolo
  3474.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  3475.            
  3476.             // imposta menu' contestuale
  3477.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  3478.             // controllo eventuali risultati ricerca
  3479. //          if (!search.equals("")) {
  3480. //              this.pd.setSearch("on");
  3481. //              this.pd.setSearchDescription("Soggetti contenenti la stringa '" + search + "'");
  3482. //          }

  3483.             // setto le label delle colonne
  3484.             List<String> labels = new ArrayList<>();
  3485.             if(this.porteApplicativeCore.isMultitenant() || isSupportatoAutenticazioneApplicativiEsterni || isToken) {
  3486.                 labels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  3487.             }
  3488.             labels.add(CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO);
  3489.             this.pd.setLabels(labels.toArray(new String[1]));

  3490.             // preparo i dati
  3491.             List<List<DataElement>> dati = new ArrayList<>();

  3492.             if (lista != null) {
  3493.                 Iterator<PortaApplicativaAutorizzazioneServizioApplicativo> it = lista.iterator();
  3494.                 while (it.hasNext()) {
  3495.                     PortaApplicativaAutorizzazioneServizioApplicativo sa = it.next();

  3496.                     List<DataElement> e = new ArrayList<>();

  3497.                     if(this.porteApplicativeCore.isMultitenant() || isSupportatoAutenticazioneApplicativiEsterni) {
  3498.                         Long idSoggetto =this.soggettiCore.getIdSoggetto(sa.getNomeSoggettoProprietario(), sa.getTipoSoggettoProprietario());  
  3499.                         DataElement de = new DataElement();
  3500.                         if(this.isModalitaCompleta()) {
  3501.                             de.setUrl(SoggettiCostanti.SERVLET_NAME_SOGGETTI_CHANGE,
  3502.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID,idSoggetto+""),
  3503.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_NOME,sa.getNomeSoggettoProprietario()),
  3504.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_TIPO,sa.getTipoSoggettoProprietario()));
  3505.                         }
  3506.                         de.setValue(this.getLabelNomeSoggetto(protocollo, sa.getTipoSoggettoProprietario() , sa.getNomeSoggettoProprietario()));
  3507.                         e.add(de);
  3508.                     }
  3509.                    
  3510.                    
  3511.                     DataElement de = new DataElement();
  3512.                     de.setValue(sa.getNome());
  3513.                     de.setIdToRemove(sa.getNome()+"@"+sa.getTipoSoggettoProprietario() + "/" + sa.getNomeSoggettoProprietario());
  3514.                    
  3515.                     if(!this.isModalitaCompleta()) {
  3516.                         IDSoggetto idSoggettoProprietario = new IDSoggetto(sa.getTipoSoggettoProprietario(), sa.getNomeSoggettoProprietario());
  3517.                         Soggetto soggettoProprietario = this.soggettiCore.getSoggettoRegistro(idSoggettoProprietario);
  3518.                         String dominio = this.pddCore.isPddEsterna(soggettoProprietario.getPortaDominio()) ? SoggettiCostanti.SOGGETTO_DOMINIO_ESTERNO_VALUE : SoggettiCostanti.SOGGETTO_DOMINIO_OPERATIVO_VALUE;
  3519.                        
  3520.                         long idServizioApplicativo = this.saCore.getIdServizioApplicativo(idSoggettoProprietario, sa.getNome());
  3521.                         String url = new Parameter("", ServiziApplicativiCostanti.SERVLET_NAME_SERVIZI_APPLICATIVI_CHANGE,
  3522.                                 new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_ID, idServizioApplicativo+""),
  3523.                                 new Parameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_PROVIDER, soggettoProprietario.getId()+""),
  3524.                                 new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_DOMINIO, dominio)).getValue();
  3525.                         String tooltip = sa.getNome();
  3526.                        
  3527.                         this.newDataElementVisualizzaInNuovoTab(de, url, tooltip);
  3528.                     }
  3529.                    
  3530.                     e.add(de);

  3531.                     dati.add(e);
  3532.                 }
  3533.             }

  3534.             this.pd.setDati(dati);
  3535.             this.pd.setAddButton(true);

  3536.         } catch (Exception e) {
  3537.             this.logError(e.getMessage(), e);
  3538.             throw new ControlStationCoreException(e.getMessage(),e);
  3539.         }
  3540.     }

  3541.    
  3542.     public List<DataElement> addPorteApplicativeCorrelazioneApplicativeRichiestaToDati(TipoOperazione tipoOp,
  3543.             String elemxml, String mode, String pattern, String gif,
  3544.             String riusoIdMessaggio, List<DataElement> dati, org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding,
  3545.             String protocollo) {
  3546.        
  3547.         DataElement de = new DataElement();
  3548.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA);
  3549.         de.setType(DataElementType.TITLE);
  3550.         dati.add(de);
  3551.        
  3552.         dati.add(this.getDataElementNotCorrelazioneApplicativa());
  3553.         de = new DataElement();
  3554.         de.setLabel("");
  3555.         de.setValue("");
  3556.         de.setType(DataElementType.NOTE);
  3557.         dati.add(de);
  3558.        
  3559.         de = new DataElement();
  3560.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3561.         de.setType(DataElementType.TEXT_EDIT);
  3562.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3563.         de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML_NOTE);
  3564.         de.setSize(80);
  3565.         if (elemxml == null || CostantiControlStation.LABEL_PORTE_CORRELAZIONE_APPLICATIVA_QUALSIASI.equals(elemxml)) {
  3566.             de.setValue("");
  3567.         } else {
  3568.             de.setValue(elemxml);
  3569.         }
  3570.         DataElementInfo dInfoPattern = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3571.         dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA);
  3572.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3573.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA_VALORI_REST);
  3574.         }
  3575.         else {
  3576.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA_VALORI_SOAP);
  3577.         }
  3578.         de.setInfo(dInfoPattern);
  3579.         dati.add(de);

  3580.         //String[] tipoMode = { "urlBased", "contentBased", "inputBased","disabilitato" };
  3581.         String[] tipoMode = {
  3582.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_URL_BASED,
  3583.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED,
  3584.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED,
  3585.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_INPUT_BASED,
  3586.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE,
  3587.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE,
  3588.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE,
  3589.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_DISABILITATO
  3590.         };
  3591.         List<String> labels = ModalitaIdentificazione.getLabels(
  3592.                 ModalitaIdentificazione.URL_BASED,
  3593.                 ModalitaIdentificazione.HEADER_BASED,
  3594.                 ModalitaIdentificazione.CONTENT_BASED,
  3595.                 ModalitaIdentificazione.INPUT_BASED,
  3596.                 ModalitaIdentificazione.GOVWAY_TEMPLATE,
  3597.                 ModalitaIdentificazione.FREEMARKER_TEMPLATE,
  3598.                 ModalitaIdentificazione.VELOCITY_TEMPLATE
  3599.                 );
  3600.         labels.add(CostantiControlStation.LABEL_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO);
  3601.        
  3602.         de = new DataElement();
  3603.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE );
  3604.         de.setType(DataElementType.SELECT);
  3605.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE);
  3606.         de.setValues(tipoMode);
  3607.         de.setLabels(labels);
  3608.         de.setSelected(mode);
  3609.         //              de.setOnChange("CambiaModeCorrAppPortaApplicativa('add')");
  3610.         de.setPostBack(true);
  3611.         dati.add(de);

  3612.         if (PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_URL_BASED.equals(mode) ||
  3613.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED.equals(mode) ||
  3614.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED.equals(mode) ||
  3615.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode) ||
  3616.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode) ||
  3617.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE.equals(mode)
  3618.                 ) {
  3619.             de = new DataElement();
  3620.             if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED)) {
  3621.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3622.                 de.setType(DataElementType.TEXT_EDIT);
  3623.             }
  3624.             else if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode) ||
  3625.                     PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode) ||
  3626.                     PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE.equals(mode) ) {
  3627.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TEMPLATE);
  3628.                 de.setType(DataElementType.TEXT_AREA);
  3629.                
  3630.                 if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode)) {
  3631.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  3632.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  3633.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3634.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), false, false));
  3635.                     }
  3636.                     else {
  3637.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), false, false));
  3638.                     }
  3639.                 }
  3640.                 else if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode)) {
  3641.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  3642.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  3643.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3644.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  3645.                     }
  3646.                     else {
  3647.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  3648.                     }
  3649.                 }
  3650.                 else {
  3651.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  3652.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  3653.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3654.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  3655.                     }
  3656.                     else {
  3657.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  3658.                     }
  3659.                 }
  3660.                 de.setInfo(dInfoPattern);
  3661.             }
  3662.             else {
  3663.                 if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_URL_BASED)) {
  3664.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ESPRESSIONE_REGOLARE);
  3665.                 }
  3666.                 else {
  3667.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  3668.                 }
  3669.                 de.setType(DataElementType.TEXT_AREA);
  3670.                
  3671.                 if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED)) {
  3672.                     dInfoPattern = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  3673.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3674.                         dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_REST);
  3675.                         dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_VALORI_REST);
  3676.                     }
  3677.                     else {
  3678.                         dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_SOAP);
  3679.                     }
  3680.                     de.setInfo(dInfoPattern);
  3681.                 }
  3682.             }
  3683.             if (pattern == null) {
  3684.                 de.setValue("");
  3685.             } else {
  3686.                 de.setValue(pattern);
  3687.             }
  3688.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_PATTERN);
  3689.             de.setRequired(true);
  3690.             dati.add(de);
  3691.         }

  3692.         if(!PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_DISABILITATO.equals(mode)){
  3693.             String[] tipiGIF = { CostantiConfigurazione.BLOCCA.toString(), CostantiConfigurazione.ACCETTA.toString()};
  3694.             de = new DataElement();
  3695.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_IDENTIFICAZIONE_FALLITA);
  3696.             de.setType(DataElementType.SELECT);
  3697.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_GESTIONE_IDENTIFICAZIONE_FALLITA);
  3698.             de.setValues(tipiGIF);
  3699.             de.setSelected(gif);
  3700.             dati.add(de);

  3701.             de = new DataElement();
  3702.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RIUSO_ID_MESSAGGIO);
  3703.             de.setValue(riusoIdMessaggio);
  3704.             de.setType(DataElementType.HIDDEN);
  3705.             dati.add(de);

  3706.         }


  3707.         return dati;
  3708.     }

  3709.     public List<DataElement> addPorteApplicativeCorrelazioneApplicativeRispostaToDati(TipoOperazione tipoOp,
  3710.             String elemxml, String mode, String pattern, String gif,
  3711.             List<DataElement> dati, org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding,
  3712.             String protocollo) {
  3713.        
  3714.         DataElement de = new DataElement();
  3715.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA);
  3716.         de.setType(DataElementType.TITLE);
  3717.         dati.add(de);
  3718.        
  3719.         dati.add(this.getDataElementNotCorrelazioneApplicativa());
  3720.         de = new DataElement();
  3721.         de.setLabel("");
  3722.         de.setValue("");
  3723.         de.setType(DataElementType.NOTE);
  3724.         dati.add(de);
  3725.        
  3726.         de = new DataElement();
  3727.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3728.         de.setType(DataElementType.TEXT_EDIT);
  3729.         de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML_NOTE);
  3730.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3731.         de.setSize(80);
  3732.         if (elemxml == null || CostantiControlStation.LABEL_PORTE_CORRELAZIONE_APPLICATIVA_QUALSIASI.equals(elemxml)) {
  3733.             de.setValue("");
  3734.         } else {
  3735.             de.setValue(elemxml);
  3736.         }
  3737.         DataElementInfo dInfoPattern = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ELEMENTO_XML);
  3738.         dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA);
  3739.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3740.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA_VALORI_REST);
  3741.         }
  3742.         else {
  3743.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_APPLICABILITA_VALORI_SOAP);
  3744.         }
  3745.         de.setInfo(dInfoPattern);
  3746.         dati.add(de);

  3747.         String[] tipoMode = {
  3748.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED,
  3749.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED,
  3750.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_INPUT_BASED,
  3751.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE,
  3752.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE,
  3753.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE,
  3754.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_DISABILITATO
  3755.         };
  3756.        
  3757.         List<String> labels = ModalitaIdentificazione.getLabels(
  3758.                 ModalitaIdentificazione.HEADER_BASED,
  3759.                 ModalitaIdentificazione.CONTENT_BASED,
  3760.                 ModalitaIdentificazione.INPUT_BASED,
  3761.                 ModalitaIdentificazione.GOVWAY_TEMPLATE,
  3762.                 ModalitaIdentificazione.FREEMARKER_TEMPLATE,
  3763.                 ModalitaIdentificazione.VELOCITY_TEMPLATE);
  3764.         labels.add(CostantiControlStation.LABEL_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO);
  3765.        
  3766.         de = new DataElement();
  3767.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODALITA_IDENTIFICAZIONE);
  3768.         de.setType(DataElementType.SELECT);
  3769.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_MODE);
  3770.         de.setValues(tipoMode);
  3771.         de.setLabels(labels);
  3772.         de.setSelected(mode);
  3773.         //              de.setOnChange("CambiaModeCorrAppPortaApplicativa('add','Risposta')");
  3774.         de.setPostBack(true);
  3775.         dati.add(de);

  3776.         if (PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_URL_BASED.equals(mode) ||
  3777.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED.equals(mode) ||
  3778.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED.equals(mode) ||
  3779.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode) ||
  3780.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode) ||
  3781.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE.equals(mode) ) {
  3782.             de = new DataElement();
  3783.             if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_HEADER_BASED)) {
  3784.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3785.                 de.setType(DataElementType.TEXT_EDIT);
  3786.             }
  3787.             else if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode) ||
  3788.                     PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode) ||
  3789.                     PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE.equals(mode) ) {
  3790.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TEMPLATE);
  3791.                 de.setType(DataElementType.TEXT_AREA);
  3792.                
  3793.                 if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_TEMPLATE.equals(mode)) {
  3794.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  3795.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  3796.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3797.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), false, false));
  3798.                     }
  3799.                     else {
  3800.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), false, false));
  3801.                     }
  3802.                 }
  3803.                 else if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE.equals(mode)) {
  3804.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  3805.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  3806.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3807.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_CON_RISPOSTE_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  3808.                     }
  3809.                     else {
  3810.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_CON_RISPOSTE_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  3811.                     }
  3812.                 }
  3813.                 else {
  3814.                     dInfoPattern = new DataElementInfo(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  3815.                     dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  3816.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3817.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_CON_RISPOSTE_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  3818.                     }
  3819.                     else {
  3820.                         dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_CON_RISPOSTE_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  3821.                     }
  3822.                 }
  3823.                 de.setInfo(dInfoPattern);
  3824.             }
  3825.             else {
  3826.                 if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_URL_BASED)) {
  3827.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_ESPRESSIONE_REGOLARE);
  3828.                 }
  3829.                 else {
  3830.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  3831.                 }
  3832.                 de.setType(DataElementType.TEXT_AREA);
  3833.                
  3834.                 if(mode.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_CONTENT_BASED)) {
  3835.                     dInfoPattern = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTENT_PATTERN);
  3836.                     if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  3837.                         dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_REST);
  3838.                         dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_VALORI_REST);
  3839.                     }
  3840.                     else {
  3841.                         dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_INFO_PATTERN_SOAP);
  3842.                     }
  3843.                     de.setInfo(dInfoPattern);
  3844.                 }
  3845.             }
  3846.             if (pattern == null) {
  3847.                 de.setValue("");
  3848.             } else {
  3849.                 de.setValue(pattern);
  3850.             }
  3851.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_PATTERN);
  3852.             de.setRequired(true);
  3853.             dati.add(de);
  3854.         }

  3855.         if(!PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_TIPO_MODE_CORRELAZIONE_DISABILITATO.equals(mode)){
  3856.             String[] tipiGIF = { CostantiConfigurazione.BLOCCA.toString(), CostantiConfigurazione.ACCETTA.toString()};
  3857.             de = new DataElement();
  3858.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_GESTIONE_IDENTIFICAZIONE_FALLITA);
  3859.             de.setType(DataElementType.SELECT);
  3860.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_GESTIONE_IDENTIFICAZIONE_FALLITA);
  3861.             de.setValues(tipiGIF);
  3862.             de.setSelected(gif);
  3863.             dati.add(de);

  3864.         }

  3865.         return dati;
  3866.     }

  3867.     @Override
  3868.     public int getSize() {
  3869.         return 50;
  3870.     }

  3871.     public  List<DataElement>  addProprietaProtocolloToDati(TipoOperazione tipoOp,
  3872.             int size,
  3873.             String nome, String valore, List<DataElement> dati) {

  3874.         DataElement de = new DataElement();
  3875.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PROTOCOL_PROPERTIES);
  3876.         de.setType(DataElementType.TITLE);
  3877.         dati.add(de);
  3878.        
  3879.         de = new DataElement();
  3880.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3881.         de.setValue(nome);
  3882.         if(TipoOperazione.ADD.equals(tipoOp)){
  3883.             de.setType(DataElementType.TEXT_EDIT);
  3884.             de.setRequired(true);
  3885.         }
  3886.         else{
  3887.             de.setType(DataElementType.TEXT);
  3888.         }
  3889.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME);
  3890.         de.setSize(size);
  3891.         dati.add(de);

  3892.         de = new DataElement();
  3893.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  3894.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_VALORE);
  3895.         this.core.getLockUtilities().lockProperty(de, valore);
  3896.         de.setRequired(true);
  3897.         de.setSize(size);
  3898.         dati.add(de);

  3899.         return dati;
  3900.     }

  3901.     // Prepara la lista di MTOM request-flow delle porte applicative
  3902.     public void preparePorteApplicativeMTOMRequestList(String nomePorta, ISearch ricerca, List<MtomProcessorFlowParameter> lista)   throws Exception {
  3903.         try {

  3904.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte applicative
  3905.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  3906.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  3907.             if(idAsps == null)
  3908.                 idAsps = "";


  3909.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  3910.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  3911.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_MTOM_REQUEST,
  3912.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  3913.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  3914.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  3915.             int idLista = Liste.PORTE_APPLICATIVE_MTOM_REQUEST;
  3916.             int limit = ricerca.getPageSize(idLista);
  3917.             int offset = ricerca.getIndexIniziale(idLista);
  3918.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  3919.             this.pd.setIndex(offset);
  3920.             this.pd.setPageSize(limit);
  3921.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  3922.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  3923.             String idporta = myPA.getNome();

  3924.             // setto la barra del titolo
  3925.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  3926.             String labelPerPorta = null;
  3927.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  3928.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  3929.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG_DI,
  3930.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG,
  3931.                         myPA);
  3932.             }
  3933.             else {
  3934.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG_DI+idporta;
  3935.             }
  3936.            
  3937.             lstParam.add(new Parameter(labelPerPorta,
  3938.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM,
  3939.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  3940.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  3941.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3942.                     ));
  3943.            
  3944.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  3945.             if(search.equals("")){
  3946.                 this.pd.setSearchDescription("");
  3947.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_REQUEST_FLOW_DI, // + idporta,
  3948.                         null));
  3949.             }
  3950.             else{
  3951.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_REQUEST_FLOW_DI, // + idporta,
  3952.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM_REQUEST_LIST,
  3953.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  3954.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  3955.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3956.                         ));
  3957.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  3958.             }


  3959.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  3960.            
  3961.             // imposta menu' contestuale
  3962.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  3963.             // controllo eventuali risultati ricerca
  3964.             if (!search.equals("")) {
  3965.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_REQUEST_FLOW_DI, search);
  3966.             }

  3967.             // setto le label delle colonne
  3968.             String[] labels = {
  3969.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME,
  3970.             };
  3971.             this.pd.setLabels(labels);

  3972.             // preparo i dati
  3973.             List<List<DataElement>> dati = new ArrayList<>();

  3974.             if (lista != null) {
  3975.                 Iterator<MtomProcessorFlowParameter> it = lista.iterator();
  3976.                 while (it.hasNext()) {
  3977.                     MtomProcessorFlowParameter parametro = it.next();

  3978.                     List<DataElement> e = new ArrayList<>();

  3979.                     DataElement de = new DataElement();
  3980.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM_REQUEST_CHANGE ,
  3981.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  3982.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  3983.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, parametro.getNome()),
  3984.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  3985.                             );
  3986.                     de.setValue(parametro.getNome());
  3987.                     de.setIdToRemove(parametro.getNome());
  3988.                     e.add(de);
  3989.                     dati.add(e);
  3990.                 }
  3991.             }

  3992.             this.pd.setDati(dati);
  3993.             this.pd.setAddButton(true);

  3994.         } catch (Exception e) {
  3995.             this.logError(e.getMessage(), e);
  3996.             throw new ControlStationCoreException(e.getMessage(),e);
  3997.         }
  3998.     }


  3999.     // Prepara la lista di MTOM response-flow delle porte applicative
  4000.     public void preparePorteApplicativeMTOMResponseList(String nomePorta, ISearch ricerca,
  4001.             List<MtomProcessorFlowParameter> lista)
  4002.                     throws Exception {
  4003.         try {
  4004.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4005.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  4006.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte applicative
  4007.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4008.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4009.             if(idAsps == null)
  4010.                 idAsps = "";

  4011.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_MTOM_RESPONSE,
  4012.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4013.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4014.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  4015.             int idLista = Liste.PORTE_APPLICATIVE_MTOM_RESPONSE;
  4016.             int limit = ricerca.getPageSize(idLista);
  4017.             int offset = ricerca.getIndexIniziale(idLista);
  4018.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  4019.             this.pd.setIndex(offset);
  4020.             this.pd.setPageSize(limit);
  4021.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  4022.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  4023.             String idporta = myPA.getNome();

  4024.             // setto la barra del titolo
  4025.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  4026.            
  4027.             String labelPerPorta = null;
  4028.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  4029.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  4030.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG_DI,
  4031.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG,
  4032.                         myPA);
  4033.             }
  4034.             else {
  4035.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_CONFIG_DI+idporta;
  4036.             }
  4037.            
  4038.             lstParam.add(new Parameter(labelPerPorta,
  4039.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM,
  4040.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  4041.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  4042.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  4043.                     ));

  4044.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  4045.             if(search.equals("")){
  4046.                 this.pd.setSearchDescription("");
  4047.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_RESPONSE_FLOW_DI, // + idporta,
  4048.                         null));
  4049.             }
  4050.             else{
  4051.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_RESPONSE_FLOW_DI, // + idporta,
  4052.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM_RESPONSE_LIST,
  4053.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  4054.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  4055.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  4056.                         ));
  4057.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  4058.             }

  4059.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  4060.            
  4061.             // imposta menu' contestuale
  4062.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  4063.             // controllo eventuali risultati ricerca
  4064.             if (!search.equals("")) {
  4065.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_RESPONSE_FLOW_DI, search);
  4066.             }

  4067.             // setto le label delle colonne
  4068.             String[] labels = {
  4069.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME,
  4070.             };
  4071.             this.pd.setLabels(labels);

  4072.             // preparo i dati
  4073.             List<List<DataElement>> dati = new ArrayList<>();

  4074.             if (lista != null) {
  4075.                 Iterator<MtomProcessorFlowParameter> it = lista.iterator();
  4076.                 while (it.hasNext()) {
  4077.                     MtomProcessorFlowParameter wsrfp = it.next();

  4078.                     List<DataElement> e = new ArrayList<>();

  4079.                     DataElement de = new DataElement();
  4080.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_MTOM_RESPONSE_CHANGE,
  4081.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  4082.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  4083.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, wsrfp.getNome()),
  4084.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  4085.                             );
  4086.                     de.setValue(wsrfp.getNome());
  4087.                     de.setIdToRemove(wsrfp.getNome());
  4088.                     e.add(de);

  4089.                     dati.add(e);
  4090.                 }
  4091.             }

  4092.             this.pd.setDati(dati);
  4093.             this.pd.setAddButton(true);

  4094.         } catch (Exception e) {
  4095.             this.logError(e.getMessage(), e);
  4096.             throw new ControlStationCoreException(e.getMessage(),e);
  4097.         }
  4098.     }
  4099.    
  4100.     public void preparePorteApplicativeRuoliList(String nomePorta, ISearch ricerca, List<String> lista)
  4101.             throws Exception {
  4102.         try {
  4103.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  4104.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4105.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4106.             if(idAsps == null)
  4107.                 idAsps = "";

  4108.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4109.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  4110.             String autorizzazioneModi = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA);
  4111.             String token = this.getParameter(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION);

  4112.             List<Parameter> listP = new ArrayList<>();
  4113.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id));
  4114.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg));
  4115.             listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  4116.             if(token!=null) {
  4117.                 listP.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TOKEN_AUTHORIZATION, token));
  4118.             }
  4119.             if(autorizzazioneModi!=null) {
  4120.                 listP.add(new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, autorizzazioneModi));
  4121.             }
  4122.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_RUOLI,
  4123.                     listP);

  4124.             boolean isToken = token!=null && !"".equals(token) && Boolean.valueOf(token);
  4125.             boolean isAutorizzazioneModi = autorizzazioneModi!=null && !"".equals(autorizzazioneModi) && Boolean.valueOf(autorizzazioneModi);
  4126.            
  4127.             int idLista = Liste.PORTE_APPLICATIVE_RUOLI;
  4128.             if(isToken) {
  4129.                 idLista = Liste.PORTE_APPLICATIVE_TOKEN_RUOLI;
  4130.             }
  4131.             int limit = ricerca.getPageSize(idLista);
  4132.             int offset = ricerca.getIndexIniziale(idLista);
  4133.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  4134.             this.pd.setIndex(offset);
  4135.             this.pd.setPageSize(limit);
  4136.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  4137.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  4138.             String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(pa.getTipoSoggettoProprietario());
  4139.             boolean modi = this.porteApplicativeCore.isProfiloModIPA(protocollo);
  4140.             String idporta = pa.getNome();

  4141.             // setto la barra del titolo
  4142.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  4143.            
  4144.             String labelPerPorta = null;
  4145.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  4146.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  4147.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  4148.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  4149.                         pa);
  4150.             }
  4151.             else {
  4152.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  4153.             }
  4154.            
  4155.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  4156.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4157.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4158.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  4159.            
  4160.             String labelPagLista =
  4161.                     isToken ?
  4162.                             ((isAutorizzazioneModi || modi)? CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO : CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN)
  4163.                             :
  4164.                             (modi? CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE : CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO);
  4165.             labelPagLista = labelPagLista
  4166.                             + " - " +
  4167.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RUOLI_CONFIG;
  4168.            
  4169.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO);
  4170.             if(search.equals("")){
  4171.                 this.pd.setSearchDescription("");
  4172.                 lstParam.add(new Parameter(labelPagLista,null));
  4173.             }
  4174.             else{
  4175.                 lstParam.add(new Parameter(labelPagLista,
  4176.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_RUOLI_LIST,
  4177.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  4178.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  4179.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  4180.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TOKEN_AUTHORIZATION, isToken+""),
  4181.                         new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, isAutorizzazioneModi+"")
  4182.                         ));
  4183.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  4184.             }

  4185.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  4186.            
  4187.             // imposta menu' contestuale
  4188.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  4189.             // controllo eventuali risultati ricerca
  4190.             if (!search.equals("")) {
  4191.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RUOLI, search);
  4192.             }

  4193.             // setto le label delle colonne
  4194.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_RUOLO };
  4195.             this.pd.setLabels(labels);

  4196.             // preparo i dati
  4197.             List<List<DataElement>> dati = new ArrayList<>();

  4198.             if (lista != null) {
  4199.                 Iterator<String> it = lista.iterator();
  4200.                 while (it.hasNext()) {
  4201.                     String ruolo = it.next();
  4202.        
  4203.                     List<DataElement> e = new ArrayList<>();
  4204.        
  4205.                     DataElement de = new DataElement();
  4206.                     de.setValue(ruolo);
  4207.                     de.setIdToRemove(ruolo);
  4208.                    
  4209.                     if(!this.isModalitaCompleta()) {
  4210.                         Ruolo ruoloObj = this.ruoliCore.getRuolo(ruolo);
  4211.                         Parameter pIdRuolo = new Parameter(RuoliCostanti.PARAMETRO_RUOLO_ID, ruoloObj.getId()+"");
  4212.                        
  4213.                         String url = new Parameter("", RuoliCostanti.SERVLET_NAME_RUOLI_CHANGE , pIdRuolo).getValue();
  4214.                         String tooltip = ruolo;
  4215.                        
  4216.                         this.newDataElementVisualizzaInNuovoTab(de, url, tooltip);
  4217.                     }
  4218.                    
  4219.                     e.add(de);
  4220.        
  4221.                     dati.add(e);
  4222.                 }
  4223.             }

  4224.             this.pd.setDati(dati);
  4225.             this.pd.setAddButton(true);

  4226.         } catch (Exception e) {
  4227.             this.logError(e.getMessage(), e);
  4228.             throw new ControlStationCoreException(e.getMessage(),e);
  4229.         }
  4230.     }
  4231.    
  4232.     public void preparePorteApplicativeScopeList(String nomePorta, ISearch ricerca, List<String> lista)
  4233.             throws Exception {
  4234.         try {
  4235.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  4236.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4237.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4238.             if(idAsps == null)
  4239.                 idAsps = "";

  4240.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4241.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  4242.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_SCOPE,
  4243.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4244.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4245.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  4246.             int idLista = Liste.PORTE_APPLICATIVE_SCOPE;
  4247.             int limit = ricerca.getPageSize(idLista);
  4248.             int offset = ricerca.getIndexIniziale(idLista);
  4249.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  4250.             this.pd.setIndex(offset);
  4251.             this.pd.setPageSize(limit);
  4252.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  4253.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  4254.             String idporta = pa.getNome();

  4255.             // setto la barra del titolo
  4256.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  4257.            
  4258.             String labelPerPorta = null;
  4259.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  4260.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  4261.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  4262.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  4263.                         pa);
  4264.             }
  4265.             else {
  4266.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  4267.             }
  4268.            
  4269.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  4270.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4271.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4272.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  4273.            
  4274.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SCOPE_CONFIG;
  4275.            
  4276.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_SCOPE);
  4277.             if(search.equals("")){
  4278.                 this.pd.setSearchDescription("");
  4279.                 lstParam.add(new Parameter(labelPagLista,null));
  4280.             }
  4281.             else{
  4282.                 lstParam.add(new Parameter(labelPagLista,
  4283.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_SCOPE_LIST,
  4284.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  4285.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  4286.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  4287.                         ));
  4288.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  4289.             }

  4290.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  4291.            
  4292.             // imposta menu' contestuale
  4293.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  4294.             // controllo eventuali risultati ricerca
  4295.             if (!search.equals("")) {
  4296.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SCOPE, search);
  4297.             }

  4298.             // setto le label delle colonne
  4299.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_SCOPE };
  4300.             this.pd.setLabels(labels);

  4301.             // preparo i dati
  4302.             List<List<DataElement>> dati = new ArrayList<>();

  4303.             if (lista != null) {
  4304.                 Iterator<String> it = lista.iterator();
  4305.                 while (it.hasNext()) {
  4306.                     String scope = it.next();
  4307.        
  4308.                     List<DataElement> e = new ArrayList<>();
  4309.        
  4310.                     DataElement de = new DataElement();
  4311.                     de.setValue(scope);
  4312.                     de.setIdToRemove(scope);
  4313.                    
  4314.                     if(!this.isModalitaCompleta()) {
  4315.                         Scope scopeObj = this.scopeCore.getScope(scope);
  4316.                         Parameter pIdScope = new Parameter(ScopeCostanti.PARAMETRO_SCOPE_ID, scopeObj.getId()+"");
  4317.                        
  4318.                         String url = new Parameter("", ScopeCostanti.SERVLET_NAME_SCOPE_CHANGE , pIdScope).getValue();
  4319.                         String tooltip = scope;
  4320.                        
  4321.                         this.newDataElementVisualizzaInNuovoTab(de, url, tooltip);
  4322.                     }
  4323.                    
  4324.                     e.add(de);
  4325.        
  4326.                     dati.add(e);
  4327.                 }
  4328.             }

  4329.             this.pd.setDati(dati);
  4330.             this.pd.setAddButton(true);

  4331.         } catch (Exception e) {
  4332.             this.logError(e.getMessage(), e);
  4333.             throw new ControlStationCoreException(e.getMessage(),e);
  4334.         }
  4335.     }
  4336.    
  4337.     public void impostaComandiMenuContestualePA(String idsogg, String idAsps) throws Exception {
  4338.         if(idsogg==null) {
  4339.             throw new Exception("Param idsogg is null");
  4340.         }
  4341.         String protocollo = null;
  4342.         if(this.core.isRegistroServiziLocale()){
  4343.             Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  4344.             protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  4345.         }
  4346.         else{
  4347.             org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  4348.             protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  4349.         }
  4350.         AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(Integer.parseInt(idAsps));
  4351.        
  4352.         Parameter pNomeServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SERVIZIO, asps.getNome());
  4353.         Parameter pTipoServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SERVIZIO, asps.getTipo());
  4354.         Parameter pIdSoggettoErogatore = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID_SOGGETTO_EROGATORE, asps.getIdSoggetto()+"");
  4355.        
  4356.         this.impostaComandiMenuContestualePA(asps, protocollo, pNomeServizio, pTipoServizio, pIdSoggettoErogatore);
  4357.     }
  4358.    
  4359.     public List<Parameter> getTitoloPA(Integer parentPA, String idsogg, String idAsps)  throws Exception, DriverRegistroServiziNotFound, DriverRegistroServiziException {
  4360.         if(idsogg==null) {
  4361.             throw new Exception("Param idsogg is null");
  4362.         }
  4363.         String soggettoTitle = null;
  4364.         if(this.core.isRegistroServiziLocale()){
  4365.             Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  4366.             String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  4367.             soggettoTitle = this.getLabelNomeSoggetto(protocollo, mySogg.getTipo() , mySogg.getNome());
  4368.         }
  4369.         else{
  4370.             org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  4371.             String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  4372.             soggettoTitle = this.getLabelNomeSoggetto(protocollo, mySogg.getTipo() , mySogg.getNome());
  4373.         }
  4374.         return _getTitoloPA(parentPA, idsogg, idAsps, soggettoTitle);
  4375.     }

  4376.     private List<Parameter> _getTitoloPA(Integer parentPA, String idsogg, String idAsps, String soggettoTitle)  throws Exception, DriverRegistroServiziNotFound, DriverRegistroServiziException {
  4377.         List<Parameter> lstParam = new ArrayList<>();
  4378.         if(parentPA==null) {
  4379.             throw new Exception("parentPA is null");
  4380.         }
  4381.         switch (parentPA) {
  4382.         case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE:
  4383.             AccordiServizioParteSpecificaCore apsCore = new AccordiServizioParteSpecificaCore(this.porteApplicativeCore);
  4384.             // Prendo il nome e il tipo del servizio
  4385.             AccordoServizioParteSpecifica asps = apsCore.getAccordoServizioParteSpecifica(Integer.parseInt(idAsps));
  4386.             String servizioTmpTile = this.getLabelIdServizio(asps);
  4387.             Parameter pIdServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID, asps.getId()+ "");
  4388.             Parameter pNomeServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SERVIZIO, asps.getNome());
  4389.             Parameter pTipoServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SERVIZIO, asps.getTipo());
  4390.             Parameter pIdsoggErogatore = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID_SOGGETTO_EROGATORE, ""+asps.getIdSoggetto());
  4391.            
  4392.             Boolean vistaErogazioni = ServletUtils.getBooleanAttributeFromSession(ErogazioniCostanti.ASPS_EROGAZIONI_ATTRIBUTO_VISTA_EROGAZIONI, this.session, this.request).getValue();
  4393.             if(vistaErogazioni != null && vistaErogazioni.booleanValue()) {
  4394.                 lstParam.add(new Parameter(ErogazioniCostanti.LABEL_ASPS_EROGAZIONI, ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_LIST));
  4395.                 lstParam.add(new Parameter(servizioTmpTile, ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_CHANGE, pIdServizio,pNomeServizio, pTipoServizio));
  4396.                 boolean gestioneGruppi = true;
  4397.                 String paramGestioneGruppi = ServletUtils.getObjectFromSession(this.request, this.session, String.class, AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_GESTIONE_GRUPPI);
  4398.                 if(paramGestioneGruppi!=null && !"".equals(paramGestioneGruppi)) {
  4399.                     gestioneGruppi = Boolean.valueOf(paramGestioneGruppi);
  4400.                 }
  4401.                
  4402.                 boolean gestioneConfigurazioni = true;
  4403.                 String paramGestioneConfigurazioni = ServletUtils.getObjectFromSession(this.request, this.session, String.class, AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_GESTIONE_CONFIGURAZIONI);
  4404.                 if(paramGestioneConfigurazioni!=null && !"".equals(paramGestioneConfigurazioni)) {
  4405.                     gestioneConfigurazioni = Boolean.valueOf(paramGestioneConfigurazioni);
  4406.                 }
  4407.                
  4408.                 AccordoServizioParteComuneSintetico as = this.apcCore.getAccordoServizioSintetico(asps.getIdAccordo());
  4409.                 ServiceBinding serviceBinding = this.apcCore.toMessageServiceBinding(as.getServiceBinding());
  4410.                 String labelConfigurazione = gestioneConfigurazioni ? ErogazioniCostanti.LABEL_ASPS_GESTIONE_CONFIGURAZIONI :
  4411.                     (gestioneGruppi ? MessageFormat.format(ErogazioniCostanti.LABEL_ASPS_GESTIONE_GRUPPI_CON_PARAMETRO, this.getLabelAzioni(serviceBinding)) : AccordiServizioParteSpecificaCostanti.LABEL_APS_PORTE_APPLICATIVE);
  4412.                
  4413.                 lstParam.add(new Parameter(labelConfigurazione, AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_PORTE_APPLICATIVE_LIST ,pIdServizio,pNomeServizio, pTipoServizio, pIdsoggErogatore));
  4414.             } else {
  4415.                 lstParam.add(new Parameter(AccordiServizioParteSpecificaCostanti.LABEL_APS, AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_LIST));
  4416.         //  lstParam.add(new Parameter(servizioTmpTile, AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_CHANGE, pIdServizio,pNomeServizio, pTipoServizio));
  4417.             lstParam.add(new Parameter(AccordiServizioParteSpecificaCostanti.LABEL_APS_CONFIGURAZIONI_DI + servizioTmpTile,
  4418.                     AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_PORTE_APPLICATIVE_LIST ,pIdServizio,pNomeServizio, pTipoServizio, pIdsoggErogatore));
  4419.             }
  4420.             break;
  4421.         case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_SOGGETTO:
  4422.             lstParam.add(new Parameter(SoggettiCostanti.LABEL_SOGGETTI,SoggettiCostanti.SERVLET_NAME_SOGGETTI_LIST));
  4423.             lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_PORTE_APPLICATIVE_DI + soggettoTitle, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_LIST ,
  4424.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg)));
  4425.             break;
  4426.         case PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE:
  4427.         default:
  4428.             lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_LIST));
  4429.             break;
  4430.         }
  4431.         return lstParam;
  4432.     }
  4433.    
  4434.    
  4435.     public String getPortaApplicativaAzioneIdentificazioneLabel(String paAiString) {
  4436.         if(paAiString == null)
  4437.             return "";
  4438.        
  4439.         return getPortaApplicativaAzioneIdentificazioneLabel(PortaApplicativaAzioneIdentificazione.toEnumConstant(paAiString));
  4440.     }
  4441.    

  4442.     public String getPortaApplicativaAzioneIdentificazioneLabel(PortaApplicativaAzioneIdentificazione paAi) {
  4443.         if(paAi == null)
  4444.             return "";
  4445.         switch (paAi) {
  4446.         case CONTENT_BASED:
  4447.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_CONTENT_BASED;
  4448.         case HEADER_BASED:
  4449.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_HEADER_BASED;
  4450.         case INPUT_BASED:
  4451.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_INPUT_BASED;
  4452.         case INTERFACE_BASED:
  4453.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_WSDL_BASED;
  4454.         case SOAP_ACTION_BASED:
  4455.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_SOAP_ACTION_BASED;
  4456.         case STATIC:
  4457.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_REGISTER_INPUT;
  4458.         case URL_BASED:
  4459.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_URL_BASED;
  4460.         case PROTOCOL_BASED:
  4461.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MODE_PROTOCOL_BASED;
  4462.         case DELEGATED_BY:
  4463.             break;
  4464.         default:
  4465.             break;
  4466.         }
  4467.        
  4468.         return "";
  4469.     }
  4470.    
  4471.     public String getMessaggioConfermaModificaRegolaMappingErogazionePortaApplicativa(boolean fromAPI, PortaApplicativa pa, ServiceBinding serviceBinding,boolean abilitazione, boolean multiline,boolean listElement) throws DriverConfigurazioneException {
  4472.         MappingErogazionePortaApplicativa mapping = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(pa);
  4473.         List<String> listaAzioni = pa.getAzione()!= null ?  pa.getAzione().getAzioneDelegataList() : new ArrayList<>();
  4474.         return this.getMessaggioConfermaModificaRegolaMapping(fromAPI, mapping.isDefault(), listaAzioni, serviceBinding, mapping.getDescrizione(), abilitazione, multiline, listElement);
  4475.     }
  4476.    
  4477.    
  4478.    
  4479.     public void prepareResponseCachingConfigurazioneRegolaList(String nomePorta, ISearch ricerca, List<ResponseCachingConfigurazioneRegola> lista, Integer defaultCacheSeconds) throws Exception {
  4480.         try {
  4481.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  4482.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4483.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4484.             if(idAsps == null)
  4485.                 idAsps = "";

  4486.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4487.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  4488.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA,
  4489.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4490.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4491.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  4492.             int idLista = Liste.PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA;
  4493.             int limit = ricerca.getPageSize(idLista);
  4494.             int offset = ricerca.getIndexIniziale(idLista);

  4495.             this.pd.setIndex(offset);
  4496.             this.pd.setPageSize(limit);
  4497.             this.pd.setSearch("");
  4498.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  4499.             this.pd.setSearchDescription("");
  4500.            
  4501.             ServletUtils.disabledPageDataSearch(this.pd);

  4502.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  4503.             String idporta = pa.getNome();

  4504.             // setto la barra del titolo
  4505.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  4506.            
  4507.             String labelPerPorta = null;
  4508.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  4509.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  4510.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_CONFIG_DI,
  4511.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE,
  4512.                         pa);
  4513.             }
  4514.             else {
  4515.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_CONFIG_DI+idporta;
  4516.             }
  4517.            
  4518.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_RESPONSE_CACHING,
  4519.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  4520.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  4521.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  4522.            
  4523.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLE;
  4524.            
  4525.             lstParam.add(new Parameter(labelPagLista,null));

  4526.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  4527.            
  4528.             // imposta menu' contestuale
  4529.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  4530.             // setto le label delle colonne
  4531.             String[] labels = {
  4532.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE,
  4533.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT,
  4534.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS
  4535.             };
  4536.             this.pd.setLabels(labels);

  4537.             // preparo i dati
  4538.             List<List<DataElement>> dati = new ArrayList<>();

  4539.             if (lista != null) {
  4540.                 Iterator<ResponseCachingConfigurazioneRegola> it = lista.iterator();
  4541.                 while (it.hasNext()) {
  4542.                     ResponseCachingConfigurazioneRegola regola = it.next();

  4543.                     List<DataElement> e = new ArrayList<>();

  4544.                     DataElement de = new DataElement();
  4545.                     de.setIdToRemove(regola.getId() + "");
  4546.                    
  4547.                     Integer statusMin = regola.getReturnCodeMin();
  4548.                     Integer statusMax = regola.getReturnCodeMax();
  4549.                    
  4550.                     // se e' stato salvato il valore 0 lo tratto come null
  4551.                     if(statusMin != null && statusMin.intValue() <= 0) {
  4552.                         statusMin = null;
  4553.                     }
  4554.                    
  4555.                     if(statusMax != null && statusMax.intValue() <= 0) {
  4556.                         statusMax = null;
  4557.                     }
  4558.                    
  4559.                     String statusValue = null;
  4560.                     // Intervallo
  4561.                     if(statusMin != null && statusMax != null) {
  4562.                         if(statusMax.longValue() == statusMin.longValue()) // esatto
  4563.                             statusValue = statusMin + "";
  4564.                         else
  4565.                             statusValue = "[" + statusMin + " - " + statusMax + "]";
  4566.                     } else if(statusMin != null && statusMax == null) { // definito solo l'estremo inferiore
  4567.                         statusValue = "&gt;" + statusMin;
  4568.                     } else if(statusMin == null && statusMax != null) { // definito solo l'estremo superiore
  4569.                         statusValue = "&lt;" + statusMax;
  4570.                     } else { //entrambi null
  4571.                         statusValue = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI;
  4572.                     }
  4573.                    
  4574.                     de.setValue(statusValue);
  4575.                     e.add(de);
  4576.                    
  4577.                     de = new DataElement();
  4578.                     de.setValue(regola.getFault() ? CostantiControlStation.LABEL_SI : CostantiControlStation.LABEL_NO);
  4579.                     e.add(de);
  4580.                    
  4581.                     de = new DataElement();
  4582.                     de.setValue(regola.getCacheTimeoutSeconds() != null ? regola.getCacheTimeoutSeconds() + "" : "default ("+defaultCacheSeconds+")");
  4583.                     e.add(de);

  4584.                     dati.add(e);
  4585.                 }
  4586.             }

  4587.             this.pd.setDati(dati);
  4588.             this.pd.setAddButton(true);

  4589.         } catch (Exception e) {
  4590.             this.logError(e.getMessage(), e);
  4591.             throw new ControlStationCoreException(e.getMessage(),e);
  4592.         }
  4593.     }
  4594.    
  4595.     // Controlla i dati del registro
  4596.     public boolean responseCachingConfigurazioneRegolaCheckData(TipoOperazione tipoOp, long idPorta) throws Exception {

  4597.         try{
  4598.            
  4599.             if(this.checkRegolaResponseCaching() == false) {
  4600.                 return false;
  4601.             }
  4602.            
  4603.             String returnCode = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE);
  4604.             String statusMinS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN);
  4605.             String statusMaxS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MAX);
  4606.             String faultS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT);
  4607.            
  4608.             Integer statusMin = null;
  4609.             Integer statusMax = null;
  4610.             boolean fault = ServletUtils.isCheckBoxEnabled(faultS);
  4611.            
  4612.             if(!returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI)) {
  4613.                
  4614.                 if(StringUtils.isNotEmpty(statusMinS)) {
  4615.                     statusMin = Integer.parseInt(statusMinS);
  4616.                 }
  4617.                
  4618.                 if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO)) {
  4619.                     if(StringUtils.isNotEmpty(statusMaxS)) {
  4620.                         statusMax = Integer.parseInt(statusMaxS);
  4621.                     }
  4622.                 }

  4623.                 // return code esatto, ho salvato lo stesso valore nel campo return code;
  4624.                 if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO))
  4625.                     statusMax = statusMin;
  4626.             }
  4627.            
  4628.             // Se tipoOp = add, controllo che il registro non sia gia' stato
  4629.             // registrata
  4630.             if (tipoOp.equals(TipoOperazione.ADD)) {
  4631.                 boolean giaRegistrato = this.porteApplicativeCore.existsResponseCachingConfigurazioneRegola(idPorta,statusMin, statusMax, fault);

  4632.                 if (giaRegistrato) {
  4633.                     this.pd.setMessage("&Egrave; gi&agrave; presente una Regola di Response Caching con in parametri indicati.");
  4634.                     return false;
  4635.                 }
  4636.             }

  4637.             return true;

  4638.         } catch (Exception e) {
  4639.             this.logError(e.getMessage(), e);
  4640.             throw new ControlStationCoreException(e.getMessage(),e);
  4641.         }
  4642.     }
  4643.    
  4644.     public void preparePorteAppTrasformazioniRegolaList(String nomePorta, ISearch ricerca, List<TrasformazioneRegola> lista) throws Exception {
  4645.         try {
  4646.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  4647.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4648.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4649.             if(idAsps == null)
  4650.                 idAsps = "";

  4651.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4652.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  4653.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  4654.             Parameter pIdSoggetto = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  4655.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  4656.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI,
  4657.                     pIdPorta,
  4658.                     pIdSoggetto,
  4659.                     pIdAsps);
  4660.             Parameter pFromList = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_LIST, "true");
  4661.            
  4662.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI;
  4663.             int limit = ricerca.getPageSize(idLista);
  4664.             int offset = ricerca.getIndexIniziale(idLista);

  4665.             this.pd.setIndex(offset);
  4666.             this.pd.setPageSize(limit);
  4667.             this.pd.setSearch("");
  4668.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  4669.             this.pd.setSearchDescription("");
  4670.            
  4671.             ServletUtils.disabledPageDataSearch(this.pd);

  4672.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  4673.             if(myPA==null) {
  4674.                 throw new Exception("PortaApplicativa con id '"+idPorta+"' non trovata");
  4675.             }
  4676.             String idporta = myPA.getNome();
  4677.            
  4678.             // Prendo il nome e il tipo del servizio
  4679.             AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(Integer.parseInt(idAsps));
  4680.             AccordoServizioParteComuneSintetico apc = this.apcCore.getAccordoServizioSintetico(asps.getIdAccordo());
  4681.             Map<String,String> azioni = this.porteApplicativeCore.getAzioniConLabel(asps, apc, false, true, new ArrayList<>());

  4682.             Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
  4683.             boolean autenticazione = !TipoAutenticazione.DISABILITATO.equals(myPA.getAutenticazione());
  4684.             String protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(myPA.getServizio().getTipo());
  4685.             boolean isSupportatoAutenticazione = this.soggettiCore.isSupportatoAutenticazioneApplicativiErogazione(protocollo);

  4686.             boolean autenticazioneToken = myPA.getGestioneToken()!=null && myPA.getGestioneToken().getPolicy()!=null;
  4687.            
  4688.             // setto la barra del titolo
  4689.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  4690.             String labelPerPorta = null;
  4691.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  4692.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  4693.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  4694.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  4695.                         myPA);
  4696.             }
  4697.             else {
  4698.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  4699.             }
  4700.            
  4701.             lstParam.add(new Parameter(labelPerPorta,null));

  4702.             // setto la barra del titolo
  4703.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  4704.            
  4705.             // imposta menu' contestuale
  4706.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  4707.             // setto le label delle colonne
  4708.             String nomeColonnaAzione = null;
  4709.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(apc.getServiceBinding())) {
  4710.                 nomeColonnaAzione = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_RISORSE;
  4711.             }
  4712.             else {
  4713.                 nomeColonnaAzione = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI;
  4714.             }
  4715.             List<String> lstLabels = new ArrayList<>();
  4716.             if(lista != null && lista.size() > 1)
  4717.                 lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_POSIZIONE);
  4718.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_STATO);
  4719.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_NOME);
  4720.             lstLabels.add(nomeColonnaAzione);
  4721.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_CT);
  4722.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  4723.             if(myPA!=null && myPA.getBehaviour()!=null && myPA.sizeServizioApplicativoList()>0) {
  4724.                 lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_CONNETTORI);
  4725.             }
  4726.             if(autenticazione || autenticazioneToken){
  4727.                 lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI);
  4728.             }
  4729.             if( (isSupportatoAutenticazione && autenticazione) || autenticazioneToken) {
  4730.                 lstLabels.add( PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI);// uso cmq label PD
  4731.             }
  4732.             this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));

  4733.             // preparo i dati
  4734.             List<List<DataElement>> dati = new ArrayList<>();

  4735.             if (lista != null) {
  4736.                 Iterator<TrasformazioneRegola> it = lista.iterator();
  4737.                 int numeroElementi = lista.size();
  4738.                 int i = 0;
  4739.                 while (it.hasNext()) {
  4740.                     TrasformazioneRegola regola = it.next();
  4741.                     Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, regola.getId() + "");
  4742.                    
  4743.                     List<DataElement> e = new ArrayList<>();
  4744.                    
  4745.                     // Posizione
  4746.                     if(lista.size() > 1) {
  4747.                         DataElement de = new DataElement();
  4748.                         de.setWidthPx(48);
  4749.                         de.setType(DataElementType.IMAGE);
  4750.                         DataElementImage imageUp = new DataElementImage();
  4751.                         Parameter pDirezioneSu = new Parameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_POSIZIONE,
  4752.                                 CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
  4753.                         Parameter pDirezioneGiu = new Parameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_POSIZIONE,
  4754.                                 CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
  4755.                                
  4756.                         if(i > 0) {
  4757.                             imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
  4758.                             imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
  4759.                             imageUp.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST, pIdPorta, pIdSoggetto, pIdAsps,pIdTrasformazione, pDirezioneSu);
  4760.                         }
  4761.                         else {
  4762.                             imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
  4763.                         }
  4764.                         de.addImage(imageUp);
  4765.                        
  4766.                         if(i < numeroElementi -1) {
  4767.                             DataElementImage imageDown = new DataElementImage();
  4768.                             imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
  4769.                             imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
  4770.                             imageDown.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST, pIdPorta, pIdSoggetto, pIdAsps,pIdTrasformazione, pDirezioneGiu);
  4771.                             de.addImage(imageDown);
  4772.                         }
  4773.                         de.setValue(regola.getPosizione()+"");
  4774.                         e.add(de);
  4775.                     }
  4776.                    
  4777.                     // Stato
  4778.                     DataElement de = new DataElement();
  4779.                     de.setWidthPx(10);
  4780.                     de.setType(DataElementType.CHECKBOX);
  4781.                     if(regola.getStato()==null // backward compatibility
  4782.                             ||
  4783.                             StatoFunzionalita.ABILITATO.equals(regola.getStato())){
  4784.                         de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
  4785.                         de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
  4786.                         de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
  4787.                     }
  4788.                     else{
  4789.                         de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
  4790.                         de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
  4791.                         de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
  4792.                     }
  4793.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  4794.                             pIdPorta,
  4795.                             pIdSoggetto,
  4796.                             pIdAsps,
  4797.                             pIdTrasformazione
  4798.                             );
  4799.                     e.add(de);
  4800.                    
  4801.                    
  4802.                     // Nome
  4803.                     de = new DataElement();
  4804.                     de.setIdToRemove(regola.getId() + "");
  4805.                     de.setValue(regola.getNome());
  4806.                     de.setToolTip(regola.getNome());
  4807.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  4808.                             pIdPorta,
  4809.                             pIdSoggetto,
  4810.                             pIdAsps,
  4811.                             pIdTrasformazione
  4812.                             );
  4813.                     e.add(de);
  4814.                    
  4815.                    
  4816.                     // Azioni
  4817.                     de = new DataElement();
  4818.                    
  4819.                     TrasformazioneRegolaApplicabilitaRichiesta applicabilita = regola.getApplicabilita();
  4820.                    
  4821.                     List<String> listaAzioni = applicabilita != null ? applicabilita.getAzioneList() : null;
  4822.                     String nomiAzioni = "";
  4823.                     if((listaAzioni != null && listaAzioni.size() > 0) && azioni.size()>0) {
  4824.                        
  4825.                         StringBuilder sb = new StringBuilder();
  4826.                         Iterator<String> itAz = azioni.keySet().iterator();
  4827.                         while (itAz.hasNext()) {
  4828.                             String idAzione = (String) itAz.next();
  4829.                             if(listaAzioni.contains(idAzione)) {
  4830.                                 if(sb.length() >0)
  4831.                                     sb.append(", ");
  4832.                                
  4833.                                 sb.append(azioni.get(idAzione));
  4834.                             }
  4835.                         }
  4836.                         nomiAzioni = sb.toString();
  4837.                     }
  4838.                    
  4839.                     if(StringUtils.isEmpty(nomiAzioni))
  4840.                         nomiAzioni = CostantiControlStation.LABEL_QUALSIASI;
  4841.                    
  4842.                     de.setValue(nomiAzioni);
  4843.                     de.setToolTip(nomiAzioni);
  4844.                     if(nomiAzioni!=null && nomiAzioni.length()>197) {
  4845.                         de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  4846.                                 pIdPorta,
  4847.                                 pIdSoggetto,
  4848.                                 pIdAsps,
  4849.                                 pIdTrasformazione
  4850.                                 );
  4851.                     }
  4852.                     de.setSize(200);

  4853.                     e.add(de);
  4854.                    

  4855.                     // Content-type
  4856.                    
  4857.                     String ct = "";
  4858.                     List<String> contentTypeList = applicabilita != null ? applicabilita.getContentTypeList() : null;
  4859.                     if(contentTypeList != null && contentTypeList.size() > 0) {
  4860.                         StringBuilder sb = new StringBuilder();
  4861.                         for (String string : contentTypeList) {
  4862.                             if(sb.length() >0)
  4863.                                 sb.append(", ");
  4864.                            
  4865.                             sb.append(string);
  4866.                         }
  4867.                         ct =sb.toString();
  4868.                     }
  4869.                    
  4870.                     if(StringUtils.isEmpty(ct))
  4871.                         ct = "&nbsp;";
  4872.                    
  4873.                    
  4874.                     de = new DataElement();
  4875.                     de.setValue(ct);
  4876.                     e.add(de);

  4877.                    
  4878.                     // Pattern
  4879.                     de = new DataElement();
  4880.                     String p = (applicabilita != null && applicabilita.getPattern() != null) ? applicabilita.getPattern() + "" : "&nbsp;";
  4881.                     de.setValue(p.length()>CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PATTERN_LIST_MAX_VALUE ?
  4882.                                 p.substring(0, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PATTERN_LIST_MAX_VALUE)+"..." :
  4883.                                 p);
  4884.                     e.add(de);
  4885.                    
  4886.                    
  4887.                     // Connettori
  4888.                     if(myPA!=null && myPA.getBehaviour()!=null && myPA.sizeServizioApplicativoList()>0) {
  4889.                        
  4890.                         de = new DataElement();
  4891.                        
  4892.                         List<String> listaConnettori = applicabilita != null ? applicabilita.getConnettoreList() : null;
  4893.                         String nomiConnettori = "";
  4894.                         if((listaConnettori != null && listaConnettori.size() > 0)) {
  4895.                             StringBuilder sb = new StringBuilder();
  4896.                             for (String sa : listaConnettori) {
  4897.                                 for (PortaApplicativaServizioApplicativo pasa : myPA.getServizioApplicativoList()) {
  4898.                                     if(pasa!=null && pasa.getNome()!=null && pasa.getNome().equals(sa)) {
  4899.                                         String nomeConnettoreMultiplo = pasa.getDatiConnettore()!= null ? pasa.getDatiConnettore().getNome() : null;
  4900.                                         if(nomeConnettoreMultiplo==null) {
  4901.                                             nomeConnettoreMultiplo=CostantiConfigurazione.NOME_CONNETTORE_DEFAULT;
  4902.                                         }
  4903.                                         if(sb.length() >0)
  4904.                                             sb.append(", ");
  4905.                                         sb.append(nomeConnettoreMultiplo);
  4906.                                         break;
  4907.                                     }
  4908.                                 }
  4909.                             }
  4910.                             nomiConnettori = sb.toString();
  4911.                         }
  4912.                        
  4913.                         if(StringUtils.isEmpty(nomiConnettori))
  4914.                             nomiConnettori = CostantiControlStation.LABEL_QUALSIASI;
  4915.                        
  4916.                         de.setValue(nomiConnettori);
  4917.                         de.setToolTip(nomiConnettori);
  4918.                         if(nomiConnettori!=null && nomiConnettori.length()>197) {
  4919.                             de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  4920.                                     pIdPorta,
  4921.                                     pIdSoggetto,
  4922.                                     pIdAsps,
  4923.                                     pIdTrasformazione
  4924.                                     );
  4925.                         }
  4926.                         de.setSize(200);

  4927.                         e.add(de);
  4928.                        
  4929.                     }
  4930.                    
  4931.                    
  4932.                     if(autenticazione || autenticazioneToken){
  4933.                        
  4934.                         String servletTrasformazioniAutorizzazioneAutenticati =   PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SOGGETTO_LIST;
  4935.                         List<Parameter> parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati = new ArrayList<>();
  4936.                         parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.add(pIdPorta);
  4937.                         parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.add(pIdSoggetto);
  4938.                         parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.add(pIdAsps);
  4939.                         parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.add(pIdTrasformazione);
  4940.                         parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.add(pFromList);
  4941.                         int numAutenticati = applicabilita != null ? applicabilita.sizeSoggettoList() : 0;
  4942.                        
  4943.                         de = new DataElement();
  4944.                         de.setUrl(servletTrasformazioniAutorizzazioneAutenticati, parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.toArray(new Parameter[parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.size()]));
  4945.                         if (contaListe) {
  4946.                             ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI,Long.valueOf(numAutenticati));
  4947.                         } else {
  4948.                             ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI);
  4949.                         }
  4950.                         e.add(de);
  4951.                     }
  4952.                    
  4953.                     if((isSupportatoAutenticazione && autenticazione) || (autenticazioneToken)) {
  4954.                        
  4955.                         String servletTrasformazioniApplicativiAutenticati = PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SERVIZIO_APPLICATIVO_AUTORIZZATO_LIST;
  4956.                         List<Parameter> parametriInvocazioneServletTrasformazioniApplicativiAutenticati  = new ArrayList<>();
  4957.                         parametriInvocazioneServletTrasformazioniApplicativiAutenticati.add(pIdPorta);
  4958.                         parametriInvocazioneServletTrasformazioniApplicativiAutenticati.add(pIdSoggetto);
  4959.                         parametriInvocazioneServletTrasformazioniApplicativiAutenticati.add(pIdAsps);
  4960.                         parametriInvocazioneServletTrasformazioniApplicativiAutenticati.add(pIdTrasformazione);
  4961.                         parametriInvocazioneServletTrasformazioniApplicativiAutenticati.add(pFromList);
  4962.                         int numApplicativiAutenticati = applicabilita != null ? applicabilita.sizeServizioApplicativoList() : 0;
  4963.                        
  4964.                         de = new DataElement();
  4965.                         de.setUrl(servletTrasformazioniApplicativiAutenticati, parametriInvocazioneServletTrasformazioniApplicativiAutenticati.toArray(new Parameter[parametriInvocazioneServletTrasformazioniApplicativiAutenticati.size()]));
  4966.                         String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI; // uso cmq label PD
  4967.                         if(!this.isModalitaCompleta()) {
  4968.                             labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;// uso cmq label PD
  4969.                         }
  4970.                         if (contaListe) {
  4971.                             ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numApplicativiAutenticati));
  4972.                         } else {
  4973.                             ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  4974.                         }
  4975.                         e.add(de);
  4976.                     }
  4977.                    
  4978.                     dati.add(e);
  4979.                     i++;
  4980.                 }
  4981.             }

  4982.             this.pd.setDati(dati);
  4983.             this.pd.setAddButton(true);

  4984.         } catch (Exception e) {
  4985.             this.logError(e.getMessage(), e);
  4986.             throw new ControlStationCoreException(e.getMessage(),e);
  4987.         }
  4988.     }
  4989.    
  4990.     public void preparePorteAppTrasformazioniRispostaList(String nomePorta,  long idTrasformazione, ISearch ricerca, List<TrasformazioneRegolaRisposta> lista) throws Exception {
  4991.         try {
  4992.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  4993.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  4994.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  4995.             if(idAsps == null)
  4996.                 idAsps = "";

  4997.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  4998.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  4999.            
  5000.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5001.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  5002.             Parameter pIdSoggetto = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  5003.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  5004.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA,
  5005.                     pIdPorta, pIdSoggetto, pIdAsps, pIdTrasformazione);

  5006.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTE;
  5007.             int limit = ricerca.getPageSize(idLista);
  5008.             int offset = ricerca.getIndexIniziale(idLista);

  5009.             this.pd.setIndex(offset);
  5010.             this.pd.setPageSize(limit);
  5011.             this.pd.setSearch("");
  5012.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  5013.             this.pd.setSearchDescription("");
  5014.            
  5015.             ServletUtils.disabledPageDataSearch(this.pd);

  5016.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5017.             String idporta = myPA.getNome();
  5018.            
  5019.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5020.             TrasformazioneRegola oldRegola = null;
  5021.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5022.                 if(reg.getId().longValue() == idTrasformazione) {
  5023.                     oldRegola = reg;
  5024.                     break;
  5025.                 }
  5026.             }
  5027.             if(oldRegola==null) {
  5028.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5029.             }
  5030.            
  5031.             String nomeTrasformazione = oldRegola.getNome();
  5032.            
  5033.             // setto la barra del titolo
  5034.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  5035.             String labelPerPorta = null;
  5036.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5037.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5038.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5039.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5040.                         myPA);
  5041.             }
  5042.             else {
  5043.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5044.             }
  5045.            
  5046.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5047.                     pIdPorta,
  5048.                     pIdSoggetto,
  5049.                     pIdAsps));
  5050.            
  5051.            
  5052.             lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5053.                     pIdPorta,
  5054.                     pIdSoggetto,
  5055.                     pIdAsps, pIdTrasformazione));
  5056.            
  5057.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTE;
  5058.            
  5059.             lstParam.add(new Parameter(labelPag,null));

  5060.             // setto la barra del titolo
  5061.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5062.            
  5063.             // imposta menu' contestuale
  5064.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  5065.             // setto le label delle colonne
  5066.             List<String> lstLabels = new ArrayList<>();
  5067.             if(lista != null && lista.size() > 1)
  5068.                 lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_POSIZIONE);
  5069.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_NOME);
  5070.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS);
  5071.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_CT);
  5072.             lstLabels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN);
  5073.            
  5074.             this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));

  5075.             // preparo i dati
  5076.             List<List<DataElement>> dati = new ArrayList<>();

  5077.             if (lista != null) {
  5078.                 Iterator<TrasformazioneRegolaRisposta> it = lista.iterator();
  5079.                 int numeroElementi = lista.size();
  5080.                 int i = 0;
  5081.                 while (it.hasNext()) {
  5082.                     TrasformazioneRegolaRisposta risposta = it.next();
  5083.                     Parameter pIdTrasformazioneRisposta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE_RISPOSTA, risposta.getId() + "");
  5084.                    
  5085.                     List<DataElement> e = new ArrayList<>();
  5086.                    
  5087.                     // Posizione
  5088.                     if(lista.size() > 1) {
  5089.                         DataElement de = new DataElement();
  5090.                         de.setWidthPx(48);
  5091.                         de.setType(DataElementType.IMAGE);
  5092.                         DataElementImage imageUp = new DataElementImage();
  5093.                         Parameter pDirezioneSu = new Parameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_POSIZIONE,
  5094.                                 CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
  5095.                         Parameter pDirezioneGiu = new Parameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_POSIZIONE,
  5096.                                 CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
  5097.                                
  5098.                         if(i > 0) {
  5099.                             imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
  5100.                             imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
  5101.                             imageUp.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_LIST, pIdPorta, pIdSoggetto, pIdAsps,pIdTrasformazione, pIdTrasformazioneRisposta, pDirezioneSu);
  5102.                         }
  5103.                         else {
  5104.                             imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
  5105.                         }
  5106.                         de.addImage(imageUp);
  5107.                        
  5108.                         if(i < numeroElementi -1) {
  5109.                             DataElementImage imageDown = new DataElementImage();
  5110.                             imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
  5111.                             imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
  5112.                             imageDown.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_LIST, pIdPorta, pIdSoggetto, pIdAsps,pIdTrasformazione, pIdTrasformazioneRisposta, pDirezioneGiu);
  5113.                             de.addImage(imageDown);
  5114.                         }
  5115.                         de.setValue(risposta.getPosizione()+"");
  5116.                         e.add(de);
  5117.                     }
  5118.                     // Nome
  5119.                     DataElement de = new DataElement();
  5120.                     de.setIdToRemove(risposta.getId() + "");
  5121.                     de.setValue(risposta.getNome());
  5122.                     de.setToolTip(risposta.getNome());
  5123.                    
  5124.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_CHANGE,
  5125.                             pIdPorta,
  5126.                             pIdSoggetto,
  5127.                             pIdAsps,
  5128.                             pIdTrasformazione,
  5129.                             pIdTrasformazioneRisposta
  5130.                             );
  5131.                     e.add(de);
  5132.                    
  5133.                    
  5134.                    
  5135.                     // Status Code
  5136.                     de = new DataElement();
  5137.                                        
  5138.                     TrasformazioneRegolaApplicabilitaRisposta applicabilita = risposta.getApplicabilita();
  5139.                    
  5140.                     Integer statusMin = applicabilita != null ? applicabilita.getReturnCodeMin() : null;
  5141.                     Integer statusMax = applicabilita != null ? applicabilita.getReturnCodeMax() : null;
  5142.                    
  5143.                     // se e' stato salvato il valore 0 lo tratto come null
  5144.                     if(statusMin != null && statusMin.intValue() <= 0) {
  5145.                         statusMin = null;
  5146.                     }
  5147.                    
  5148.                     if(statusMax != null && statusMax.intValue() <= 0) {
  5149.                         statusMax = null;
  5150.                     }
  5151.                    
  5152.                     String statusValue = null;
  5153.                     // Intervallo
  5154.                     if(statusMin != null && statusMax != null) {
  5155.                         if(statusMax.longValue() == statusMin.longValue()) // esatto
  5156.                             statusValue = statusMin + "";
  5157.                         else
  5158.                             statusValue = "[" + statusMin + " - " + statusMax + "]";
  5159.                     } else if(statusMin != null && statusMax == null) { // definito solo l'estremo inferiore
  5160.                         statusValue = "&gt;" + statusMin;
  5161.                     } else if(statusMin == null && statusMax != null) { // definito solo l'estremo superiore
  5162.                         statusValue = "&lt;" + statusMax;
  5163.                     } else { //entrambi null
  5164.                         statusValue = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI;
  5165.                     }
  5166.                    
  5167.                     de.setValue(statusValue);
  5168.                    
  5169.                     e.add(de);
  5170.                    
  5171.                    
  5172.                    
  5173.                     // Content-type
  5174.                     String ct = "";
  5175.                     List<String> contentTypeList = applicabilita != null ? applicabilita.getContentTypeList() : null;
  5176.                     if(contentTypeList != null && contentTypeList.size() > 0) {
  5177.                         StringBuilder sb = new StringBuilder();
  5178.                         for (String string : contentTypeList) {
  5179.                             if(sb.length() >0)
  5180.                                 sb.append(", ");
  5181.                            
  5182.                             sb.append(string);
  5183.                         }
  5184.                         ct =sb.toString();
  5185.                     }
  5186.                    
  5187.                     if(StringUtils.isEmpty(ct))
  5188.                         ct = "&nbsp;";
  5189.                    
  5190.                    
  5191.                     de = new DataElement();
  5192.                     de.setValue(ct);
  5193.                     e.add(de);

  5194.                    
  5195.                     // Pattern
  5196.                     de = new DataElement();
  5197.                     String p = (applicabilita != null && applicabilita.getPattern() != null) ? applicabilita.getPattern() + "" : "&nbsp;";
  5198.                     de.setValue(p.length()>CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PATTERN_LIST_MAX_VALUE ?
  5199.                                 p.substring(0, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PATTERN_LIST_MAX_VALUE)+"..." :
  5200.                                 p);
  5201.                     e.add(de);
  5202.                    
  5203.                    
  5204.                    
  5205.                     dati.add(e);
  5206.                     i++;
  5207.                 }
  5208.             }

  5209.             this.pd.setDati(dati);
  5210.             this.pd.setAddButton(true);

  5211.         } catch (Exception e) {
  5212.             this.logError(e.getMessage(), e);
  5213.             throw new ControlStationCoreException(e.getMessage(),e);
  5214.         }
  5215.     }
  5216.    
  5217.     public void preparePorteAppTrasformazioniRispostaHeaderList(String nomePorta,  long idTrasformazione, long idTrasformazioneRisposta,  ISearch ricerca, List<TrasformazioneRegolaParametro> lista) throws Exception {
  5218.         try {
  5219.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  5220.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  5221.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  5222.             if(idAsps == null)
  5223.                 idAsps = "";

  5224.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5225.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  5226.            
  5227.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5228.             Parameter pIdTrasformazioneRisposta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE_RISPOSTA, idTrasformazioneRisposta + "");
  5229.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADER,
  5230.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5231.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5232.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5233.                     pIdTrasformazione, pIdTrasformazioneRisposta);

  5234.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTE_HEADER;
  5235.             int limit = ricerca.getPageSize(idLista);
  5236.             int offset = ricerca.getIndexIniziale(idLista);

  5237.             this.pd.setIndex(offset);
  5238.             this.pd.setPageSize(limit);
  5239.             this.pd.setSearch("");
  5240.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  5241.             this.pd.setSearchDescription("");
  5242.            
  5243.             ServletUtils.disabledPageDataSearch(this.pd);

  5244.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5245.             String idporta = myPA.getNome();
  5246.            
  5247.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5248.             TrasformazioneRegola oldRegola = null;
  5249.             TrasformazioneRegolaRisposta oldRisposta = null;
  5250.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5251.                 if(reg.getId().longValue() == idTrasformazione) {
  5252.                     oldRegola = reg;
  5253.                     break;
  5254.                 }
  5255.             }
  5256.             if(oldRegola==null) {
  5257.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5258.             }
  5259.            
  5260.             for (int j = 0; j < oldRegola.sizeRispostaList(); j++) {
  5261.                 TrasformazioneRegolaRisposta risposta = oldRegola.getRisposta(j);
  5262.                 if (risposta.getId().longValue() == idTrasformazioneRisposta) {
  5263.                     oldRisposta = risposta;
  5264.                     break;
  5265.                 }
  5266.             }
  5267.             if(oldRisposta==null) {
  5268.                 throw new Exception("TrasformazioneRegolaRisposta con id '"+idTrasformazioneRisposta+"' non trovata");
  5269.             }
  5270.            
  5271.             String nomeRisposta = oldRisposta.getNome();
  5272.             String nomeTrasformazione = oldRegola.getNome();
  5273.            
  5274.             // setto la barra del titolo
  5275.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  5276.             String labelPerPorta = null;
  5277.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5278.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5279.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5280.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5281.                         myPA);
  5282.             }
  5283.             else {
  5284.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5285.             }
  5286.            
  5287.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5288.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5289.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5290.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  5291.            
  5292.            
  5293.             lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5294.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5295.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5296.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps), pIdTrasformazione));
  5297.            
  5298.             List<Parameter> parametriInvocazioneServletTrasformazioniRisposta = new ArrayList<>();
  5299.             parametriInvocazioneServletTrasformazioniRisposta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta));
  5300.             parametriInvocazioneServletTrasformazioniRisposta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg));
  5301.             parametriInvocazioneServletTrasformazioniRisposta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  5302.             parametriInvocazioneServletTrasformazioniRisposta.add(pIdTrasformazione);
  5303.            
  5304.             lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTE,PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_LIST,parametriInvocazioneServletTrasformazioniRisposta));
  5305.            
  5306.             lstParam.add(new Parameter(nomeRisposta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_CHANGE,
  5307.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5308.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5309.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5310.                     pIdTrasformazione,pIdTrasformazioneRisposta));
  5311.            
  5312.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADERS;
  5313.            
  5314.             lstParam.add(new Parameter(labelPag,null));

  5315.             // setto la barra del titolo
  5316.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5317.            
  5318.             // imposta menu' contestuale
  5319.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  5320.             // setto le label delle colonne
  5321.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME,
  5322.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO,
  5323.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE};
  5324.             this.pd.setLabels(labels);

  5325.             // preparo i dati
  5326.             List<List<DataElement>> dati = new ArrayList<>();

  5327.             if (lista != null) {
  5328.                 Iterator<TrasformazioneRegolaParametro> it = lista.iterator();
  5329.                 while (it.hasNext()) {
  5330.                     TrasformazioneRegolaParametro parametro = it.next();

  5331.                     List<DataElement> e = new ArrayList<>();
  5332.                    
  5333.                     // Nome
  5334.                     DataElement de = new DataElement();
  5335.                     de.setIdToRemove(parametro.getId() + "");
  5336.                     de.setValue(parametro.getNome());
  5337.                    
  5338.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_HEADER_CHANGE,
  5339.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5340.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5341.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5342.                             pIdTrasformazione,
  5343.                             pIdTrasformazioneRisposta,
  5344.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE_RISPOSTA_HEADER, parametro.getId() + "")
  5345.                             );
  5346.                     e.add(de);
  5347.                    
  5348.                     // Tipo
  5349.                     de = new DataElement();
  5350.                     de.setValue(parametro.getConversioneTipo().getValue());
  5351.                     e.add(de);
  5352.                    
  5353.                     // Valore
  5354.                     de = new DataElement();
  5355.                     de.setValue(StringUtils.isNotEmpty(parametro.getValore()) ? this.formatInfoForView(parametro.getValore()) :  "&nbsp;" );
  5356.                     if(StringUtils.isNotEmpty(parametro.getValore())) {
  5357.                         de.setToolTip(parametro.getValore());
  5358.                     }
  5359.                     e.add(de);

  5360.                     dati.add(e);
  5361.                 }
  5362.             }

  5363.             this.pd.setDati(dati);
  5364.             this.pd.setAddButton(true);

  5365.         } catch (Exception e) {
  5366.             this.logError(e.getMessage(), e);
  5367.             throw new ControlStationCoreException(e.getMessage(),e);
  5368.         }
  5369.     }
  5370.    
  5371.     public void preparePorteAppTrasformazioniRichiestaHeaderList(String nomePorta,  long idTrasformazione, ISearch ricerca, List<TrasformazioneRegolaParametro> lista) throws Exception {
  5372.         try {
  5373.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  5374.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  5375.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  5376.             if(idAsps == null)
  5377.                 idAsps = "";

  5378.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5379.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  5380.            
  5381.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5382.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER,
  5383.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5384.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5385.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5386.                     pIdTrasformazione);

  5387.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER;
  5388.             int limit = ricerca.getPageSize(idLista);
  5389.             int offset = ricerca.getIndexIniziale(idLista);

  5390.             this.pd.setIndex(offset);
  5391.             this.pd.setPageSize(limit);
  5392.             this.pd.setSearch("");
  5393.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  5394.             this.pd.setSearchDescription("");
  5395.            
  5396.             ServletUtils.disabledPageDataSearch(this.pd);

  5397.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5398.             String idporta = myPA.getNome();
  5399.            
  5400.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5401.             TrasformazioneRegola oldRegola = null;
  5402.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5403.                 if(reg.getId().longValue() == idTrasformazione) {
  5404.                     oldRegola = reg;
  5405.                     break;
  5406.                 }
  5407.             }
  5408.             if(oldRegola==null) {
  5409.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5410.             }
  5411.            
  5412.             String nomeTrasformazione = oldRegola.getNome();
  5413.            
  5414.             // setto la barra del titolo
  5415.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  5416.             String labelPerPorta = null;
  5417.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5418.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5419.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5420.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5421.                         myPA);
  5422.             }
  5423.             else {
  5424.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5425.             }
  5426.            
  5427.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5428.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5429.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5430.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  5431.            
  5432.            
  5433.             lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5434.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5435.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5436.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps), pIdTrasformazione));
  5437.            
  5438.             List<Parameter> parametriInvocazioneServletTrasformazioniRichiesta = new ArrayList<>();
  5439.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta));
  5440.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg));
  5441.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  5442.             parametriInvocazioneServletTrasformazioniRichiesta.add(pIdTrasformazione);
  5443.            
  5444.             lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA,
  5445.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA,parametriInvocazioneServletTrasformazioniRichiesta));
  5446.            
  5447.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADERS;
  5448.            
  5449.             lstParam.add(new Parameter(labelPag,null));

  5450.             // setto la barra del titolo
  5451.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5452.            
  5453.             // imposta menu' contestuale
  5454.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  5455.             // setto le label delle colonne
  5456.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME,
  5457.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO,
  5458.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE};
  5459.             this.pd.setLabels(labels);

  5460.             // preparo i dati
  5461.             List<List<DataElement>> dati = new ArrayList<>();

  5462.             if (lista != null) {
  5463.                 Iterator<TrasformazioneRegolaParametro> it = lista.iterator();
  5464.                 while (it.hasNext()) {
  5465.                     TrasformazioneRegolaParametro parametro = it.next();

  5466.                     List<DataElement> e = new ArrayList<>();
  5467.                    
  5468.                     // Nome
  5469.                     DataElement de = new DataElement();
  5470.                     de.setIdToRemove(parametro.getId() + "");
  5471.                     de.setValue(parametro.getNome());
  5472.                    
  5473.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_HEADER_CHANGE,
  5474.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5475.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5476.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5477.                             pIdTrasformazione,
  5478.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE_RICHIESTA_HEADER, parametro.getId() + "")
  5479.                             );
  5480.                     e.add(de);
  5481.                    
  5482.                     // Tipo
  5483.                     de = new DataElement();
  5484.                     de.setValue(parametro.getConversioneTipo().getValue());
  5485.                     e.add(de);
  5486.                    
  5487.                     // Valore
  5488.                     de = new DataElement();
  5489.                     de.setValue(StringUtils.isNotEmpty(parametro.getValore()) ? this.formatInfoForView(parametro.getValore()) :  "&nbsp;" );
  5490.                     if(StringUtils.isNotEmpty(parametro.getValore())) {
  5491.                         de.setToolTip(parametro.getValore());
  5492.                     }
  5493.                     e.add(de);

  5494.                     dati.add(e);
  5495.                 }
  5496.             }

  5497.             this.pd.setDati(dati);
  5498.             this.pd.setAddButton(true);

  5499.         } catch (Exception e) {
  5500.             this.logError(e.getMessage(), e);
  5501.             throw new ControlStationCoreException(e.getMessage(),e);
  5502.         }
  5503.     }
  5504.    
  5505.     public void preparePorteAppTrasformazioniRichiestaUrlParameterList(String nomePorta,  long idTrasformazione, ISearch ricerca, List<TrasformazioneRegolaParametro> lista) throws Exception {
  5506.         try {
  5507.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  5508.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  5509.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  5510.             if(idAsps == null)
  5511.                 idAsps = "";

  5512.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5513.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  5514.            
  5515.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5516.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRO,
  5517.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5518.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5519.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5520.                     pIdTrasformazione);

  5521.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRI;
  5522.             int limit = ricerca.getPageSize(idLista);
  5523.             int offset = ricerca.getIndexIniziale(idLista);

  5524.             this.pd.setIndex(offset);
  5525.             this.pd.setPageSize(limit);
  5526.             this.pd.setSearch("");
  5527.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  5528.             this.pd.setSearchDescription("");
  5529.            
  5530.             ServletUtils.disabledPageDataSearch(this.pd);

  5531.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5532.             String idporta = myPA.getNome();
  5533.            
  5534.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5535.             TrasformazioneRegola oldRegola = null;
  5536.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5537.                 if(reg.getId().longValue() == idTrasformazione) {
  5538.                     oldRegola = reg;
  5539.                     break;
  5540.                 }
  5541.             }
  5542.             if(oldRegola==null) {
  5543.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5544.             }
  5545.            
  5546.             String nomeTrasformazione = oldRegola.getNome();
  5547.            
  5548.             // setto la barra del titolo
  5549.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  5550.             String labelPerPorta = null;
  5551.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5552.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5553.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5554.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5555.                         myPA);
  5556.             }
  5557.             else {
  5558.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5559.             }
  5560.            
  5561.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5562.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5563.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5564.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  5565.            
  5566.            
  5567.             lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5568.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5569.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5570.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps), pIdTrasformazione));
  5571.            
  5572.             List<Parameter> parametriInvocazioneServletTrasformazioniRichiesta = new ArrayList<>();
  5573.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta));
  5574.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg));
  5575.             parametriInvocazioneServletTrasformazioniRichiesta.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  5576.             parametriInvocazioneServletTrasformazioniRichiesta.add(pIdTrasformazione);
  5577.            
  5578.             lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA,
  5579.                     PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA,parametriInvocazioneServletTrasformazioniRichiesta));
  5580.            
  5581.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRI;
  5582.            
  5583.             lstParam.add(new Parameter(labelPag,null));

  5584.             // setto la barra del titolo
  5585.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5586.            
  5587.             // imposta menu' contestuale
  5588.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  5589.             // setto le label delle colonne
  5590.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME,
  5591.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO,
  5592.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE};
  5593.             this.pd.setLabels(labels);

  5594.             // preparo i dati
  5595.             List<List<DataElement>> dati = new ArrayList<>();

  5596.             if (lista != null) {
  5597.                 Iterator<TrasformazioneRegolaParametro> it = lista.iterator();
  5598.                 while (it.hasNext()) {
  5599.                     TrasformazioneRegolaParametro parametro = it.next();

  5600.                     List<DataElement> e = new ArrayList<>();
  5601.                    
  5602.                     // Nome
  5603.                     DataElement de = new DataElement();
  5604.                     de.setIdToRemove(parametro.getId() + "");
  5605.                     de.setValue(parametro.getNome());
  5606.                    
  5607.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_CHANGE,
  5608.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta),
  5609.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  5610.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps),
  5611.                             pIdTrasformazione,
  5612.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE_RICHIESTA_PARAMETRO, parametro.getId() + "")
  5613.                             );
  5614.                     e.add(de);
  5615.                    
  5616.                     // Tipo
  5617.                     de = new DataElement();
  5618.                     de.setValue(parametro.getConversioneTipo().getValue());
  5619.                     e.add(de);
  5620.                    
  5621.                     // Valore
  5622.                     de = new DataElement();
  5623.                     de.setValue(StringUtils.isNotEmpty(parametro.getValore()) ? this.formatInfoForView(parametro.getValore()) :  "&nbsp;" );
  5624.                     if(StringUtils.isNotEmpty(parametro.getValore())) {
  5625.                         de.setToolTip(parametro.getValore());
  5626.                     }
  5627.                     e.add(de);

  5628.                     dati.add(e);
  5629.                 }
  5630.             }

  5631.             this.pd.setDati(dati);
  5632.             this.pd.setAddButton(true);

  5633.         } catch (Exception e) {
  5634.             this.logError(e.getMessage(), e);
  5635.             throw new ControlStationCoreException(e.getMessage(),e);
  5636.         }
  5637.     }
  5638.    
  5639.    
  5640.     public void preparePorteAppTrasformazioniServizioApplicativoAutorizzatoList(String nomePorta, long idTrasformazione, ISearch ricerca, List<TrasformazioneRegolaApplicabilitaServizioApplicativo> lista) throws Exception {
  5641.         try {
  5642.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  5643.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  5644.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  5645.             if(idAsps == null)
  5646.                 idAsps = "";
  5647.    
  5648.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5649.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  5650.            
  5651.             String listaTmp = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_LIST);
  5652.             boolean fromList = false;
  5653.             if(listaTmp != null && !"".equals(listaTmp))
  5654.                 fromList = true;
  5655.            
  5656.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5657.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  5658.             Parameter pIdSoggetto = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  5659.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  5660.    
  5661.             List<Parameter> parameters = new ArrayList<>();
  5662.             parameters.add(pIdPorta);
  5663.             parameters.add(pIdSoggetto);
  5664.             parameters.add(pIdAsps);
  5665.             parameters.add(pIdTrasformazione);
  5666.             if(fromList) {
  5667.                 parameters.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_LIST, listaTmp));
  5668.             }
  5669.            
  5670.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SERVIZIO_APPLICATIVO_AUTORIZZATO,
  5671.                     parameters);
  5672.    
  5673.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_SERVIZIO_APPLICATIVO_AUTORIZZATO;
  5674.             int limit = ricerca.getPageSize(idLista);
  5675.             int offset = ricerca.getIndexIniziale(idLista);
  5676.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);
  5677.    
  5678.             this.pd.setIndex(offset);
  5679.             this.pd.setPageSize(limit);
  5680.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  5681.    
  5682.             String protocollo = null;
  5683.             if(this.core.isRegistroServiziLocale()){
  5684.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  5685.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  5686.             }
  5687.             else{
  5688.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  5689.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  5690.             }
  5691.    
  5692.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5693.             String idporta = myPA.getNome();
  5694.            
  5695.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5696.             TrasformazioneRegola oldRegola = null;
  5697.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5698.                 if(reg.getId().longValue() == idTrasformazione) {
  5699.                     oldRegola = reg;
  5700.                     break;
  5701.                 }
  5702.             }
  5703.             if(oldRegola==null) {
  5704.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5705.             }
  5706.    
  5707.             String nomeTrasformazione = oldRegola.getNome();
  5708.            
  5709.             // setto la barra del titolo
  5710.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  5711.    
  5712.             String labelPerPorta = null;
  5713.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5714.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5715.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5716.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5717.                         myPA);
  5718.             }
  5719.             else {
  5720.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5721.             }
  5722.            
  5723.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5724.                     pIdPorta,
  5725.                     pIdSoggetto,
  5726.                     pIdAsps));
  5727.            
  5728.             if(!fromList) {
  5729.                 lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5730.                         pIdPorta,
  5731.                         pIdSoggetto,
  5732.                         pIdAsps, pIdTrasformazione));
  5733.             }
  5734.            
  5735.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICATIVI_CONFIG;
  5736.            
  5737.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  5738.             if(search.equals("")){
  5739.                 this.pd.setSearchDescription("");
  5740.                 lstParam.add(new Parameter(labelPag,null));
  5741.             }else{
  5742.                 lstParam.add(new Parameter(labelPag,
  5743.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SERVIZIO_APPLICATIVO_AUTORIZZATO_LIST,
  5744.                         pIdPorta, pIdSoggetto, pIdAsps, pIdTrasformazione));
  5745.                
  5746.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  5747.             }
  5748.    
  5749.             // setto la barra del titolo
  5750.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5751.            
  5752.             // imposta menu' contestuale
  5753.             this.impostaComandiMenuContestualePA(idsogg, idAsps);
  5754.    
  5755.             // controllo eventuali risultati ricerca
  5756.     //          if (!search.equals("")) {
  5757.     //              this.pd.setSearch("on");
  5758.     //              this.pd.setSearchDescription("Soggetti contenenti la stringa '" + search + "'");
  5759.     //          }
  5760.    
  5761.             // setto le label delle colonne
  5762.             List<String> labels = new ArrayList<>();
  5763.             if(this.porteApplicativeCore.isMultitenant()) {
  5764.                 labels.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  5765.             }
  5766.             labels.add(CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO);
  5767.             this.pd.setLabels(labels.toArray(new String[1]));
  5768.    
  5769.             // preparo i dati
  5770.             List<List<DataElement>> dati = new ArrayList<>();
  5771.    
  5772.             if (lista != null) {
  5773.                 Iterator<TrasformazioneRegolaApplicabilitaServizioApplicativo> it = lista.iterator();
  5774.                 while (it.hasNext()) {
  5775.                     TrasformazioneRegolaApplicabilitaServizioApplicativo sa = it.next();
  5776.    
  5777.                     List<DataElement> e = new ArrayList<>();
  5778.    
  5779.                     if(this.porteApplicativeCore.isMultitenant()) {
  5780.                         Long idSoggetto =this.soggettiCore.getIdSoggetto(sa.getNomeSoggettoProprietario(), sa.getTipoSoggettoProprietario());  
  5781.                         DataElement de = new DataElement();
  5782.                         if(this.isModalitaCompleta()) {
  5783.                             de.setUrl(SoggettiCostanti.SERVLET_NAME_SOGGETTI_CHANGE,
  5784.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID,idSoggetto+""),
  5785.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_NOME,sa.getNomeSoggettoProprietario()),
  5786.                                     new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_TIPO,sa.getTipoSoggettoProprietario()));
  5787.                         }
  5788.                         de.setValue(this.getLabelNomeSoggetto(protocollo, sa.getTipoSoggettoProprietario() , sa.getNomeSoggettoProprietario()));
  5789.                         e.add(de);
  5790.                     }
  5791.                    
  5792.                    
  5793.                     DataElement de = new DataElement();
  5794.                     de.setValue(sa.getNome());
  5795.                     de.setIdToRemove(sa.getNome()+"@"+sa.getTipoSoggettoProprietario() + "/" + sa.getNomeSoggettoProprietario());
  5796.                     e.add(de);
  5797.    
  5798.                     dati.add(e);
  5799.                 }
  5800.             }
  5801.    
  5802.             this.pd.setDati(dati);
  5803.             this.pd.setAddButton(true);
  5804.    
  5805.         } catch (Exception e) {
  5806.             this.logError(e.getMessage(), e);
  5807.             throw new ControlStationCoreException(e.getMessage(),e);
  5808.         }
  5809.     }

  5810. // Prepara la lista di soggetti associati alla pa
  5811.     public void preparePorteAppTrasformazioniSoggettoList(String nomePorta, long idTrasformazione, ISearch ricerca, List<TrasformazioneRegolaApplicabilitaSoggetto> lista) throws Exception {
  5812.         try {
  5813.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  5814.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  5815.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  5816.             if(idAsps == null)
  5817.                 idAsps = "";

  5818.             String listaTmp = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_LIST);
  5819.             boolean fromList = false;
  5820.             if(listaTmp != null && !"".equals(listaTmp))
  5821.                 fromList = true;
  5822.            
  5823.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5824.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  5825.            
  5826.             Parameter pIdTrasformazione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE, idTrasformazione+"");
  5827.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  5828.             Parameter pIdSoggetto = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  5829.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);

  5830.             List<Parameter> parameters = new ArrayList<>();
  5831.             parameters.add(pIdPorta);
  5832.             parameters.add(pIdSoggetto);
  5833.             parameters.add(pIdAsps);
  5834.             parameters.add(pIdTrasformazione);
  5835.             if(fromList) {
  5836.                 parameters.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA_LIST, listaTmp));
  5837.             }
  5838.            
  5839.             ServletUtils.addListElementIntoSession(this.request, this.session,  PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SOGGETTO,
  5840.                     parameters);

  5841.             int idLista = Liste.PORTE_APPLICATIVE_TRASFORMAZIONI_SOGGETTO;
  5842.             int limit = ricerca.getPageSize(idLista);
  5843.             int offset = ricerca.getIndexIniziale(idLista);
  5844.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  5845.             this.pd.setIndex(offset);
  5846.             this.pd.setPageSize(limit);
  5847.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  5848.             String protocollo = null;
  5849.             if(this.core.isRegistroServiziLocale()){
  5850.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(Integer.parseInt(idsogg));
  5851.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  5852.             }
  5853.             else{
  5854.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(Integer.parseInt(idsogg));
  5855.                 protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(mySogg.getTipo());
  5856.             }

  5857.             PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  5858.             String idporta = myPA.getNome();
  5859.            
  5860.             Trasformazioni trasformazioni = myPA.getTrasformazioni();
  5861.             TrasformazioneRegola oldRegola = null;
  5862.             for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5863.                 if(reg.getId().longValue() == idTrasformazione) {
  5864.                     oldRegola = reg;
  5865.                     break;
  5866.                 }
  5867.             }
  5868.             if(oldRegola==null) {
  5869.                 throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  5870.             }

  5871.             String nomeTrasformazione = oldRegola.getNome();

  5872.             // setto la barra del titolo
  5873.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);

  5874.             String labelPerPorta = null;
  5875.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  5876.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  5877.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI,
  5878.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI,
  5879.                         myPA);
  5880.             }
  5881.             else {
  5882.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_DI+idporta;
  5883.             }
  5884.            
  5885.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_LIST,
  5886.                     pIdPorta,
  5887.                     pIdSoggetto,
  5888.                     pIdAsps));
  5889.            
  5890.             if(!fromList) {
  5891.                 lstParam.add(new Parameter(nomeTrasformazione, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_CHANGE,
  5892.                         pIdPorta,
  5893.                         pIdSoggetto,
  5894.                         pIdAsps, pIdTrasformazione));
  5895.             }
  5896.            
  5897.             String labelPag = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_SOGGETTO_CONFIG;
  5898.            
  5899.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME);
  5900.             if(search.equals("")){
  5901.                 this.pd.setSearchDescription("");
  5902.                 lstParam.add(new Parameter(labelPag,null));
  5903.             }else{
  5904.                 lstParam.add(new Parameter(labelPag,
  5905.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_TRASFORMAZIONI_SOGGETTO_LIST ,
  5906.                         pIdPorta, pIdSoggetto, pIdAsps, pIdTrasformazione));
  5907.                
  5908.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  5909.             }

  5910.             // setto la barra del titolo
  5911.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  5912.            
  5913.             // imposta menu' contestuale
  5914.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  5915.             // controllo eventuali risultati ricerca
  5916. //              if (!search.equals("")) {
  5917. //                  this.pd.setSearch("on");
  5918. //                  this.pd.setSearchDescription("Soggetti contenenti la stringa '" + search + "'");
  5919. //              }

  5920.             // setto le label delle colonne
  5921.             String[] labels = { PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTO};
  5922.             this.pd.setLabels(labels);

  5923.             // preparo i dati
  5924.             List<List<DataElement>> dati = new ArrayList<>();

  5925.             if (lista != null) {
  5926.                 Iterator<TrasformazioneRegolaApplicabilitaSoggetto> it = lista.iterator();
  5927.                 while (it.hasNext()) {
  5928.                     TrasformazioneRegolaApplicabilitaSoggetto sog = it.next();

  5929.                     List<DataElement> e = new ArrayList<>();

  5930.                     Long idSoggetto =this.soggettiCore.getIdSoggetto(sog.getNome(), sog.getTipo());
  5931.                     DataElement de = new DataElement();
  5932.                     if(this.isModalitaCompleta()) {
  5933.                         de.setUrl(SoggettiCostanti.SERVLET_NAME_SOGGETTI_CHANGE,
  5934.                                 new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID,idSoggetto+""),
  5935.                                 new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_NOME,sog.getNome()),
  5936.                                 new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_TIPO,sog.getTipo()));
  5937.                     }
  5938.                     de.setValue(this.getLabelNomeSoggetto(protocollo, sog.getTipo() , sog.getNome()));
  5939.                     de.setIdToRemove(sog.getTipo() + "/" + sog.getNome());
  5940.                     e.add(de);

  5941.                     dati.add(e);
  5942.                 }
  5943.             }

  5944.             this.pd.setDati(dati);
  5945.             this.pd.setAddButton(true);

  5946.         } catch (Exception e) {
  5947.             this.logError(e.getMessage(), e);
  5948.             throw new ControlStationCoreException(e.getMessage(),e);
  5949.         }
  5950.     }
  5951.    
  5952.     // Controlla i dati dell soggetto della porta applicativa
  5953.     public boolean porteAppTrasformazioniSoggettoCheckData(TipoOperazione tipoOp) throws Exception {
  5954.         try {
  5955.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  5956.             int idInt = Integer.parseInt(idPorta);
  5957.             String soggetto = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  5958.             if (soggetto == null) {
  5959.                 soggetto = "";
  5960.             }

  5961.             // Campi obbligatori
  5962.             if (soggetto.equals("")) {
  5963.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_SOGGETTO);
  5964.                 return false;
  5965.             }

  5966.             long idSoggetto = Integer.parseInt(soggetto);
  5967.             // Controllo che il servizioApplicativo appartenga alla lista di
  5968.             // servizioApplicativo disponibili per il soggetto
  5969.             // Prendo il nome e il tipo del soggetto
  5970.             String nomeSoggettoSelezionato = null;
  5971.             String tipoSoggettoSelezionato = null;
  5972.             if(this.core.isRegistroServiziLocale()){
  5973.                 Soggetto mySogg = this.soggettiCore.getSoggettoRegistro(idSoggetto);
  5974.                 nomeSoggettoSelezionato = mySogg.getNome();
  5975.                 tipoSoggettoSelezionato = mySogg.getTipo();
  5976.             }else{
  5977.                 org.openspcoop2.core.config.Soggetto mySogg = this.soggettiCore.getSoggetto(idSoggetto);
  5978.                 nomeSoggettoSelezionato = mySogg.getNome();
  5979.                 tipoSoggettoSelezionato = mySogg.getTipo();
  5980.             }

  5981.             // Se tipoOp = add, controllo che il servizioApplicativo non sia
  5982.             // gia'
  5983.             // stato
  5984.             // registrato per la porta applicativa
  5985.             if (tipoOp.equals(TipoOperazione.ADD)) {
  5986.                 boolean giaRegistrato = false;

  5987.                 // Prendo il nome della porta applicativa
  5988.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  5989.                
  5990.                
  5991.                 String idTrasformazioneS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_TRASFORMAZIONE);
  5992.                 long idTrasformazione = Long.parseLong(idTrasformazioneS);
  5993.                
  5994.                 Trasformazioni trasformazioni = pa.getTrasformazioni();
  5995.                 TrasformazioneRegola regola = null;
  5996.                 for (TrasformazioneRegola reg : trasformazioni.getRegolaList()) {
  5997.                     if(reg.getId().longValue() == idTrasformazione) {
  5998.                         regola = reg;
  5999.                         break;
  6000.                     }
  6001.                 }
  6002.                 if(regola==null) {
  6003.                     throw new Exception("TrasformazioneRegola con id '"+idTrasformazione+"' non trovata");
  6004.                 }
  6005.                
  6006. //              String nometrasformazione = regola.getNome();

  6007.                 TrasformazioneRegolaApplicabilitaRichiesta applicabilita = regola.getApplicabilita();
  6008.                 if(applicabilita != null) {
  6009.                     for (int i = 0; i < applicabilita.sizeSoggettoList(); i++) {
  6010.                         TrasformazioneRegolaApplicabilitaSoggetto tmpSoggetto = applicabilita.getSoggetto(i);
  6011.                         if (tipoSoggettoSelezionato.equals(tmpSoggetto.getTipo()) && nomeSoggettoSelezionato.equals(tmpSoggetto.getNome())) {
  6012.                             giaRegistrato = true;
  6013.                             break;
  6014.                         }
  6015.                     }
  6016.                 }

  6017.                 if (giaRegistrato) {
  6018.                     String nomeSoggettoMessaggio = tipoSoggettoSelezionato + "/"+ nomeSoggettoSelezionato;
  6019.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_IL_SOGGETTO_XX_EGRAVE_GIA_STATO_ASSOCIATO_ALLA_TRASFORMAZIONE,
  6020.                             nomeSoggettoMessaggio));
  6021.                     return false;
  6022.                 }
  6023.             }

  6024.             return true;
  6025.         } catch (Exception e) {
  6026.             this.logError(e.getMessage(), e);
  6027.             throw new ControlStationCoreException(e.getMessage(),e);
  6028.         }
  6029.     }


  6030.    
  6031.     // Controlla i dati dell soggetto della porta applicativa
  6032.     public boolean porteAppTrasformazioniServizioApplicativoAutorizzatiCheckData(TipoOperazione tipoOp) throws Exception {
  6033.         try {
  6034.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  6035.             @SuppressWarnings("unused")
  6036.             int idInt = Integer.parseInt(idPorta);
  6037.             String soggetto = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SOGGETTO);
  6038.             if (soggetto == null) {
  6039.                 soggetto = "";
  6040.             }
  6041.             String sa = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SERVIZIO_APPLICATIVO_AUTORIZZATO);
  6042.             if (sa == null) {
  6043.                 sa = "";
  6044.             }

  6045.             // Campi obbligatori
  6046.             if (soggetto.equals("")) {
  6047.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_SOGGETTO);
  6048.                 return false;
  6049.             }
  6050.             if (sa.equals("")) {
  6051.                 this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UN_APPLICATIVO);
  6052.                 return false;
  6053.             }

  6054.             return true;
  6055.         } catch (Exception e) {
  6056.             this.logError(e.getMessage(), e);
  6057.             throw new ControlStationCoreException(e.getMessage(),e);
  6058.         }
  6059.     }
  6060.    
  6061.     public void preparePorteApplicativeAutenticazioneCustomPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista) throws Exception {
  6062.         try {
  6063.             if(nomePorta!=null) {
  6064.                 // nop
  6065.             }
  6066.            
  6067.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  6068.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6069.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  6070.             if(idAsps == null)
  6071.                 idAsps = "";

  6072.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  6073.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  6074.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_AUTENTICAZIONE_CUSTOM_PROPERTIES,
  6075.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6076.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6077.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  6078.             int idLista = Liste.PORTE_APPLICATIVE_PROPRIETA_AUTENTICAZIONE;
  6079.             int limit = ricerca.getPageSize(idLista);
  6080.             int offset = ricerca.getIndexIniziale(idLista);
  6081.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  6082.             this.pd.setIndex(offset);
  6083.             this.pd.setPageSize(limit);
  6084.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  6085.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  6086.             String idporta = pa.getNome();

  6087.             // setto la barra del titolo
  6088.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  6089.            
  6090.             String labelPerPorta = null;
  6091.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6092.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  6093.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  6094.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6095.                         pa);
  6096.             }
  6097.             else {
  6098.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  6099.             }
  6100.            
  6101.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6102.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6103.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6104.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  6105.            
  6106.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTENTICAZIONE_PROPRIETA;
  6107.            
  6108.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  6109.             if(search.equals("")){
  6110.                 this.pd.setSearchDescription("");
  6111.                 lstParam.add(new Parameter(labelPagLista,null));
  6112.             }
  6113.             else{
  6114.                 lstParam.add(new Parameter(labelPagLista,
  6115.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTENTICAZIONE_CUSTOM_PROPERTIES_LIST,
  6116.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  6117.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  6118.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  6119.                         ));
  6120.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  6121.             }

  6122.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  6123.            
  6124.             // imposta menu' contestuale
  6125.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  6126.             // controllo eventuali risultati ricerca
  6127.             if (!search.equals("")) {
  6128.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTENTICAZIONE_PROPRIETA, search);
  6129.             }

  6130.             // setto le label delle colonne
  6131.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_NOME , CostantiControlStation.LABEL_PARAMETRO_VALORE };
  6132.             this.pd.setLabels(labels);

  6133.             // preparo i dati
  6134.             List<List<DataElement>> dati = new ArrayList<>();

  6135.             if (lista != null) {
  6136.                 Iterator<Proprieta> it = lista.iterator();
  6137.                 while (it.hasNext()) {
  6138.                     Proprieta proprieta = it.next();
  6139.        
  6140.                     List<DataElement> e = new ArrayList<>();
  6141.        
  6142.                     DataElement de = new DataElement();
  6143.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTENTICAZIONE_CUSTOM_PROPERTIES_CHANGE,
  6144.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6145.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6146.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, proprieta.getNome()),
  6147.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  6148.                     de.setValue(proprieta.getNome());
  6149.                     de.setIdToRemove(proprieta.getId() + "");
  6150.                     de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
  6151.                     e.add(de);
  6152.                    
  6153.                     de = new DataElement();
  6154.                     if(StringUtils.isNotEmpty(proprieta.getValore()) &&
  6155.                             BYOKManager.isEnabledBYOK() &&
  6156.                             this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(proprieta.getValore())) {
  6157.                         de.setValue(CostantiControlStation.VALORE_CIFRATO);
  6158.                     }
  6159.                     else {
  6160.                         de.setValue(proprieta.getValore());
  6161.                     }
  6162.                     e.add(de);
  6163.        
  6164.                     dati.add(e);
  6165.                 }
  6166.             }

  6167.             this.pd.setDati(dati);
  6168.             this.pd.setAddButton(true);

  6169.         } catch (Exception e) {
  6170.             this.logError(e.getMessage(), e);
  6171.             throw new ControlStationCoreException(e.getMessage(),e);
  6172.         }
  6173.     }
  6174.    
  6175.     public boolean proprietaAutenticazioneCheckData(TipoOperazione tipoOp, String idPorta, String nome,String valore) throws ControlStationCoreException {
  6176.         try {
  6177.             // Campi obbligatori
  6178.             if (nome.equals("") || valore.equals("")) {
  6179.                 String tmpElenco = "";
  6180.                 if (nome.equals("")) {
  6181.                     tmpElenco = "Nome";
  6182.                 }
  6183.                 if (valore.equals("")) {
  6184.                     if (tmpElenco.equals("")) {
  6185.                         tmpElenco = "Valore";
  6186.                     } else {
  6187.                         tmpElenco = tmpElenco + ", Valore";
  6188.                     }
  6189.                 }
  6190.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  6191.                 return false;
  6192.             }
  6193.            
  6194.             if (nome.indexOf(" ") != -1) {
  6195.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  6196.                 return false;
  6197.             }
  6198.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  6199.                 return false;
  6200.             }
  6201.            
  6202.             if(
  6203.                     ( !this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore) )
  6204.                     &&
  6205.                     (!this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE))
  6206.                 ){
  6207.                 return false;
  6208.             }
  6209.            
  6210.             // Se tipoOp = add, controllo che la property non sia gia'
  6211.             // stata
  6212.             // registrata per la porta applicativa
  6213.             if (tipoOp.equals(TipoOperazione.ADD)) {
  6214.                 boolean giaRegistrato = false;
  6215.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  6216.                 String nomeporta = pa.getNome();

  6217.                 for (int i = 0; i < pa.sizeProprietaAutenticazioneList(); i++) {
  6218.                     Proprieta tmpProp = pa.getProprietaAutenticazione(i);
  6219.                     if (nome.equals(tmpProp.getNome())) {
  6220.                         giaRegistrato = true;
  6221.                         break;
  6222.                     }
  6223.                 }

  6224.                 if (giaRegistrato) {
  6225.                     Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6226.                     if(parentPA == null) parentPA = PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE;
  6227.                    
  6228.                     if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6229.                         nomeporta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(null,null, pa);
  6230.                         this.pd.setMessage(MessageFormat.format(
  6231.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_CONFIGURAZIONE_YY, nome,
  6232.                                 nomeporta));
  6233.                     } else {
  6234.                         this.pd.setMessage(MessageFormat.format(
  6235.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY, nome,
  6236.                                 nomeporta));    
  6237.                     }
  6238.                    
  6239.                    
  6240.                     return false;
  6241.                 }
  6242.             }

  6243.             return true;
  6244.         } catch (Exception e) {
  6245.             this.logError(e.getMessage(), e);
  6246.             throw new ControlStationCoreException(e.getMessage(),e);
  6247.         }
  6248.     }

  6249.    
  6250.     public void preparePorteApplicativeAutorizzazioneCustomPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista) throws Exception {
  6251.         try {
  6252.             if(nomePorta!=null) {
  6253.                 // nop
  6254.             }
  6255.            
  6256.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  6257.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6258.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  6259.             if(idAsps == null)
  6260.                 idAsps = "";

  6261.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  6262.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  6263.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CUSTOM_PROPERTIES,
  6264.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6265.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6266.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  6267.             int idLista = Liste.PORTE_APPLICATIVE_PROPRIETA_AUTORIZZAZIONE;
  6268.             int limit = ricerca.getPageSize(idLista);
  6269.             int offset = ricerca.getIndexIniziale(idLista);
  6270.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  6271.             this.pd.setIndex(offset);
  6272.             this.pd.setPageSize(limit);
  6273.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  6274.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  6275.             String idporta = pa.getNome();

  6276.             // setto la barra del titolo
  6277.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  6278.            
  6279.             String labelPerPorta = null;
  6280.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6281.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  6282.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  6283.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6284.                         pa);
  6285.             }
  6286.             else {
  6287.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  6288.             }
  6289.            
  6290.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6291.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6292.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6293.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  6294.            
  6295.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTORIZZAZIONE_PROPRIETA;
  6296.            
  6297.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  6298.             if(search.equals("")){
  6299.                 this.pd.setSearchDescription("");
  6300.                 lstParam.add(new Parameter(labelPagLista,null));
  6301.             }
  6302.             else{
  6303.                 lstParam.add(new Parameter(labelPagLista,
  6304.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CUSTOM_PROPERTIES_LIST,
  6305.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  6306.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  6307.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  6308.                         ));
  6309.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  6310.             }

  6311.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  6312.            
  6313.             // imposta menu' contestuale
  6314.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  6315.             // controllo eventuali risultati ricerca
  6316.             if (!search.equals("")) {
  6317.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTORIZZAZIONE_PROPRIETA, search);
  6318.             }

  6319.             // setto le label delle colonne
  6320.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_NOME , CostantiControlStation.LABEL_PARAMETRO_VALORE };
  6321.             this.pd.setLabels(labels);

  6322.             // preparo i dati
  6323.             List<List<DataElement>> dati = new ArrayList<>();

  6324.             if (lista != null) {
  6325.                 Iterator<Proprieta> it = lista.iterator();
  6326.                 while (it.hasNext()) {
  6327.                     Proprieta proprieta = it.next();
  6328.        
  6329.                     List<DataElement> e = new ArrayList<>();
  6330.        
  6331.                     DataElement de = new DataElement();
  6332.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CUSTOM_PROPERTIES_CHANGE,
  6333.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6334.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6335.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, proprieta.getNome()),
  6336.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  6337.                     de.setValue(proprieta.getNome());
  6338.                     de.setIdToRemove(proprieta.getId() + "");
  6339.                     de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
  6340.                     e.add(de);
  6341.                    
  6342.                     de = new DataElement();
  6343.                     if(StringUtils.isNotEmpty(proprieta.getValore()) &&
  6344.                             BYOKManager.isEnabledBYOK() &&
  6345.                             this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(proprieta.getValore())) {
  6346.                         de.setValue(CostantiControlStation.VALORE_CIFRATO);
  6347.                     }
  6348.                     else {
  6349.                         de.setValue(proprieta.getValore());
  6350.                     }
  6351.                     e.add(de);
  6352.        
  6353.                     dati.add(e);
  6354.                 }
  6355.             }

  6356.             this.pd.setDati(dati);
  6357.             this.pd.setAddButton(true);

  6358.         } catch (Exception e) {
  6359.             this.logError(e.getMessage(), e);
  6360.             throw new ControlStationCoreException(e.getMessage(),e);
  6361.         }
  6362.     }
  6363.    
  6364.     public boolean proprietaAutorizzazioneCheckData(TipoOperazione tipoOp, String idPorta, String nome,String valore) throws ControlStationCoreException {
  6365.         try {
  6366.             // Campi obbligatori
  6367.             if (nome.equals("") || valore.equals("")) {
  6368.                 String tmpElenco = "";
  6369.                 if (nome.equals("")) {
  6370.                     tmpElenco = "Nome";
  6371.                 }
  6372.                 if (valore.equals("")) {
  6373.                     if (tmpElenco.equals("")) {
  6374.                         tmpElenco = "Valore";
  6375.                     } else {
  6376.                         tmpElenco = tmpElenco + ", Valore";
  6377.                     }
  6378.                 }
  6379.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  6380.                 return false;
  6381.             }
  6382.            
  6383.             if (nome.indexOf(" ") != -1) {
  6384.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  6385.                 return false;
  6386.             }
  6387.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  6388.                 return false;
  6389.             }
  6390.            
  6391.             if(
  6392.                     ( !this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore) )
  6393.                     &&
  6394.                     (!this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE))
  6395.                 ){
  6396.                 return false;
  6397.             }
  6398.            
  6399.             // Se tipoOp = add, controllo che la property non sia gia'
  6400.             // stata
  6401.             // registrata per la porta applicativa
  6402.             if (tipoOp.equals(TipoOperazione.ADD)) {
  6403.                 boolean giaRegistrato = false;
  6404.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  6405.                 String nomeporta = pa.getNome();

  6406.                 for (int i = 0; i < pa.sizeProprietaAutorizzazioneList(); i++) {
  6407.                     Proprieta tmpProp = pa.getProprietaAutorizzazione(i);
  6408.                     if (nome.equals(tmpProp.getNome())) {
  6409.                         giaRegistrato = true;
  6410.                         break;
  6411.                     }
  6412.                 }

  6413.                 if (giaRegistrato) {
  6414.                     Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6415.                     if(parentPA == null) parentPA = PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE;
  6416.                    
  6417.                     if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6418.                         nomeporta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(null,null, pa);
  6419.                         this.pd.setMessage(MessageFormat.format(
  6420.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_CONFIGURAZIONE_YY, nome,
  6421.                                 nomeporta));
  6422.                     } else {
  6423.                         this.pd.setMessage(MessageFormat.format(
  6424.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY, nome,
  6425.                                 nomeporta));    
  6426.                     }
  6427.                    
  6428.                    
  6429.                     return false;
  6430.                 }
  6431.             }

  6432.             return true;
  6433.         } catch (Exception e) {
  6434.             this.logError(e.getMessage(), e);
  6435.             throw new ControlStationCoreException(e.getMessage(),e);
  6436.         }
  6437.     }
  6438.    
  6439.     public void preparePorteApplicativeAutorizzazioneContenutoCustomPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista) throws Exception {
  6440.         try {
  6441.             if(nomePorta!=null) {
  6442.                 // nop
  6443.             }
  6444.            
  6445.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  6446.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6447.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  6448.             if(idAsps == null)
  6449.                 idAsps = "";

  6450.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  6451.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  6452.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CONTENUTI_CUSTOM_PROPERTIES,
  6453.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6454.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6455.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));

  6456.             int idLista = Liste.PORTE_APPLICATIVE_PROPRIETA_AUTORIZZAZIONE_CONTENUTO;
  6457.             int limit = ricerca.getPageSize(idLista);
  6458.             int offset = ricerca.getIndexIniziale(idLista);
  6459.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  6460.             this.pd.setIndex(offset);
  6461.             this.pd.setPageSize(limit);
  6462.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  6463.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  6464.             String idporta = pa.getNome();

  6465.             // setto la barra del titolo
  6466.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  6467.            
  6468.             String labelPerPorta = null;
  6469.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6470.                 labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  6471.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI,
  6472.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6473.                         pa);
  6474.             }
  6475.             else {
  6476.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONTROLLO_ACCESSI_CONFIG_DI+idporta;
  6477.             }
  6478.            
  6479.             lstParam.add(new Parameter(labelPerPorta, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI,
  6480.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6481.                     new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6482.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)));
  6483.            
  6484.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTORIZZAZIONE_CONTENUTO_PROPRIETA;
  6485.            
  6486.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  6487.             if(search.equals("")){
  6488.                 this.pd.setSearchDescription("");
  6489.                 lstParam.add(new Parameter(labelPagLista,null));
  6490.             }
  6491.             else{
  6492.                 lstParam.add(new Parameter(labelPagLista,
  6493.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CONTENUTI_CUSTOM_PROPERTIES_LIST,
  6494.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id),
  6495.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg),
  6496.                         new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps)
  6497.                         ));
  6498.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  6499.             }

  6500.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  6501.            
  6502.             // imposta menu' contestuale
  6503.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  6504.             // controllo eventuali risultati ricerca
  6505.             if (!search.equals("")) {
  6506.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_AUTORIZZAZIONE_CONTENUTO_PROPRIETA, search);
  6507.             }

  6508.             // setto le label delle colonne
  6509.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_NOME , CostantiControlStation.LABEL_PARAMETRO_VALORE };
  6510.             this.pd.setLabels(labels);

  6511.             // preparo i dati
  6512.             List<List<DataElement>> dati = new ArrayList<>();

  6513.             if (lista != null) {
  6514.                 Iterator<Proprieta> it = lista.iterator();
  6515.                 while (it.hasNext()) {
  6516.                     Proprieta proprieta = it.next();
  6517.        
  6518.                     List<DataElement> e = new ArrayList<>();
  6519.        
  6520.                     DataElement de = new DataElement();
  6521.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_AUTORIZZAZIONE_CONTENUTI_CUSTOM_PROPERTIES_CHANGE,
  6522.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id),
  6523.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg),
  6524.                             new Parameter( PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, proprieta.getNome()),
  6525.                             new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps));
  6526.                     de.setValue(proprieta.getNome());
  6527.                     de.setIdToRemove(proprieta.getId() + "");
  6528.                     de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
  6529.                     e.add(de);
  6530.                    
  6531.                     de = new DataElement();
  6532.                     if(StringUtils.isNotEmpty(proprieta.getValore()) &&
  6533.                             BYOKManager.isEnabledBYOK() &&
  6534.                             this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(proprieta.getValore())) {
  6535.                         de.setValue(CostantiControlStation.VALORE_CIFRATO);
  6536.                     }
  6537.                     else {
  6538.                         de.setValue(proprieta.getValore());
  6539.                     }
  6540.                     e.add(de);
  6541.        
  6542.                     dati.add(e);
  6543.                 }
  6544.             }

  6545.             this.pd.setDati(dati);
  6546.             this.pd.setAddButton(true);

  6547.         } catch (Exception e) {
  6548.             this.logError(e.getMessage(), e);
  6549.             throw new ControlStationCoreException(e.getMessage(),e);
  6550.         }
  6551.     }
  6552.    
  6553.     public boolean proprietaAutorizzazioneContenutoCheckData(TipoOperazione tipoOp, String idPorta, String nome,String valore) throws ControlStationCoreException {
  6554.         try {
  6555.             // Campi obbligatori
  6556.             if (nome.equals("") || valore.equals("")) {
  6557.                 String tmpElenco = "";
  6558.                 if (nome.equals("")) {
  6559.                     tmpElenco = "Nome";
  6560.                 }
  6561.                 if (valore.equals("")) {
  6562.                     if (tmpElenco.equals("")) {
  6563.                         tmpElenco = "Valore";
  6564.                     } else {
  6565.                         tmpElenco = tmpElenco + ", Valore";
  6566.                     }
  6567.                 }
  6568.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  6569.                 return false;
  6570.             }
  6571.            
  6572.             if (nome.indexOf(" ") != -1) {
  6573.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  6574.                 return false;
  6575.             }
  6576.             if(!this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)) {
  6577.                 return false;
  6578.             }
  6579.            
  6580.             if(
  6581.                 ( !this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore) )
  6582.                 &&
  6583.                 (!this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE))
  6584.             ){
  6585.                 return false;
  6586.             }
  6587.            
  6588.             // Se tipoOp = add, controllo che la property non sia gia'
  6589.             // stata
  6590.             // registrata per la porta applicativa
  6591.             if (tipoOp.equals(TipoOperazione.ADD)) {
  6592.                 boolean giaRegistrato = false;
  6593.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  6594.                 String nomeporta = pa.getNome();

  6595.                 for (int i = 0; i < pa.sizeProprietaAutorizzazioneContenutoList(); i++) {
  6596.                     Proprieta tmpProp = pa.getProprietaAutorizzazioneContenuto(i);
  6597.                     if (nome.equals(tmpProp.getNome())) {
  6598.                         giaRegistrato = true;
  6599.                         break;
  6600.                     }
  6601.                 }

  6602.                 if (giaRegistrato) {
  6603.                     Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  6604.                     if(parentPA == null) parentPA = PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_NONE;
  6605.                    
  6606.                     if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  6607.                         nomeporta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(null,null, pa);
  6608.                         this.pd.setMessage(MessageFormat.format(
  6609.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_CONFIGURAZIONE_YY, nome,
  6610.                                 nomeporta));
  6611.                     } else {
  6612.                         this.pd.setMessage(MessageFormat.format(
  6613.                                 PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_PORTA_APPLICATIVA_YY, nome,
  6614.                                 nomeporta));    
  6615.                     }
  6616.                    
  6617.                    
  6618.                     return false;
  6619.                 }
  6620.             }

  6621.             return true;
  6622.         } catch (Exception e) {
  6623.             this.logError(e.getMessage(), e);
  6624.             throw new ControlStationCoreException(e.getMessage(),e);
  6625.         }
  6626.     }
  6627.    
  6628.    
  6629.    
  6630.     public List<DataElement> addConnettoriMultipliConfigurazioneToDati(List<DataElement> dati,
  6631.             TipoOperazione tipoOp, String protocollo, String accessoDaAPSParametro, String stato, String modalitaConsegna, String tipoCustom,
  6632.             int numeroProprietaCustom, String servletProprietaCustom, List<Parameter> listaParametriServletProprietaCustom, boolean visualizzaLinkProprietaCustom,
  6633.             String loadBalanceStrategia,boolean modificaStatoAbilitata,
  6634.             boolean consegnaCondizionale, boolean isSoapOneWay, String connettoreImplementaAPI, List<String> connettoriImplementaAPIValues, List<String> connettoriImplementaAPILabels, String connettorePrincipale,
  6635.             boolean notificheCondizionaliEsito, String [] esitiTransazione, ServiceBinding serviceBinding, String selezioneConnettoreBy, String identificazioneCondizionale, String identificazioneCondizionalePattern,
  6636.             String identificazioneCondizionalePrefisso, String identificazioneCondizionaleSuffisso, boolean visualizzaLinkRegolePerAzioni, String servletRegolePerAzioni,  List<Parameter> listaParametriServletRegolePerAzioni,
  6637.             int numeroRegolePerAzioni, boolean condizioneNonIdentificataAbortTransaction, String condizioneNonIdentificataDiagnostico, String condizioneNonIdentificataConnettore,
  6638.             boolean connettoreNonTrovatoAbortTransaction, String connettoreNonTrovatoDiagnostico, String connettoreNonTrovatoConnettore,
  6639.             boolean sticky, String stickyTipoSelettore, String stickyTipoSelettorePattern, String stickyMaxAge,
  6640.             boolean passiveHealthCheck, String passiveHealthCheck_excludeForSeconds
  6641.             ) throws Exception {
  6642.         Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
  6643.        
  6644.         DataElement de = new DataElement();
  6645.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG);
  6646.         de.setType(DataElementType.TITLE);
  6647.         dati.add(de);
  6648.        
  6649.         if(accessoDaAPSParametro!=null && !"".equals(accessoDaAPSParametro)) {
  6650.             de = new DataElement();
  6651.             de.setType(DataElementType.HIDDEN);
  6652.             de.setValue(accessoDaAPSParametro);
  6653.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS);
  6654.             dati.add(de);
  6655.         }
  6656.        
  6657.         de = new DataElement();
  6658.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO);
  6659.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO);
  6660.         if(modificaStatoAbilitata) {
  6661.             de.setType(DataElementType.SELECT);
  6662.             String [] statoLabels = {PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO , PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_DISABILITATO };
  6663.             String [] statoValues = {PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO , PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_DISABILITATO };
  6664.             de.setValues(statoValues);
  6665.             de.setLabels(statoLabels);
  6666.             de.setPostBack(true);
  6667.             de.setSelected(stato);
  6668.         } else {
  6669.             de.setType(DataElementType.TEXT);
  6670.             de.setValue(stato);
  6671.         }
  6672.         dati.add(de);
  6673.        
  6674.        
  6675.         de = new DataElement();
  6676.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA);
  6677.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA);
  6678.        
  6679.         if(stato.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO)) {  
  6680.             de.setType(DataElementType.SELECT);
  6681.             List<String> modalitaLabels = TipoBehaviour.getLabels(this.porteApplicativeCore.isConnettoriMultipliConsegnaMultiplaEnabled(), isSoapOneWay);
  6682.             List<String> modalitaValues = TipoBehaviour.getValues(this.porteApplicativeCore.isConnettoriMultipliConsegnaMultiplaEnabled(), isSoapOneWay);
  6683.            
  6684.             if(modalitaConsegna!=null && !"".equals(modalitaConsegna) && !"-".equals(modalitaConsegna) && !modalitaValues.contains(modalitaConsegna)) {
  6685.            
  6686.                 de.setType(DataElementType.TEXT);
  6687.                
  6688.                 // Provo a tradurre la modalita trovata
  6689.                 TipoBehaviour modalitaValuesCompleta = TipoBehaviour.toEnumConstant(modalitaConsegna);
  6690.                 if(modalitaValuesCompleta!=null && !TipoBehaviour.CUSTOM.equals(modalitaValuesCompleta)) {
  6691.                     de.setValue(modalitaValuesCompleta.getLabel());
  6692.                 }
  6693.                 else {
  6694.                     de.setValue(modalitaConsegna);
  6695.                 }
  6696.                
  6697.                 this.pd.setMessage("L'impostazione presente nel campo '"+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA+"' non è più disponibile. <BR/>Verificare che il profilo di collaborazione delle operazioni definite nell'API non sia cambiato e risulti compatibile.");
  6698.                 this.pd.setInserisciBottoni(false);
  6699.                 this.pd.disableEditMode();
  6700.                
  6701.                 dati.add(de);
  6702.            
  6703.                 return dati;
  6704.                
  6705.             }
  6706.             else {
  6707.                 de.setValues(modalitaValues);
  6708.                 de.setLabels(modalitaLabels);
  6709.                 de.setPostBack(true);
  6710.                 de.setSelected(modalitaConsegna);
  6711.             }
  6712.         } else {
  6713.             de.setType(DataElementType.HIDDEN);
  6714.             de.setValue(modalitaConsegna);
  6715.         }
  6716.         dati.add(de);
  6717.            
  6718.         if(stato.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO)) {
  6719.            
  6720.             LoadBalancerType lbt = null;
  6721.                        
  6722.             // custom
  6723.             if(TipoBehaviour.CUSTOM.getValue().equals(modalitaConsegna)) {
  6724.                
  6725.                 // campo tipo e link proprieta
  6726.                
  6727.                 this.addCustomField(TipoPlugin.BEHAVIOUR,
  6728.                         null,
  6729.                         null,
  6730.                         PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA,
  6731.                         PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO,
  6732.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO,
  6733.                         tipoCustom, false, dati,
  6734.                         false);    
  6735.                
  6736. //              de = new DataElement();
  6737. //              de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO);
  6738. //              de.setType(DataElementType.TEXT_EDIT);
  6739. //              de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO);
  6740. //              de.setSize(this.getSize());
  6741. //              de.setRequired(true);
  6742. //              de.setValue(tipoCustom);
  6743. //              dati.add(de);
  6744.                
  6745.                 // Link
  6746.                 if(visualizzaLinkProprietaCustom){
  6747.                     de = new DataElement();
  6748.                     de.setType(DataElementType.LINK);
  6749.                     de.setUrl(servletProprietaCustom,listaParametriServletProprietaCustom.toArray(new Parameter[listaParametriServletProprietaCustom.size()]));
  6750.                     if (contaListe)
  6751.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_PROPRIETA +"(" + numeroProprietaCustom + ")");
  6752.                     else
  6753.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_PROPRIETA);
  6754.                     dati.add(de);
  6755.                 }
  6756.             } else if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna)) {
  6757.                
  6758.                 if(loadBalanceStrategia==null) {
  6759.                     loadBalanceStrategia = LoadBalancerType.ROUND_ROBIN.getValue(); // default
  6760.                 }
  6761.                
  6762.                 // select list con strategia
  6763.                 de = new DataElement();
  6764.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA);
  6765.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA);
  6766.                 de.setType(DataElementType.SELECT);
  6767.                 String [] strategiaLabels = PorteApplicativeCostanti.LABELS_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA;
  6768.                 String [] strategiaValues = PorteApplicativeCostanti.VALUES_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA;
  6769.                 de.setValues(strategiaValues);
  6770.                 de.setLabels(strategiaLabels);
  6771.                 de.setSelected(loadBalanceStrategia);
  6772.                 de.setPostBack(true);
  6773.                 DataElementInfo dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA);
  6774.                 dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_INFO);
  6775.                 de.setInfo(dInfo);
  6776.                 dati.add(de);
  6777.                
  6778.                
  6779.                 // sticky
  6780.                
  6781.                 if(loadBalanceStrategia!=null) {
  6782.                     lbt = LoadBalancerType.toEnumConstant(loadBalanceStrategia, true);
  6783.                 }
  6784.                
  6785.                 de = new DataElement();
  6786.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY);
  6787.                 if(lbt!=null && lbt.isSticky()) {
  6788.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY);
  6789.                     de.setType(DataElementType.CHECKBOX);
  6790.                     de.setLabelRight(PorteApplicativeCostanti.LABEL_RIGHT_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY);
  6791.                     de.setSelected(sticky);
  6792.                     de.setPostBack(true);
  6793.                     DataElementInfo dInfoSticky = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY);
  6794.                     dInfoSticky.setBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_INFO);
  6795.                     de.setInfo(dInfoSticky);
  6796.                 }
  6797.                 else {
  6798.                     de.setType(DataElementType.HIDDEN);
  6799.                     de.setSelected(false);
  6800.                 }
  6801.                 dati.add(de);
  6802.                
  6803.                
  6804.                 // health check
  6805.                
  6806.                 de = new DataElement();
  6807.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK);
  6808.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK);
  6809.                 de.setType(DataElementType.CHECKBOX);
  6810.                 de.setLabelRight(PorteApplicativeCostanti.LABEL_RIGHT_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK);
  6811.                 de.setSelected(passiveHealthCheck);
  6812.                 de.setPostBack(true);
  6813.                 DataElementInfo dInfoPassiveHealthCheck = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK);
  6814.                 dInfoPassiveHealthCheck.setBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_INFO);
  6815.                 de.setInfo(dInfoPassiveHealthCheck);
  6816.                 dati.add(de);
  6817.                
  6818.             }  
  6819.            
  6820.             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  6821.                 // sezione notifiche

  6822.                 //de = new DataElement();
  6823.                 //de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SEZIONE_NOTIFICHE);
  6824.                 //de.setType(DataElementType.SUBTITLE);
  6825.                 //dati.add(de);
  6826.                    
  6827.                 // select con il nome connettore
  6828.                 de = new DataElement();
  6829.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API);
  6830.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API);
  6831.                 de.setType(DataElementType.SELECT);
  6832.                 de.setValues(connettoriImplementaAPIValues);
  6833.                 de.setLabels(connettoriImplementaAPILabels);
  6834.                 de.setSelected(connettoreImplementaAPI);
  6835.                 de.setPostBack(true);
  6836.                 dati.add(de);

  6837.             }
  6838.            
  6839.             // checkbox consegna condizionale
  6840.             DataElement deConsegnaConNotifiche = null;
  6841.             if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) ||
  6842.                     TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) ||
  6843.                     TipoBehaviour.CONSEGNA_CONDIZIONALE.getValue().equals(modalitaConsegna) ||
  6844.                     TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna) ) {
  6845.                 de = new DataElement();
  6846.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONSEGNA_CONDIZIONALE);
  6847.                 de.setType(DataElementType.CHECKBOX);
  6848.                 de.setSelected(consegnaCondizionale);
  6849.                 de.setPostBack(true);
  6850.                 if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) ) {
  6851.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_LEFT);
  6852.                     de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_LOAD_BALANCER_RIGHT);
  6853.                 }
  6854.                 else if(TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) ) {
  6855.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_LEFT);
  6856.                     de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_PIU_CONNETTORI_RIGHT);
  6857.                 }
  6858.                 else if(TipoBehaviour.CONSEGNA_CONDIZIONALE.getValue().equals(modalitaConsegna)) {
  6859.                     de.setType(DataElementType.HIDDEN);
  6860.                     consegnaCondizionale = true;
  6861.                     de.setSelected(true);
  6862.                     de.setValue(Costanti.CHECK_BOX_ENABLED);
  6863.                     de.setPostBack(false);
  6864.                     dati.add(de);
  6865.                    
  6866.                     de = new DataElement();
  6867.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONSEGNA_CONDIZIONALE+"__NOTE");
  6868.                     de.setType(DataElementType.NOTE);
  6869.                     de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_SINGOLO_CONNETTORE_RIGHT);
  6870.                 }
  6871.                 else if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  6872.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_NOTIFICA_LEFT);
  6873.                     de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CONDIZIONALE_NOTIFICHE_CONNETTORI_RIGHT);
  6874.                 }
  6875.                
  6876.                 if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  6877.                     deConsegnaConNotifiche = de;
  6878.                 }
  6879.                 else {
  6880.                     dati.add(de);
  6881.                 }
  6882.             }
  6883.            
  6884.             if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) && sticky &&
  6885.                     lbt!=null && lbt.isSticky() ) {
  6886.            
  6887.                 de = new DataElement();
  6888.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY);
  6889.                 de.setType(DataElementType.TITLE);
  6890.                 dati.add(de);
  6891.                
  6892.                
  6893.                 de = new DataElement();
  6894.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_TIPO_SELETTORE);
  6895.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_TIPO_SELETTORE);
  6896.                 de.setType(DataElementType.SELECT);
  6897.                
  6898.                 org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore tipoSelettoreS = null;
  6899.                 if(stickyTipoSelettore==null) {
  6900.                     stickyTipoSelettore = org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.COOKIE_BASED.getValue();
  6901.                 }
  6902.                 tipoSelettoreS =
  6903.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.toEnumConstant(stickyTipoSelettore, true);
  6904.                                
  6905.                 String [] identificazioneCondizionale_values = {
  6906.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.COOKIE_BASED.getValue(),
  6907.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.HEADER_BASED.getValue(),
  6908.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.URLBASED.getValue(),
  6909.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.FORM_BASED.getValue(),
  6910.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.CONTENT_BASED.getValue(),
  6911.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.INDIRIZZO_IP.getValue(),
  6912.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.INDIRIZZO_IP_FORWARDED.getValue(),
  6913.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.TEMPLATE.getValue(),
  6914.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.FREEMARKER_TEMPLATE.getValue(),
  6915.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.VELOCITY_TEMPLATE.getValue()
  6916.                         };
  6917.                
  6918.                 List<String> identificazioneCondizionale_labels = ModalitaIdentificazione.getLabels(
  6919.                         ModalitaIdentificazione.COOKIE_BASED,
  6920.                         ModalitaIdentificazione.HEADER_BASED,
  6921.                         ModalitaIdentificazione.URL_BASED,
  6922.                         ModalitaIdentificazione.FORM_BASED,
  6923.                         ModalitaIdentificazione.CONTENT_BASED,
  6924.                         ModalitaIdentificazione.INDIRIZZO_IP_BASED,
  6925.                         ModalitaIdentificazione.X_FORWARD_FOR_BASED,
  6926.                         ModalitaIdentificazione.GOVWAY_TEMPLATE,
  6927.                         ModalitaIdentificazione.FREEMARKER_TEMPLATE,
  6928.                         ModalitaIdentificazione.VELOCITY_TEMPLATE
  6929.                     );
  6930.                
  6931.                 de.setValues(identificazioneCondizionale_values);
  6932.                 de.setLabels(identificazioneCondizionale_labels);
  6933.                 de.setPostBack(true);
  6934.                 de.setSelected(stickyTipoSelettore);
  6935.                 dati.add(de);
  6936.                
  6937.                
  6938.                 // nome
  6939.                 de = new DataElement();
  6940.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_PATTERN);
  6941.                 de.setLabel(this.getLabelStickySessionPattern(stickyTipoSelettore));
  6942.                 de.setValue(stickyTipoSelettorePattern);
  6943.                 if(stickyTipoSelettore==null ||
  6944.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.INDIRIZZO_IP.equals(stickyTipoSelettore) ||
  6945.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.INDIRIZZO_IP_FORWARDED.equals(stickyTipoSelettore)){
  6946.                     de.setType(DataElementType.HIDDEN);
  6947.                 }
  6948.                 else if(org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.URLBASED.equals(stickyTipoSelettore) ||
  6949.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.CONTENT_BASED.equals(stickyTipoSelettore)||
  6950.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.TEMPLATE.equals(stickyTipoSelettore)||
  6951.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.VELOCITY_TEMPLATE.equals(stickyTipoSelettore)||
  6952.                         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.FREEMARKER_TEMPLATE.equals(stickyTipoSelettore)) {
  6953.                     de.setRequired(true);
  6954.                     de.setType(DataElementType.TEXT_AREA);
  6955.                     if(tipoSelettoreS.isTemplate()) {
  6956.                         de.setRows(10);
  6957.                     }
  6958.                 }
  6959.                 else{
  6960.                     de.setRequired(true);
  6961.                     de.setType(DataElementType.TEXT_EDIT);
  6962.                 }
  6963.                

  6964.                 if(tipoSelettoreS!=null && org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.CONTENT_BASED.equals(tipoSelettoreS)) {
  6965.                     DataElementInfo dInfoPattern = new DataElementInfo(ModalitaIdentificazione.CONTENT_BASED.getLabel());
  6966.                     if(org.openspcoop2.message.constants.ServiceBinding.REST.equals(serviceBinding)) {
  6967.                         dInfoPattern.setHeaderBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_REST);
  6968.                         dInfoPattern.setListBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_VALORI_REST);
  6969.                     }
  6970.                     else {
  6971.                         dInfoPattern.setBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_SOAP);
  6972.                     }
  6973.                     de.setInfo(dInfoPattern);
  6974.                 }
  6975.                
  6976.                 if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  6977.                     DataElementInfo dInfoPattern = null;
  6978.                     if(org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.TEMPLATE.equals(stickyTipoSelettore)) {
  6979.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  6980.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  6981.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  6982.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), false, false));
  6983.                         }
  6984.                         else {
  6985.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), false, false));
  6986.                         }
  6987.                     }
  6988.                     else if(org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.FREEMARKER_TEMPLATE.equals(stickyTipoSelettore)) {
  6989.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  6990.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  6991.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  6992.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  6993.                         }
  6994.                         else {
  6995.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  6996.                         }
  6997.                     }
  6998.                     else {
  6999.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  7000.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  7001.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  7002.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  7003.                         }
  7004.                         else {
  7005.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  7006.                         }
  7007.                     }
  7008.                     de.setInfo(dInfoPattern);
  7009.                 }
  7010.                
  7011.                 dati.add(de);
  7012.                
  7013.                
  7014.                 de = new DataElement();
  7015.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_MAX_AGE );
  7016.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_MAX_AGE);
  7017.                 de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_MAX_AGE_NOTE);
  7018.                 de.setType(DataElementType.NUMBER);
  7019.                 de.setValue(stickyMaxAge);
  7020.                 de.setMinValue(0);
  7021.                 de.reloadMinValue(false);
  7022.                 dati.add(de);
  7023.                
  7024.             }
  7025.            
  7026.             if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) && passiveHealthCheck) {
  7027.                
  7028.                 de = new DataElement();
  7029.                 de.setLabel(PorteApplicativeCostanti.LABEL_TITLE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK);
  7030.                 de.setType(DataElementType.TITLE);
  7031.                 dati.add(de);
  7032.                
  7033.                 de = new DataElement();
  7034.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS );
  7035. //              if(passiveHealthCheck) {
  7036.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS);
  7037.                 de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS_NOTE);
  7038.                 de.setType(DataElementType.NUMBER);
  7039.                 de.setMinValue(1);
  7040.                 de.reloadMinValue(false);
  7041. //              }
  7042. //              else {
  7043. //                  de.setType(DataElementType.HIDDEN);
  7044. //              }
  7045.                 if(passiveHealthCheck_excludeForSeconds==null || "".equals(passiveHealthCheck_excludeForSeconds)){
  7046.                     de.setValue(HealthCheckCostanti.PASSIVE_HEALTH_CHECK_SECONDS_DEFAULT_VALUE+"");
  7047.                 }
  7048.                 else {
  7049.                     de.setValue(passiveHealthCheck_excludeForSeconds);
  7050.                 }
  7051.                 dati.add(de);
  7052.                
  7053.             }

  7054.             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7055.                 // sezione notifiche

  7056.                 de = new DataElement();
  7057.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SEZIONE_NOTIFICHE);
  7058.                 de.setType(DataElementType.SUBTITLE);
  7059.                 dati.add(de);
  7060.                                    
  7061.                 // checkbox abilita notifiche condizionali
  7062.                 de = new DataElement();
  7063.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI_ESITO);
  7064.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI_ESITO);
  7065.                 de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI_ESITO_RIGHT);
  7066.                 de.setType(DataElementType.CHECKBOX);
  7067.                 de.setSelected(notificheCondizionaliEsito);
  7068.                 de.setPostBack(true);
  7069.                 dati.add(de);
  7070.                
  7071.                 // multiselect con esiti
  7072.                 if(notificheCondizionaliEsito) {
  7073.                     de = new DataElement();
  7074.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ESITI_TRANSAZIONE);
  7075.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ESITI_TRANSAZIONE_LABEL);
  7076.                     de.setType(DataElementType.MULTI_SELECT);
  7077.                      
  7078.                     de.setValues(PorteApplicativeCostanti.VALUES_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ESITI_TRANSAZIONE);
  7079.                     de.setLabels(PorteApplicativeCostanti.LABELS_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ESITI_TRANSAZIONE);
  7080.                     de.setSelezionati(esitiTransazione);
  7081.                     de.setRequired(true);
  7082.                     dati.add(de);
  7083.                 }
  7084.                
  7085.                 dati.add(deConsegnaConNotifiche);
  7086.             }
  7087.            
  7088.            
  7089.             if(!TipoBehaviour.CUSTOM.getValue().equals(modalitaConsegna) && consegnaCondizionale) {
  7090.                 de = new DataElement();
  7091.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONDIZIONALITA);
  7092.                 de.setType(DataElementType.TITLE);
  7093.                 dati.add(de);
  7094.                
  7095.                 // select list selezione connettore by se modalita' consegna e' piu' destiantari'
  7096.                 de = new DataElement();
  7097.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY);
  7098.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY);
  7099.                
  7100.                 if(!TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna)) {  
  7101.                     de.setType(DataElementType.SELECT);
  7102.                      
  7103.                     String [] selezioneConnettoreByValues = {
  7104.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY_FILTRO,
  7105.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY_NOME
  7106.                             };
  7107.                    
  7108.                     de.setValues(selezioneConnettoreByValues);
  7109.                     de.setLabels(selezioneConnettoreByValues);
  7110. //                  de.setPostBack(true);
  7111.                     de.setSelected(selezioneConnettoreBy);
  7112.                 } else {
  7113.                     de.setType(DataElementType.HIDDEN);
  7114.                     de.setValue(selezioneConnettoreBy);
  7115.                 }
  7116.                 dati.add(de);
  7117.                
  7118.                 // Identificazione condizionale
  7119.                 de = new DataElement();
  7120.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE);
  7121.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE);
  7122.                 de.setType(DataElementType.SELECT);
  7123.                
  7124.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore tipoSelettoreS = org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale, true);
  7125.                            
  7126.                 List<String> identificazioneCondizionale_values = new ArrayList<>();
  7127.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.HEADER_BASED.getValue());
  7128.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.getValue());
  7129.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FORM_BASED.getValue());
  7130.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  7131.                     identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.SOAPACTION_BASED.getValue());
  7132.                 }
  7133.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.getValue());
  7134.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP.getValue());
  7135.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP_FORWARDED.getValue());
  7136.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.getValue());
  7137.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.getValue());
  7138.                 identificazioneCondizionale_values.add(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.VELOCITY_TEMPLATE.getValue());
  7139.                
  7140.                 List<String> identificazioneCondizionale_labels = ModalitaIdentificazione.getLabels(
  7141.                         ModalitaIdentificazione.HEADER_BASED,
  7142.                         ModalitaIdentificazione.URL_BASED,
  7143.                         ModalitaIdentificazione.FORM_BASED);
  7144.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  7145.                     identificazioneCondizionale_labels.addAll(ModalitaIdentificazione.getLabels(ModalitaIdentificazione.SOAP_ACTION_BASED));
  7146.                 }
  7147.                 identificazioneCondizionale_labels.addAll(ModalitaIdentificazione.getLabels(
  7148.                         ModalitaIdentificazione.CONTENT_BASED,
  7149.                         ModalitaIdentificazione.INDIRIZZO_IP_BASED,
  7150.                         ModalitaIdentificazione.X_FORWARD_FOR_BASED,
  7151.                         ModalitaIdentificazione.GOVWAY_TEMPLATE,
  7152.                         ModalitaIdentificazione.FREEMARKER_TEMPLATE,
  7153.                         ModalitaIdentificazione.VELOCITY_TEMPLATE
  7154.                     ));
  7155.                
  7156.                 de.setValues(identificazioneCondizionale_values);
  7157.                 de.setLabels(identificazioneCondizionale_labels);
  7158.                 de.setPostBack(true);
  7159.                 de.setSelected(identificazioneCondizionale);
  7160.                 dati.add(de);
  7161.                
  7162.                 // nome
  7163.                 de = new DataElement();
  7164.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PATTERN);
  7165.                 de.setLabel(this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale));
  7166.                 de.setValue(identificazioneCondizionalePattern);
  7167.                 if(identificazioneCondizionale==null ||
  7168.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.SOAPACTION_BASED.equals(identificazioneCondizionale)  ||
  7169.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP.equals(identificazioneCondizionale) ||
  7170.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP_FORWARDED.equals(identificazioneCondizionale)){
  7171.                     de.setType(DataElementType.HIDDEN);
  7172.                 }
  7173.                 else if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.equals(identificazioneCondizionale) ||
  7174.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.equals(identificazioneCondizionale)||
  7175.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.equals(identificazioneCondizionale)||
  7176.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.VELOCITY_TEMPLATE.equals(identificazioneCondizionale)||
  7177.                         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.equals(identificazioneCondizionale)) {
  7178.                     de.setRequired(true);
  7179.                     de.setType(DataElementType.TEXT_AREA);
  7180.                     if(tipoSelettoreS.isTemplate()) {
  7181.                         de.setRows(10);
  7182.                     }
  7183.                 }
  7184.                 else{
  7185.                     de.setRequired(true);
  7186.                     de.setType(DataElementType.TEXT_EDIT);
  7187.                 }
  7188.                
  7189.                 if(tipoSelettoreS!=null && org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.equals(tipoSelettoreS)) {
  7190.                     DataElementInfo dInfoPattern = new DataElementInfo(ModalitaIdentificazione.CONTENT_BASED.getLabel());
  7191.                     if(org.openspcoop2.message.constants.ServiceBinding.REST.equals(serviceBinding)) {
  7192.                         dInfoPattern.setHeaderBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_REST);
  7193.                         dInfoPattern.setListBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_VALORI_REST);
  7194.                     }
  7195.                     else {
  7196.                         dInfoPattern.setBody(PorteApplicativeCostanti.LABEL_CONFIGURAZIONE_CONNETTORI_MULTIPLI_INFO_PATTERN_SOAP);
  7197.                     }
  7198.                     de.setInfo(dInfoPattern);
  7199.                 }
  7200.                
  7201.                 if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  7202.                     DataElementInfo dInfoPattern = null;
  7203.                     if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.equals(identificazioneCondizionale)) {
  7204.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  7205.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  7206.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  7207.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), false, false));
  7208.                         }
  7209.                         else {
  7210.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), false, false));
  7211.                         }
  7212.                     }
  7213.                     else if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.equals(identificazioneCondizionale)) {
  7214.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  7215.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  7216.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  7217.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  7218.                         }
  7219.                         else {
  7220.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  7221.                         }
  7222.                     }
  7223.                     else {
  7224.                         dInfoPattern = new DataElementInfo(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  7225.                         dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  7226.                         if(ServiceBinding.REST.equals(serviceBinding)) {
  7227.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  7228.                         }
  7229.                         else {
  7230.                             dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  7231.                         }
  7232.                     }
  7233.                     de.setInfo(dInfoPattern);
  7234.                 }
  7235.                
  7236.                 dati.add(de);
  7237.                
  7238.                 // prefisso
  7239.                 de = new DataElement();
  7240.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO);
  7241.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO);
  7242.                 de.setSize(this.getSize());
  7243.                 de.setValue(identificazioneCondizionalePrefisso);
  7244.                 if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  7245.                      de.setType(DataElementType.HIDDEN);
  7246.                 } else {
  7247.                      de.setType(DataElementType.TEXT_EDIT);
  7248.                 }
  7249.                 dati.add(de);
  7250.                
  7251.                 // suffisso
  7252.                 de = new DataElement();
  7253.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO);
  7254.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO);
  7255.                 de.setSize(this.getSize());
  7256.                 de.setValue(identificazioneCondizionaleSuffisso);
  7257.                 if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  7258.                      de.setType(DataElementType.HIDDEN);
  7259.                 } else {
  7260.                      de.setType(DataElementType.TEXT_EDIT);
  7261.                 }
  7262.                 dati.add(de);
  7263.                
  7264.                
  7265.                 // regole per azioni
  7266.                 // Link
  7267.                 if(visualizzaLinkRegolePerAzioni){
  7268.                     de = new DataElement();
  7269.                     de.setType(DataElementType.LINK);
  7270.                     de.setUrl(servletRegolePerAzioni,listaParametriServletRegolePerAzioni.toArray(new Parameter[listaParametriServletRegolePerAzioni.size()]));
  7271.                     if (contaListe)
  7272.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_PER_AZIONI +"(" + numeroRegolePerAzioni + ")");
  7273.                     else
  7274.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_PER_AZIONI);
  7275.                     dati.add(de);
  7276.                 }
  7277.                

  7278.                 // Sezione Identificazione Condizione Fallita
  7279.                
  7280.                 de = new DataElement();
  7281.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA);
  7282.                 de.setType(DataElementType.SUBTITLE);
  7283.                 dati.add(de);
  7284.                
  7285.                 de = new DataElement();
  7286.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_ABORT_TRANSACTION);
  7287.                 de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_ABORT_TRANSACTION);
  7288.                 de.setType(DataElementType.CHECKBOX);
  7289.                 de.setSelected(condizioneNonIdentificataAbortTransaction);
  7290.                 de.setPostBack(true);
  7291.                 dati.add(de);
  7292.                
  7293.                 if(!condizioneNonIdentificataAbortTransaction) {
  7294.                    
  7295.                     // select Diagnostico
  7296.                     de = new DataElement();
  7297.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO);
  7298.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO);
  7299.                     de.setType(DataElementType.SELECT);
  7300.                    
  7301.                    
  7302.                     String [] condizioneNonIdentificataDiagnosticiValues = {
  7303.                             StatoFunzionalita.DISABILITATO.getValue(),
  7304.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_ERROR,
  7305.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_INFO
  7306.                             };
  7307.                    
  7308.                     String [] condizioneNonIdentificataDiagnosticiLabels = {
  7309.                             StatoFunzionalita.DISABILITATO.getValue(),
  7310.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_ERROR,
  7311.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_INFO
  7312.                             };
  7313.                      
  7314.                     de.setValues(condizioneNonIdentificataDiagnosticiValues);
  7315.                     de.setLabels(condizioneNonIdentificataDiagnosticiLabels);
  7316.                     de.setSelected(condizioneNonIdentificataDiagnostico);
  7317.                     dati.add(de);
  7318.                    
  7319.                     if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) && !condizioneNonIdentificataAbortTransaction) {
  7320.                        
  7321.                         de = new DataElement();
  7322.                         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_ABORT_TRANSACTION+"__NOTE");
  7323.                         de.setType(DataElementType.NOTE);
  7324.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_LOAD_BALANCER_WARNING);
  7325.                         dati.add(de);

  7326.                     }
  7327.                    
  7328.                     if(!TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna)) {  
  7329.                         // select Utilizza Connettore
  7330.                         de = new DataElement();
  7331.                         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE);
  7332.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE);
  7333.                         de.setType(DataElementType.SELECT);
  7334.                        
  7335.                         List<String> condizioneNonIdentificataConnettoriValues = new ArrayList<>();
  7336.                         condizioneNonIdentificataConnettoriValues.addAll(connettoriImplementaAPIValues);
  7337.                         List<String> condizioneNonIdentificataConnettoriLabels = new ArrayList<>();
  7338.                         condizioneNonIdentificataConnettoriLabels.addAll(connettoriImplementaAPILabels);
  7339.                         if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna) && connettorePrincipale!=null) {
  7340.                             for (int i = 0; i < condizioneNonIdentificataConnettoriValues.size(); i++) {
  7341.                                 String c = condizioneNonIdentificataConnettoriValues.get(i);
  7342.                                 if(connettorePrincipale.equals(c)) {
  7343.                                     condizioneNonIdentificataConnettoriValues.remove(i);
  7344.                                     condizioneNonIdentificataConnettoriLabels.remove(i);
  7345.                                     break;
  7346.                                 }
  7347.                             }
  7348.                         }
  7349.                                                
  7350.                         if(TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) || TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7351.                             condizioneNonIdentificataConnettoriValues.add(0, CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA);
  7352.                             condizioneNonIdentificataConnettoriLabels.add(0, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_IDENTIFICATO_QUALSIASI);
  7353.                             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7354.                                 condizioneNonIdentificataConnettoriValues.add(1, org.openspcoop2.pdd.core.behaviour.conditional.Costanti.CONDITIONAL_NOME_CONNETTORE_VALORE_NESSUNO);
  7355.                                 condizioneNonIdentificataConnettoriLabels.add(1, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_IDENTIFICATO_NESSUNO);
  7356.                             }
  7357.                             de.setPostBack(true);
  7358.                         }
  7359.                        
  7360.                         de.setValues(condizioneNonIdentificataConnettoriValues);
  7361.                         de.setLabels(condizioneNonIdentificataConnettoriLabels);
  7362.                         de.setSelected(condizioneNonIdentificataConnettore);
  7363.                         dati.add(de);
  7364.                        
  7365.                         if(TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) || TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7366.                             if(condizioneNonIdentificataConnettore==null ||
  7367.                                     //"".equals(condizioneNonIdentificataConnettore) ||
  7368.                                     CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA.equals(condizioneNonIdentificataConnettore)) {
  7369.                                 de = new DataElement();
  7370.                                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE+"__NOTE");
  7371.                                 de.setType(DataElementType.NOTE);
  7372.                                 de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_MULTI_WARNING);
  7373.                                 dati.add(de);
  7374.                             }
  7375.                             else if(org.openspcoop2.pdd.core.behaviour.conditional.Costanti.CONDITIONAL_NOME_CONNETTORE_VALORE_NESSUNO.equals(condizioneNonIdentificataConnettore)) {
  7376.                                 de = new DataElement();
  7377.                                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE+"__NOTE");
  7378.                                 de.setType(DataElementType.NOTE);
  7379.                                 de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_NESSUNA_CONSEGNA);
  7380.                                 dati.add(de);
  7381.                             }
  7382.                         }
  7383.                     }
  7384.                 }
  7385.                
  7386.                 // Sezione Nessun Connettore Trovato
  7387.                
  7388.                 de = new DataElement();
  7389.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO);
  7390.                 de.setType(DataElementType.SUBTITLE);
  7391.                 dati.add(de);
  7392.                
  7393.                 de = new DataElement();
  7394.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_ABORT_TRANSACTION);
  7395.                 de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_ABORT_TRANSACTION);
  7396.                 de.setType(DataElementType.CHECKBOX);
  7397.                 de.setSelected(connettoreNonTrovatoAbortTransaction);
  7398.                 de.setPostBack(true);
  7399.                 dati.add(de);
  7400.                
  7401.                 if(!connettoreNonTrovatoAbortTransaction) {
  7402.                                        
  7403.                     // select Diagnostico
  7404.                     de = new DataElement();
  7405.                     de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO);
  7406.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO);
  7407.                     de.setType(DataElementType.SELECT);
  7408.                    
  7409.                    
  7410.                     String [] connettoreNonTrovatoDiagnosticiValues = {
  7411.                             StatoFunzionalita.DISABILITATO.getValue(),
  7412.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO_ERROR,
  7413.                             PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO_INFO
  7414.                             };
  7415.                    
  7416.                     String [] connettoreNonTrovatoDiagnosticiLabels = {
  7417.                             StatoFunzionalita.DISABILITATO.getValue(),
  7418.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO_ERROR,
  7419.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO_INFO
  7420.                             };
  7421.                      
  7422.                     de.setValues(connettoreNonTrovatoDiagnosticiValues);
  7423.                     de.setLabels(connettoreNonTrovatoDiagnosticiLabels);
  7424.                     de.setSelected(connettoreNonTrovatoDiagnostico);
  7425.                     dati.add(de);
  7426.                    
  7427.                     if(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna) && !connettoreNonTrovatoAbortTransaction) {  
  7428.                    
  7429.                         de = new DataElement();
  7430.                         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_ABORT_TRANSACTION+"__NOTE");
  7431.                         de.setType(DataElementType.NOTE);
  7432.                         de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_LOAD_BALANCER_WARNING);
  7433.                         dati.add(de);

  7434.                     }
  7435.                    
  7436.                     if(!TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue().equals(modalitaConsegna)) {  
  7437.                         // select Utilizza Connettore
  7438.                         de = new DataElement();
  7439.                         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE);
  7440.                         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE);
  7441.                         de.setType(DataElementType.SELECT);
  7442.                          
  7443.                         List<String> connettoreNonTrovatoConnettoriValues = new ArrayList<>();
  7444.                         connettoreNonTrovatoConnettoriValues.addAll(connettoriImplementaAPIValues);
  7445.                         List<String> connettoreNonTrovatoConnettoriLabels = new ArrayList<>();
  7446.                         connettoreNonTrovatoConnettoriLabels.addAll(connettoriImplementaAPILabels);
  7447.                         if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna) && connettorePrincipale!=null) {
  7448.                             for (int i = 0; i < connettoreNonTrovatoConnettoriValues.size(); i++) {
  7449.                                 String c = connettoreNonTrovatoConnettoriValues.get(i);
  7450.                                 if(connettorePrincipale.equals(c)) {
  7451.                                     connettoreNonTrovatoConnettoriValues.remove(i);
  7452.                                     connettoreNonTrovatoConnettoriLabels.remove(i);
  7453.                                     break;
  7454.                                 }
  7455.                             }
  7456.                         }
  7457.                        
  7458.                         if(TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) || TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7459.                             connettoreNonTrovatoConnettoriValues.add(0, CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA);
  7460.                             connettoreNonTrovatoConnettoriLabels.add(0, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_IDENTIFICATO_QUALSIASI);
  7461.                             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7462.                                 connettoreNonTrovatoConnettoriValues.add(1, org.openspcoop2.pdd.core.behaviour.conditional.Costanti.CONDITIONAL_NOME_CONNETTORE_VALORE_NESSUNO);
  7463.                                 connettoreNonTrovatoConnettoriLabels.add(1, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_IDENTIFICATO_NESSUNO);
  7464.                             }
  7465.                             de.setPostBack(true);
  7466.                         }
  7467.                        
  7468.                         de.setValues(connettoreNonTrovatoConnettoriValues);
  7469.                         de.setLabels(connettoreNonTrovatoConnettoriLabels);
  7470.                         de.setSelected(connettoreNonTrovatoConnettore);
  7471.                         dati.add(de);
  7472.                        
  7473.                         if(TipoBehaviour.CONSEGNA_MULTIPLA.getValue().equals(modalitaConsegna) || TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7474.                             if(connettoreNonTrovatoConnettore==null ||
  7475.                                     //"".equals(connettoreNonTrovatoConnettore) ||
  7476.                                     CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA.equals(connettoreNonTrovatoConnettore)) {
  7477.                                 de = new DataElement();
  7478.                                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE+"__NOTE");
  7479.                                 de.setType(DataElementType.NOTE);
  7480.                                 de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_MULTI_WARNING);
  7481.                                 dati.add(de);
  7482.                             }
  7483.                             else if(org.openspcoop2.pdd.core.behaviour.conditional.Costanti.CONDITIONAL_NOME_CONNETTORE_VALORE_NESSUNO.equals(connettoreNonTrovatoConnettore)) {
  7484.                                 de = new DataElement();
  7485.                                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE+"__NOTE");
  7486.                                 de.setType(DataElementType.NOTE);
  7487.                                 de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_NESSUNA_CONSEGNA);
  7488.                                 dati.add(de);
  7489.                             }
  7490.                         }
  7491.                     }
  7492.                 }
  7493.             }
  7494.         }
  7495.        
  7496.         return dati;
  7497.     }
  7498.    
  7499.     public String getLabelStickySessionPattern(String stickyTipoSelettore){
  7500.         if(stickyTipoSelettore == null)
  7501.             return ModalitaIdentificazione.COOKIE_BASED.getLabelParametro();
  7502.        
  7503.         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore tipo = org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.toEnumConstant(stickyTipoSelettore);
  7504.        
  7505.         switch (tipo) {
  7506.         case COOKIE_BASED:
  7507.             return ModalitaIdentificazione.COOKIE_BASED.getLabelParametro();
  7508.         case HEADER_BASED:
  7509.             return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
  7510.         case FORM_BASED:
  7511.             return ModalitaIdentificazione.FORM_BASED.getLabelParametro();
  7512.         case CONTENT_BASED:
  7513.             return ModalitaIdentificazione.CONTENT_BASED.getLabelParametro();
  7514.         case URLBASED:
  7515.             return ModalitaIdentificazione.URL_BASED.getLabelParametro();
  7516.         case INDIRIZZO_IP:
  7517.             return ModalitaIdentificazione.INDIRIZZO_IP_BASED.getLabelParametro();
  7518.         case INDIRIZZO_IP_FORWARDED:
  7519.             return ModalitaIdentificazione.X_FORWARD_FOR_BASED.getLabelParametro();
  7520.         case TEMPLATE:
  7521.             return ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro();
  7522.         case FREEMARKER_TEMPLATE:
  7523.             return ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabelParametro();
  7524.         case VELOCITY_TEMPLATE:
  7525.             return ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabelParametro();
  7526.         }
  7527.         return ModalitaIdentificazione.COOKIE_BASED.getLabelParametro();
  7528.     }
  7529.    
  7530.     public String getLabelIdentificazioneCondizionalePattern(String identificazioneCondizionale){
  7531.         return getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale, null);
  7532.     }
  7533.    
  7534.    
  7535.     public String getLabelIdentificazioneCondizionalePattern(String identificazioneCondizionale, Boolean selezioneConnettoreByFiltro){
  7536.         if(identificazioneCondizionale == null)
  7537.             return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
  7538.        
  7539.         if(identificazioneCondizionale.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO)) {
  7540.             if(selezioneConnettoreByFiltro == null) {
  7541.                 return ModalitaIdentificazione.STATIC.getLabelParametro();
  7542.             }
  7543.            
  7544.             if(selezioneConnettoreByFiltro.booleanValue()) {
  7545.                 return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_PATTERN_FILTRO;
  7546.             } else {
  7547.                 return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_PATTERN_CONNETTORE;
  7548.             }
  7549.         }
  7550.        
  7551.         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore tipo = org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale);
  7552.        
  7553.         switch (tipo) {
  7554.         case HEADER_BASED:
  7555.             return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
  7556.         case FORM_BASED:
  7557.             return ModalitaIdentificazione.FORM_BASED.getLabelParametro();
  7558.         case CONTENT_BASED:
  7559.             return ModalitaIdentificazione.CONTENT_BASED.getLabelParametro();
  7560.         case URLBASED:
  7561.             return ModalitaIdentificazione.URL_BASED.getLabelParametro();
  7562.         case SOAPACTION_BASED:
  7563.             return ModalitaIdentificazione.SOAP_ACTION_BASED.getLabelParametro();
  7564.         case INDIRIZZO_IP:
  7565.             return ModalitaIdentificazione.INDIRIZZO_IP_BASED.getLabelParametro();
  7566.         case INDIRIZZO_IP_FORWARDED:
  7567.             return ModalitaIdentificazione.X_FORWARD_FOR_BASED.getLabelParametro();
  7568.         case TEMPLATE:
  7569.             return ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro();
  7570.         case FREEMARKER_TEMPLATE:
  7571.             return ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabelParametro();
  7572.         case VELOCITY_TEMPLATE:
  7573.             return ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabelParametro();
  7574.         }
  7575.         return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
  7576.     }
  7577.    
  7578.     public boolean connettoriMultipliConfigurazioneCheckData(TipoOperazione tipoOp, String stato, String modalitaConsegna, String tipoCustom, String loadBalanceStrategia,
  7579.             boolean isSoapOneWay,
  7580.             boolean sticky, String stickyTipoSelettore, String stickyTipoSelettorePattern, String stickyMaxAge,
  7581.             boolean passiveHealthCheck, String passiveHealthCheck_excludeForSeconds,
  7582.             ServiceBinding serviceBinding) throws Exception{
  7583.        
  7584.         if (StringUtils.isEmpty(stato)) {
  7585.             this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO+" non pu&ograve; essere vuoto");
  7586.             return false;
  7587.         }
  7588.         if(stato.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO)) {
  7589.             if (StringUtils.isEmpty(modalitaConsegna)) {
  7590.                 this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA+" non pu&ograve; essere vuoto");
  7591.                 return false;
  7592.             }
  7593.            
  7594.             boolean validaSezioneCondizionalita = false;
  7595.             // custom
  7596.             if(modalitaConsegna.equals(TipoBehaviour.CUSTOM.getValue())) {
  7597.                 if (StringUtils.isEmpty(tipoCustom) || CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(tipoCustom)) {
  7598.                     if(this.confCore.isConfigurazionePluginsEnabled()) {
  7599.                         this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_BEHAVIOUR_CUSTOM_NON_INDICATA);
  7600.                     }
  7601.                     else {
  7602.                         this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO+" non pu&ograve; essere vuoto");
  7603.                     }
  7604.                     return false;
  7605.                 }
  7606.                 if (tipoCustom.indexOf(" ") != -1 || tipoCustom.indexOf(",") != -1 ) {
  7607.                     this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_NON_INSERIRE_NE_SPAZI_NE_NEL_CAMPO_TIPO);
  7608.                     return false;
  7609.                 }
  7610.                 if(this.checkLength255(tipoCustom, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_CUSTOM_TIPO)==false) {
  7611.                     return false;
  7612.                 }
  7613.             } else if(modalitaConsegna.equals(TipoBehaviour.CONSEGNA_LOAD_BALANCE.getValue())) {
  7614.                 // select list con strategia
  7615.                 if (StringUtils.isEmpty(loadBalanceStrategia)) {
  7616.                     this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STRATEGIA+" non pu&ograve; essere vuoto");
  7617.                     return false;
  7618.                 }
  7619.                
  7620.                 if(sticky) {
  7621.                
  7622.                     org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore tipo =
  7623.                             org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.toEnumConstant(stickyTipoSelettore);
  7624.                    
  7625.                     if(tipo.hasParameter()) {
  7626.                    
  7627.                         if (StringUtils.isEmpty(stickyTipoSelettorePattern)) {
  7628.                             this.pd.setMessage("Il campo "+ this.getLabelStickySessionPattern(stickyTipoSelettore) +" non pu&ograve; essere vuoto");
  7629.                             return false;
  7630.                         }
  7631.                        
  7632.                         if(this.checkLength4000(stickyTipoSelettorePattern, this.getLabelStickySessionPattern(stickyTipoSelettore))==false) {
  7633.                             return false;
  7634.                         }
  7635.                        
  7636.                         if (org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.URLBASED.equals(tipo)) {
  7637.                             if(this.checkRegexp(stickyTipoSelettorePattern,ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  7638.                                 return false;
  7639.                             }
  7640.                         }
  7641.                         if (org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyTipoSelettore.CONTENT_BASED.equals(tipo)) {
  7642.                             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  7643.                                 if(this.checkXPath(stickyTipoSelettorePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  7644.                                     return false;
  7645.                                 }
  7646.                             }
  7647.                             else {
  7648.                                 if(this.checkXPathOrJsonPath(stickyTipoSelettorePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  7649.                                     return false;
  7650.                                 }
  7651.                             }
  7652.                         }
  7653.                     }
  7654.                    
  7655.                     if(!StringUtils.isEmpty(stickyMaxAge)) {
  7656.                    
  7657.                         int w = -1;
  7658.                         try {
  7659.                             w = Integer.parseInt(stickyMaxAge);
  7660.                         }catch (Exception e) {
  7661.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  7662.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_MAX_AGE));
  7663.                             return false;
  7664.                         }
  7665.                        
  7666.                         if(w < 0) {
  7667.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_MIN_XX_NON_VALIDO,
  7668.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_STICKY_MAX_AGE, 0));
  7669.                             return false;
  7670.                         }
  7671.                     }
  7672.                    
  7673.                 }
  7674.                
  7675.                 if(passiveHealthCheck) {
  7676.                     if(StringUtils.isEmpty(passiveHealthCheck_excludeForSeconds)) {
  7677.                         this.pd.setMessage("Il campo "+ PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS +" non pu&ograve; essere vuoto");
  7678.                         return false;
  7679.                     }
  7680.                     int w = -1;
  7681.                     try {
  7682.                         w = Integer.parseInt(passiveHealthCheck_excludeForSeconds);
  7683.                     }catch (Exception e) {
  7684.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  7685.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS));
  7686.                         return false;
  7687.                     }
  7688.                    
  7689.                     if(w < 0) {
  7690.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_MIN_XX_NON_VALIDO,
  7691.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_MODALITA_CONSEGNA_LOAD_BALANCE_PASSIVE_HEALTH_CHECK_EXCLUDE_FOR_SECONDS, 0));
  7692.                         return false;
  7693.                     }
  7694.                 }
  7695.                
  7696.                 validaSezioneCondizionalita = true;
  7697.                
  7698.                
  7699.             }  else if(modalitaConsegna.equals(TipoBehaviour.CONSEGNA_MULTIPLA.getValue()) ||
  7700.                     modalitaConsegna.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue()) ||
  7701.                     modalitaConsegna.equals(TipoBehaviour.CONSEGNA_CONDIZIONALE.getValue())) {
  7702.                
  7703.                 validaSezioneCondizionalita = true;
  7704.             }
  7705.            
  7706.             // validazione della sezione gestione notifiche
  7707.             String connettoreImplementaAPI = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API);
  7708.             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7709.                 // select list con strategia
  7710.                 if (StringUtils.isEmpty(connettoreImplementaAPI)) {
  7711.                     this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API+" non pu&ograve; essere vuoto");
  7712.                     return false;
  7713.                 }
  7714.                
  7715.                 String notificheCondizionaliEsitoS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI_ESITO);
  7716.                 boolean notificheCondizionaliEsito = ServletUtils.isCheckBoxEnabled(notificheCondizionaliEsitoS);
  7717.                
  7718.                 if(notificheCondizionaliEsito) {
  7719.                     String [] esitiTransazione = this.getParameterValues(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ESITI_TRANSAZIONE);
  7720.                    
  7721.                     if(esitiTransazione == null || esitiTransazione.length <= 0) {
  7722.                         this.pd.setMessage("Almeno una selezione deve essere effettuata in '"+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI_ESITO+"'");
  7723.                         return false;
  7724.                     }
  7725.                 }
  7726.             }
  7727.            
  7728.             // validazione della sezione condizionalita'
  7729.             if(validaSezioneCondizionalita) {
  7730.                 String consegnaCondizionaleS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONSEGNA_CONDIZIONALE);
  7731.                 boolean consegnaCondizionale = ServletUtils.isCheckBoxEnabled(consegnaCondizionaleS);
  7732.                
  7733.                 if(consegnaCondizionale) {
  7734.                     String selezioneConnettoreBy = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY);
  7735.                    
  7736.                     if (StringUtils.isEmpty(selezioneConnettoreBy)) {
  7737.                         this.pd.setMessage("Il campo "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY+" non pu&ograve; essere vuoto");
  7738.                         return false;
  7739.                     }
  7740.                    
  7741.                     String identificazioneCondizionale = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE);
  7742.                    
  7743.                     org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore tipo = org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale);
  7744.                                        
  7745.                     if(tipo.hasParameter()) {
  7746.                    
  7747.                         String identificazioneCondizionalePattern = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PATTERN);
  7748.                        
  7749.                         if (StringUtils.isEmpty(identificazioneCondizionalePattern)) {
  7750.                             this.pd.setMessage("Il campo "+ this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale) +" non pu&ograve; essere vuoto");
  7751.                             return false;
  7752.                         }
  7753.                        
  7754.                         if(this.checkLength4000(identificazioneCondizionalePattern, this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale))==false) {
  7755.                             return false;
  7756.                         }
  7757.                        
  7758.                        
  7759.                         if (org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.equals(tipo)) {
  7760.                             if(this.checkRegexp(identificazioneCondizionalePattern,ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  7761.                                 return false;
  7762.                             }
  7763.                         }
  7764.                         if (org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.equals(tipo)) {
  7765.                             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  7766.                                 if(this.checkXPath(identificazioneCondizionalePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  7767.                                     return false;
  7768.                                 }
  7769.                             }
  7770.                             else {
  7771.                                 if(this.checkXPathOrJsonPath(identificazioneCondizionalePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  7772.                                     return false;
  7773.                                 }
  7774.                             }
  7775.                         }
  7776.                     }
  7777.                    
  7778.                                        
  7779.                     if(!tipo.isTemplate()){  // e' un caso in cui e' visibile
  7780.                    
  7781.                         String identificazioneCondizionalePrefisso = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO);
  7782.                         String identificazioneCondizionaleSuffisso = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO);
  7783.                        
  7784.                         if(this.checkLength255(identificazioneCondizionalePrefisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO)==false) {
  7785.                             return false;
  7786.                         }
  7787.                        
  7788.                         if(this.checkLength255(identificazioneCondizionaleSuffisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO)==false) {
  7789.                             return false;
  7790.                         }
  7791.                     }
  7792.                    
  7793.                     String condizioneNonIdentificataAbortTransactionS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_ABORT_TRANSACTION);
  7794.                     boolean condizioneNonIdentificataAbortTransaction = ServletUtils.isCheckBoxEnabled(condizioneNonIdentificataAbortTransactionS);
  7795.                     if(!condizioneNonIdentificataAbortTransaction) {
  7796.                         String condizioneNonIdentificataDiagnostico = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO);
  7797.                        
  7798.                         if (StringUtils.isEmpty(condizioneNonIdentificataDiagnostico)) {
  7799.                             this.pd.setMessage("Il campo "+  PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO +" non pu&ograve; essere vuoto");
  7800.                             return false;
  7801.                         }
  7802.                        
  7803.                         String condizioneNonIdentificataConnettore = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE);
  7804.                        
  7805.                         if(modalitaConsegna.equals(TipoBehaviour.CONSEGNA_CONDIZIONALE.getValue())) {  
  7806.                             if (StringUtils.isEmpty(condizioneNonIdentificataConnettore)) {
  7807.                                 this.pd.setMessage("Il campo "+  
  7808.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE +" nella sezione '"+
  7809.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA+"' non pu&ograve; essere vuoto");
  7810.                                 return false;
  7811.                             }
  7812.                         }
  7813.                        
  7814.                         if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7815.                             if(connettoreImplementaAPI.equals(condizioneNonIdentificataConnettore)) {
  7816.                                 this.pd.setMessage("Il campo '"+  
  7817.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_CONNETTORE +"' nella sezione '"+
  7818.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA+"' non pu&ograve; contenere lo stesso valore indicato nel campo '" +
  7819.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API +"'");
  7820.                                 return false;
  7821.                             }
  7822.                         }
  7823.                     }
  7824.                    
  7825.                     String connettoreNonTrovatoAbortTransactionS = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_ABORT_TRANSACTION);
  7826.                     boolean connettoreNonTrovatoAbortTransaction = ServletUtils.isCheckBoxEnabled(connettoreNonTrovatoAbortTransactionS);
  7827.                     if(!connettoreNonTrovatoAbortTransaction) {
  7828.                         String connettoreNonTrovatoDiagnostico = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO);
  7829.                        
  7830.                         if (StringUtils.isEmpty(connettoreNonTrovatoDiagnostico)) {
  7831.                             this.pd.setMessage("Il campo "+  PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_DIAGNOSTICO +" non pu&ograve; essere vuoto");
  7832.                             return false;
  7833.                         }
  7834.                        
  7835.                         String connettoreNonTrovatoConnettore = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE);
  7836.                        
  7837.                         if(modalitaConsegna.equals(TipoBehaviour.CONSEGNA_CONDIZIONALE.getValue())) {  
  7838.                             if (StringUtils.isEmpty(connettoreNonTrovatoConnettore)) {
  7839.                                 this.pd.setMessage("Il campo "+  
  7840.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE +" nella sezione '"+
  7841.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO+"' non pu&ograve; essere vuoto");
  7842.                                 return false;
  7843.                             }
  7844.                         }
  7845.                        
  7846.                         if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.getValue().equals(modalitaConsegna)) {
  7847.                             if(connettoreImplementaAPI.equals(connettoreNonTrovatoConnettore)) {
  7848.                                 this.pd.setMessage("Il campo '"+  
  7849.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO_CONNETTORE +"' nella sezione '"+
  7850.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO+"' non pu&ograve; contenere lo stesso valore indicato nel campo '" +
  7851.                                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API +"'");
  7852.                                 return false;
  7853.                             }
  7854.                         }
  7855.                     }
  7856.                 }
  7857.             }
  7858.         }
  7859.        
  7860.         return true;
  7861.     }
  7862.     public void preparePorteAppConnettoriMultipliList(String nomePorta, ConsoleSearch ricerca,
  7863.             List<PortaApplicativaServizioApplicativo> listaFiltrata,
  7864.             PortaApplicativa pa) throws Exception {
  7865.         this.preparePorteAppConnettoriMultipliListEngine(nomePorta, ricerca,
  7866.                 listaFiltrata,
  7867.                 pa,
  7868.                 false,
  7869.                 false,
  7870.                 false,
  7871.                 null);
  7872.     }
  7873.     public void preparePorteAppConnettoriMultipliList_fromAddConnettore(String nomePorta, ConsoleSearch ricerca,
  7874.             List<PortaApplicativaServizioApplicativo> listaFiltrata,
  7875.             PortaApplicativa pa,
  7876.             String nomeConnettoreAdd) throws Exception {
  7877.         this.preparePorteAppConnettoriMultipliListEngine(nomePorta, ricerca,
  7878.                 listaFiltrata,
  7879.                 pa,
  7880.                 true,
  7881.                 false,
  7882.                 false,
  7883.                 nomeConnettoreAdd);
  7884.     }
  7885.     public void preparePorteAppConnettoriMultipliList_fromChangeConnettore(String nomePorta, ConsoleSearch ricerca,
  7886.             List<PortaApplicativaServizioApplicativo> listaFiltrata,
  7887.             PortaApplicativa pa,
  7888.             String nomeConnettoreChanged) throws Exception {
  7889.         this.preparePorteAppConnettoriMultipliListEngine(nomePorta, ricerca,
  7890.                 listaFiltrata,
  7891.                 pa,
  7892.                 false,
  7893.                 true,
  7894.                 false,
  7895.                 nomeConnettoreChanged);
  7896.     }
  7897.     public void preparePorteAppConnettoriMultipliList_fromDeleteConnettore(String nomePorta, ConsoleSearch ricerca,
  7898.             List<PortaApplicativaServizioApplicativo> listaFiltrata,
  7899.             PortaApplicativa pa) throws Exception {
  7900.         this.preparePorteAppConnettoriMultipliListEngine(nomePorta, ricerca,
  7901.                 listaFiltrata,
  7902.                 pa,
  7903.                 false,
  7904.                 false,
  7905.                 true,
  7906.                 null);
  7907.     }
  7908.    
  7909.     private void preparePorteAppConnettoriMultipliListEngine(String nomePorta, ConsoleSearch ricerca,
  7910.             List<PortaApplicativaServizioApplicativo> listaFiltrata,
  7911.             PortaApplicativa pa,
  7912.             boolean fromAdd,
  7913.             boolean fromChange,
  7914.             boolean fromDelete,
  7915.             String nomeConnettoreProcessed) throws Exception {
  7916.         try {
  7917.            
  7918.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  7919.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  7920.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  7921.             if(idAsps == null)
  7922.                 idAsps = "";

  7923.             String idPorta = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  7924.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  7925.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, idPorta);
  7926.             Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, nomePorta);
  7927.             Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  7928.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  7929.            
  7930.             String idTabP = this.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  7931.             Parameter pIdTab = new Parameter(CostantiControlStation.PARAMETRO_ID_TAB, idTabP != null ? idTabP : "");
  7932.            
  7933.             String accessoDaAPSParametro = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS);
  7934.             Parameter pAccessoDaAPS = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS, accessoDaAPSParametro != null ? accessoDaAPSParametro : "");
  7935.             String connettoreAccessoGruppi = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  7936.             Parameter pConnettoreAccessoDaGruppi = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI, connettoreAccessoGruppi);
  7937.             String connettoreRegistro = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  7938.             Parameter pConnettoreRegistro = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO, connettoreRegistro);
  7939.             Parameter pConnettoreAccessoCM = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI, "true");
  7940.            
  7941.            
  7942.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI, pIdPorta, pIdSogg, pIdAsps, pNomePorta, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pAccessoDaAPS, pIdTab);
  7943.            
  7944.             this.pd.setCustomListViewName(PorteApplicativeCostanti.PORTE_APPLICATIVE_NOME_VISTA_CUSTOM_CONNETTORI_MULTIPLI);
  7945.            
  7946.             int idLista = Liste.PORTE_APPLICATIVE_CONNETTORI_MULTIPLI;
  7947.             int limit = ricerca.getPageSize(idLista);
  7948.             int offset = ricerca.getIndexIniziale(idLista);
  7949.             ServletUtils.disabledPageDataSearch(this.pd); // disabilito il campo search sostituito dal filtro nome
  7950. /**         String search = ServletUtils.getSearchFromSession(ricerca, idLista);*/
  7951.            
  7952.             // filtro tab N.B. impostare sempre come primo! poi aggiornare il valore
  7953.             String tabSelezionato = SearchUtils.getFilter(ricerca, idLista, PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRO_HIDDEN_TAB_SELEZIONATO);
  7954.             this.addFilterHidden(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRO_HIDDEN_TAB_SELEZIONATO, tabSelezionato);
  7955.            
  7956.             // nuovo filtro nome al posto della search
  7957.             String filtroNomeConnettore = this.addFilterNomeConnettoreMultiplo(ricerca, idLista);
  7958.            
  7959.             boolean behaviourConFiltri = ConditionalUtils.isConfigurazioneCondizionaleByFilter(pa, this.log);
  7960.        
  7961.             // nuovo filtro filtro
  7962.             this.addFilterFiltroConnettoreMultiplo(ricerca, idLista, behaviourConFiltri);
  7963.            
  7964.            
  7965.             // **** filtro connettore ****
  7966.            
  7967.             // nuovi filtri connettore
  7968.             this.addFilterSubtitle(ConnettoriCostanti.NAME_SUBTITLE_DATI_CONNETTORE, ConnettoriCostanti.LABEL_SUBTITLE_DATI_CONNETTORE, false);
  7969.            
  7970.             // filtro tipo connettore con voce IM solo sulle erogazioni
  7971.             String filterTipoConnettore = this.addFilterTipoConnettore(ricerca, idLista, true);
  7972.            
  7973.             // filtro plugin
  7974.             this.addFilterConnettorePlugin(ricerca, idLista, filterTipoConnettore);
  7975.        
  7976.             // filtro debug
  7977.             if(!this.isModalitaStandard()) {
  7978.                 this.addFilterConnettoreDebug(ricerca, idLista, filterTipoConnettore);
  7979.             }
  7980.            
  7981.             // filtro token policy
  7982.             this.addFilterConnettoreTokenPolicy(ricerca, idLista, filterTipoConnettore);
  7983.            
  7984.             // filtro endpoint
  7985.             this.addFilterConnettoreEndpoint(ricerca, idLista, filterTipoConnettore);
  7986.            
  7987.             // filtro keystore
  7988.             this.addFilterConnettoreKeystore(ricerca, idLista, filterTipoConnettore);
  7989.                        
  7990.             // imposto apertura sezione
  7991.             this.impostaAperturaSubtitle(ConnettoriCostanti.NAME_SUBTITLE_DATI_CONNETTORE);

  7992.             // **** fine filtro connettore ****
  7993.            
  7994.            
  7995.             this.pd.setIndex(offset);
  7996.             this.pd.setPageSize(limit);
  7997. /**         this.pd.setLabelBottoneFiltra(CostantiControlStation.LABEL_BOTTONE_INDIVIDUA_CONNETTORE);*/
  7998.            
  7999.             boolean accessoDaListaAPS = false;
  8000.            
  8001.             if(Costanti.CHECK_BOX_ENABLED_TRUE.equals(accessoDaAPSParametro)) {
  8002.                 accessoDaListaAPS = true;
  8003.             }
  8004.            
  8005.             boolean isModalitaCompleta = this.isModalitaCompleta();
  8006.             Boolean vistaErogazioni = ServletUtils.getBooleanAttributeFromSession(ErogazioniCostanti.ASPS_EROGAZIONI_ATTRIBUTO_VISTA_EROGAZIONI, this.session, this.request).getValue();
  8007.            
  8008.             /**PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));*/
  8009.            
  8010.             TipoBehaviour behaviourType = TipoBehaviour.toEnumConstant(pa.getBehaviour().getNome());
  8011.            
  8012.             LoadBalancerType loadBalancerType = null;
  8013.             if(behaviourType.equals(TipoBehaviour.CONSEGNA_LOAD_BALANCE)) {
  8014.                 String balancerTypeS = org.openspcoop2.pdd.core.behaviour.built_in.load_balance.ConfigurazioneLoadBalancer.readLoadBalancerType(pa.getBehaviour());
  8015.                 loadBalancerType = LoadBalancerType.toEnumConstant(balancerTypeS, true);
  8016.             }
  8017.             long idAspsLong = Long.parseLong(idAsps);
  8018.             AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(idAspsLong);
  8019.             AccordoServizioParteComuneSintetico as = null;
  8020.             if(this.porteApplicativeCore.isRegistroServiziLocale()){
  8021.                 int idAcc = asps.getIdAccordo().intValue();
  8022.                 as = this.apcCore.getAccordoServizioSintetico(idAcc);
  8023.             }
  8024.             else{
  8025.                 as = this.apcCore.getAccordoServizioSintetico(IDAccordoFactory.getInstance().getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  8026.             }
  8027.            
  8028.             ServiceBinding serviceBinding = this.porteApplicativeCore.toMessageServiceBinding(as.getServiceBinding());
  8029.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  8030.            
  8031.             String labelPerPorta = null;
  8032.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  8033.                 if(accessoDaListaAPS) {
  8034.                     if(!isModalitaCompleta) {
  8035.                         if(vistaErogazioni != null && vistaErogazioni.booleanValue()) {
  8036.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI;
  8037.                         } else {
  8038.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI+
  8039.                                     this.getLabelIdServizio(asps);
  8040.                         }
  8041.                     }
  8042.                     else {
  8043.                         labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI;
  8044.                     }
  8045.                 }
  8046.                 else {
  8047.                     labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  8048.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI,
  8049.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI,
  8050.                             pa);
  8051.                 }
  8052.             }
  8053.             else {
  8054.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI+nomePorta;
  8055.             }
  8056.            
  8057.             if(accessoDaListaAPS) {
  8058.                 lstParam.remove(lstParam.size()-1);
  8059.             }
  8060.            
  8061.             this.pd.setSearchLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME);
  8062.             this.pd.setSearchDescription("");
  8063.             lstParam.add(new Parameter(labelPerPorta,null));
  8064.            
  8065. /**         if(search.equals("")){
  8066. //              this.pd.setSearchDescription("");
  8067. //              lstParam.add(new Parameter(labelPerPorta,null));
  8068. //          }else{
  8069. //              List<Parameter> listParametersConfigutazioneConnettoriMultipli = new ArrayList<>();
  8070. //              listParametersConfigutazioneConnettoriMultipli.add(pIdSogg);
  8071. //              listParametersConfigutazioneConnettoriMultipli.add(pIdPorta);
  8072. //              listParametersConfigutazioneConnettoriMultipli.add(pIdAsps);
  8073. //              listParametersConfigutazioneConnettoriMultipli.add(pAccessoDaAPS);
  8074. //              listParametersConfigutazioneConnettoriMultipli.add(pConnettoreAccessoDaGruppi);
  8075. //              listParametersConfigutazioneConnettoriMultipli.add(pConnettoreRegistro);
  8076. //              
  8077. //              lstParam.add(new Parameter(labelPerPorta,
  8078. //                      PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONFIGURAZIONE_CONNETTORI_MULTIPLI,
  8079. //                      listParametersConfigutazioneConnettoriMultipli.toArray(new Parameter[1])));
  8080. //              lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));
  8081. //          }*/
  8082.            
  8083.             // setto la barra del titolo
  8084.             ServletUtils.setPageDataTitle(this.pd, lstParam );  
  8085.            
  8086.             // controllo eventuali risultati ricerca
  8087. /**         if (!search.equals("")) {
  8088. //              ServletUtils.enabledPageDataSearch(this.pd, ErogazioniCostanti.LABEL_ASPS_EROGAZIONI, search);
  8089. //          }*/
  8090.            
  8091.             // imposta menu' contestuale
  8092.             this.impostaComandiMenuContestualePA(idsogg, idAsps);
  8093.            
  8094.             // preparo i dati
  8095.             List<List<DataElement>> dati = new ArrayList<>();
  8096.            
  8097.             int idTab = 0;
  8098.            
  8099. /**         if(accessoDaAPSParametro!=null && !"".equals(accessoDaAPSParametro)) {
  8100. //              pAccessoDaAPS = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS, accessoDaAPSParametro);
  8101. //          }*/
  8102.            
  8103.             Parameter pConfigurazioneDatiGenerali = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DATI_GENERALI, Costanti.CHECK_BOX_ENABLED_TRUE);
  8104.             Parameter pConfigurazioneDescrizione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DESCRIZIONE, Costanti.CHECK_BOX_ENABLED_TRUE);
  8105.             Parameter pConfigurazioneFiltro = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_FILTRO, Costanti.CHECK_BOX_ENABLED_TRUE);
  8106.             Parameter pConfigurazioneConnettore = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONNETTORE, Costanti.CHECK_BOX_ENABLED_TRUE);
  8107.            
  8108.             // controllo che ci sia almeno un risultato altrimenti visualizzo un messaggio di info/errore
  8109.             if(listaFiltrata.isEmpty()) {
  8110.                 if(!fromDelete) {
  8111.                     this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_RICERCA_CONNETTORI_MULTIPLI_NO_RISULTATI);
  8112.                 } else {
  8113.                     // se passo qui vuol dire che ho eliminato tutti i connettori corrispondenti al filtro di ricerca
  8114.                     this.pd.setMessage(PorteApplicativeCostanti.MESSAGGIO_ERRORE_ELIMINATI_CONNETTORI_MULTIPLI_CORRISPONDENTI_AL_FILTRO_RICERCA);
  8115.                 }
  8116.             }
  8117.            
  8118.             // Colleziono prima i nomi dei connettori per ordinarli in ordine alfatebito, lasciando in testa il connettore di default
  8119.             HashMap<String, PortaApplicativaServizioApplicativo> paList = new HashMap<>();
  8120.             PortaApplicativaServizioApplicativo paDefault = null;
  8121.             Iterator<PortaApplicativaServizioApplicativo> it = listaFiltrata.iterator();
  8122.             while (it.hasNext()) {
  8123.                 PortaApplicativaServizioApplicativo paSA = it.next();
  8124.                 boolean connettoreDefault = this.isConnettoreDefault(paSA);
  8125.                 if(connettoreDefault) {
  8126.                     paDefault = paSA;
  8127.                 }
  8128.                 else {
  8129.                     String nomeConnettore =  this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  8130.                     paList.put(nomeConnettore, paSA);
  8131.                 }
  8132.             }
  8133.             List<PortaApplicativaServizioApplicativo> listOrdinata = new ArrayList<>();
  8134.             if(paDefault!=null) {
  8135.                 listOrdinata.add(paDefault);
  8136.             }  
  8137.             if(!paList.isEmpty()) {
  8138.                 List<String> keysOrdinate = new ArrayList<>();
  8139.                 keysOrdinate.addAll(paList.keySet());
  8140.                 Collections.sort(keysOrdinate);
  8141.                 for (String key : keysOrdinate) {
  8142.                     PortaApplicativaServizioApplicativo paSA = paList.get(key);
  8143.                     listOrdinata.add(paSA);
  8144.                 }
  8145.             }
  8146.            
  8147.             // dopo aver filtrato i risultati evidenzio il tab con il nome contenuto nella ricerca
  8148.             int tab = 0; // primo a sx
  8149.            
  8150.             if(StringUtils.isBlank(tabSelezionato) || ((fromAdd || fromChange) && StringUtils.isNotBlank(nomeConnettoreProcessed))) {
  8151.                 if(
  8152.                     ((fromAdd || fromChange) && StringUtils.isNotBlank(nomeConnettoreProcessed))
  8153.                     &&
  8154.                     (listOrdinata!=null && !listOrdinata.isEmpty())
  8155.                     ){
  8156.                     for (int i = 0; i < listOrdinata.size(); i++) {
  8157.                         String tabSelezionatoCheck =  this.getLabelNomePortaApplicativaServizioApplicativo(listOrdinata.get(i));
  8158.                         if(nomeConnettoreProcessed.equals(tabSelezionatoCheck)) {
  8159.                             tabSelezionato = nomeConnettoreProcessed;
  8160.                             break;
  8161.                         }
  8162.                     }
  8163.                 }
  8164.                
  8165.                 if( !fromDelete &&
  8166.                         (tabSelezionato==null || StringUtils.isBlank(tabSelezionato))
  8167.                         ) {
  8168.                     String idConnTabP = this.getParameter(CostantiControlStation.PARAMETRO_ID_CONN_TAB);
  8169.                     if(StringUtils.isNotBlank(idConnTabP)) {
  8170.                         int idConnTab = -1;
  8171.                         try {
  8172.                             idConnTab = Integer.valueOf(idConnTabP);
  8173.                             if(idConnTab>=0 && listOrdinata!=null && listOrdinata.size()>idConnTab) {
  8174.                                 tabSelezionato =  this.getLabelNomePortaApplicativaServizioApplicativo(listOrdinata.get(idConnTab));
  8175.                             }
  8176.                         }catch(Exception t) {
  8177.                             // ignore
  8178.                         }
  8179.                     }
  8180.                 }
  8181.             }
  8182.            
  8183.             ServletUtils.setObjectIntoSession(this.request, this.session, tab+"", CostantiControlStation.PARAMETRO_ID_CONN_TAB);
  8184.             if(StringUtils.isBlank(tabSelezionato)) {
  8185.                 if(!listOrdinata.isEmpty()) {
  8186.                     tabSelezionato =  this.getLabelNomePortaApplicativaServizioApplicativo(listOrdinata.get(0));
  8187.                 }
  8188.             } else {
  8189.                 // controllo se il tab gia' selezionato e' ancora contenuto nei risultati della ricerca
  8190.                 PortaApplicativaServizioApplicativo saContenenteNome = getFiltroNomeConnettore(tabSelezionato, listOrdinata);
  8191.                
  8192.                 if(saContenenteNome!=null) {
  8193.                     tab = 0;
  8194.                     for (int i = 0; i < listOrdinata.size(); i++) {
  8195.                         if(listOrdinata.get(i).getNome().equals(saContenenteNome.getNome())) {
  8196.                             tab = i;
  8197.                             break;
  8198.                         }
  8199.                     }
  8200.                     if(tab>=0) {
  8201.                         ServletUtils.setObjectIntoSession(this.request, this.session, tab+"", CostantiControlStation.PARAMETRO_ID_CONN_TAB);
  8202.                     }
  8203.                 } else {
  8204.                     tabSelezionato = "";
  8205.                     if(!listOrdinata.isEmpty()) {
  8206.                         if(!filtroNomeConnettore.equals("")) {
  8207.                             saContenenteNome = getFiltroNomeConnettore(filtroNomeConnettore, listOrdinata);
  8208.                             if(saContenenteNome!=null) {
  8209.                                 tab = 0;
  8210.                                 for (int i = 0; i < listOrdinata.size(); i++) {
  8211.                                     if(listOrdinata.get(i).getNome().equals(saContenenteNome.getNome())) {
  8212.                                         tab = i;
  8213.                                         tabSelezionato =  this.getLabelNomePortaApplicativaServizioApplicativo(listOrdinata.get(i));
  8214.                                         break;
  8215.                                     }
  8216.                                 }
  8217.                                 if(tab>=0) {
  8218.                                     ServletUtils.setObjectIntoSession(this.request, this.session, tab+"", CostantiControlStation.PARAMETRO_ID_CONN_TAB);
  8219.                                 }
  8220.                             }
  8221.                         } else {
  8222.                             tabSelezionato =  this.getLabelNomePortaApplicativaServizioApplicativo(listOrdinata.get(0));
  8223.                         }
  8224.                     }
  8225.                 }
  8226.             }
  8227.            
  8228.             // imposto il nuovo valore nel campo hidden del filtro
  8229.             this.pd.updateFilter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRO_HIDDEN_TAB_SELEZIONATO, tabSelezionato);
  8230.            
  8231.             for(PortaApplicativaServizioApplicativo paSA: listOrdinata) {
  8232.                
  8233.                 PortaApplicativaServizioApplicativoConnettore datiConnettore = paSA.getDatiConnettore();
  8234.                
  8235.                 List<DataElement> e = new ArrayList<>();
  8236.                
  8237.                 Parameter pIdTAb = new Parameter(CostantiControlStation.PARAMETRO_ID_CONN_TAB, ""+idTab);
  8238.                 Parameter pNomePaSA = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA, paSA.getNome());
  8239.                
  8240.                 // nome e stato
  8241.                 String nomeConnettore =  this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  8242.                 StatoFunzionalita stato = datiConnettore != null ? datiConnettore.getStato() : StatoFunzionalita.ABILITATO;
  8243.                 boolean statoPA = stato.equals(StatoFunzionalita.ABILITATO);
  8244.                 StatoFunzionalita scheduling = datiConnettore != null ? datiConnettore.getScheduling() : StatoFunzionalita.ABILITATO;
  8245.                 boolean schedulingPA = scheduling.equals(StatoFunzionalita.ABILITATO);
  8246.                 String statoMapping = statoPA ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO_TOOLTIP : PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_DISABILITATO_TOOLTIP;
  8247.                 String statoScheduling = schedulingPA ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SCHEDULING_ABILITATO_TOOLTIP : PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SCHEDULING_DISABILITATO_TOOLTIP;
  8248.                 boolean urlCambiaStato = true;
  8249.                
  8250.                 boolean connettoreDefault = this.isConnettoreDefault(paSA);
  8251.                
  8252.                 boolean showCambiaStati = urlCambiaStato;
  8253.                 boolean showCambiaScheduling = false;
  8254.                 if(pa.sizeServizioApplicativoList()>1 &&
  8255.                     showCambiaStati) {
  8256.                     if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(behaviourType) && this.isConnettoreDefault(paSA)) {
  8257.                         showCambiaStati = false;
  8258.                     }
  8259.                     if(showCambiaStati) {
  8260.                         showCambiaScheduling = TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(behaviourType) || TipoBehaviour.CONSEGNA_MULTIPLA.equals(behaviourType);
  8261.                     }
  8262.                 }
  8263.                
  8264.                 IDServizioApplicativo idServizioApplicativo = new IDServizioApplicativo();
  8265.                 idServizioApplicativo.setIdSoggettoProprietario(new IDSoggetto(pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario()));
  8266.                 idServizioApplicativo.setNome(paSA.getNome());
  8267.                 ServizioApplicativo sa = this.saCore.getServizioApplicativo(idServizioApplicativo);
  8268.                 org.openspcoop2.core.config.InvocazioneServizio is = sa!=null ? sa.getInvocazioneServizio() : null;
  8269.                 org.openspcoop2.core.config.Connettore connettore = is!=null ? is.getConnettore() : null;
  8270.                
  8271.                 if(showCambiaScheduling &&
  8272.                     (is!=null && is.getGetMessage()!=null && StatoFunzionalita.ABILITATO.equals(is.getGetMessage()))
  8273.                     ){
  8274.                     if(connettore!=null && connettore.getTipo()!=null) {
  8275.                         String tipo = connettore.getTipo();
  8276.                         TipiConnettore tipoC = TipiConnettore.toEnumFromName(tipo);
  8277.                         if(TipiConnettore.DISABILITATO.equals(tipoC)) {
  8278.                             showCambiaScheduling = false;
  8279.                         }
  8280.                     }
  8281.                     else {
  8282.                         showCambiaScheduling = false;
  8283.                     }
  8284.                 }
  8285.                
  8286.                 boolean descrizioneEmpty = datiConnettore==null || datiConnettore.getDescrizione()==null || StringUtils.isEmpty(datiConnettore.getDescrizione());
  8287.                
  8288.                 // Nome / Stato
  8289.                 DataElement de = new DataElement();
  8290.                
  8291.                 de.setWidthPx(10);
  8292.                 if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(behaviourType) && this.isConnettoreDefault(paSA)) {
  8293.                     de.setType(DataElementType.TEXT);
  8294.                 }
  8295.                 else {
  8296.                     de.setType(DataElementType.CHECKBOX);

  8297.                     de.setStatusToolTip(statoPA ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO_TOOLTIP_NO_ACTION : PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_DISABILITATO_TOOLTIP_NO_ACTION);
  8298.                     de.setStatusType(statoPA ? CheckboxStatusType.ABILITATO : CheckboxStatusType.DISABILITATO);
  8299.                     if(statoPA && showCambiaScheduling && !schedulingPA) {
  8300.                         de.setStatusType(CheckboxStatusType.WARNING_ONLY);
  8301.                         de.setStatusToolTip(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SCHEDULING_DISABILITATO_TOOLTIP_NO_ACTION);
  8302.                     }
  8303.                    
  8304.                     de.setStatusValue(nomeConnettore);
  8305.                 }
  8306.                
  8307.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME);
  8308.                 de.setValue(nomeConnettore);
  8309.                

  8310.                 DataElementImage image = new DataElementImage();
  8311.                
  8312.                 image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CHANGE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb, pConfigurazioneDatiGenerali,
  8313.                         pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM    );
  8314.                 image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME));
  8315.                 image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8316.                
  8317.                 de.addImage(image );
  8318.                
  8319.                 if(descrizioneEmpty) {
  8320.                    
  8321.                     image = new DataElementImage();
  8322.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CHANGE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb,pConfigurazioneDescrizione, pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8323.                     image.setToolTip(MessageFormat.format(CostantiControlStation.AGGIUNGI_DESCRIZIONE_TOOLTIP_CON_PARAMETRO, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE));
  8324.                     image.setImage(CostantiControlStation.ICONA_AGGIUNGI_DESCRIZIONE);
  8325.                    
  8326.                     de.addImage(image);
  8327.                 }
  8328.                            
  8329.                 if(pa.sizeServizioApplicativoList()>1) {    
  8330.                     if(!connettoreDefault)
  8331.                         de.setIdToRemove(paSA.getNome());
  8332.                    
  8333.                     if(showCambiaStati) {
  8334.                    
  8335.                         Parameter pAbilita = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ABILITA,  (statoPA ? Costanti.CHECK_BOX_DISABLED : Costanti.CHECK_BOX_ENABLED_TRUE));
  8336.                         image = new DataElementImage();
  8337.                         image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ABILITAZIONE, pIdSogg, pNomePorta, pIdPorta,pIdAsps,  pNomePaSA, pIdTAb, pAbilita,
  8338.                                 pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8339.                         image.setToolTip(statoMapping);
  8340.                         image.setImage(statoPA ? CostantiControlStation.ICONA_MODIFICA_TOGGLE_ON : CostantiControlStation.ICONA_MODIFICA_TOGGLE_OFF);
  8341.                         de.addImage(image);
  8342.                        
  8343.                         if(showCambiaScheduling && statoPA) {
  8344.                             pAbilita = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ABILITA,  (schedulingPA ? Costanti.CHECK_BOX_DISABLED : Costanti.CHECK_BOX_ENABLED_TRUE));
  8345.                             Parameter pScheduling = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_SCHEDULING,  "true");
  8346.                             image = new DataElementImage();
  8347.                             image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_ABILITAZIONE, pIdSogg, pNomePorta, pIdPorta,pIdAsps,  pNomePaSA, pIdTAb, pAbilita,
  8348.                                     pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM,
  8349.                                     pScheduling);
  8350.                             image.setToolTip(statoScheduling);
  8351.                             image.setImage(schedulingPA ? CostantiControlStation.ICONA_SCHEDULE_ACTIVE : CostantiControlStation.ICONA_SCHEDULE_PASSIVE);
  8352.                             de.addImage(image);
  8353.                         }
  8354.                     }
  8355.                    
  8356.                 }  
  8357.                
  8358.                 e.add(de);
  8359.                
  8360.                 // Descrizione
  8361.                 if(!descrizioneEmpty) {
  8362.                     String descrizioneOrig = (datiConnettore != null && datiConnettore.getDescrizione() != null) ? datiConnettore.getDescrizione() : "";
  8363.                    
  8364.                     de = new DataElement();
  8365.                     de.setType(DataElementType.TEXT);
  8366.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE);
  8367.                    
  8368.                     int length = 150;
  8369.                     String descrizione = descrizioneOrig;
  8370.                     if(descrizione!=null && descrizione.length()>length) {
  8371.                         descrizione = descrizione.substring(0, (length-4)) + " ...";
  8372.                     }
  8373.                     de.setValue(descrizione!=null ? StringEscapeUtils.escapeHtml(descrizione) : null);
  8374.                     de.setToolTip(descrizioneOrig);
  8375.                     de.setCopyToClipboard(descrizioneOrig);
  8376.                                        
  8377.                     image = new DataElementImage();
  8378.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CHANGE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb,pConfigurazioneDescrizione, pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8379.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE));
  8380.                     image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8381.                    
  8382.                     de.addImage(image );
  8383.                    
  8384.                     e.add(de);
  8385.                 }
  8386.                
  8387.                 // Connettore
  8388.                 de = new DataElement();
  8389.                 de.setType(DataElementType.TEXT);
  8390.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE);            
  8391.                 String urlConnettore = this.getLabelConnettore(sa,is,true);
  8392.                 de.setValue(urlConnettore);
  8393.                 String tooltipConnettore = this.getTooltipConnettore(sa,is,true);
  8394.                 de.setToolTip(tooltipConnettore);
  8395.                 de.setCopyToClipboard(this.getClipBoardUrlConnettore(sa,is));
  8396.                
  8397.                 image = new DataElementImage();
  8398.                
  8399.                 image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CHANGE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb,pConfigurazioneConnettore, pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8400.                 image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE));
  8401.                 image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8402.                
  8403.                 de.addImage(image );
  8404.                
  8405.                 boolean checkConnettore = org.openspcoop2.pdd.core.connettori.ConnettoreCheck.checkSupported(connettore);
  8406.                
  8407.                 if(checkConnettore) {
  8408.                     long idConnettore = connettore.getId();
  8409.                     image = new DataElementImage();
  8410.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_VERIFICA_CONNETTORE, pIdSogg, pIdPorta, pIdAsps,pIdTAb,
  8411.                             new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ID, idConnettore+""),
  8412.                             pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8413.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_VERIFICA_TOOLTIP_CON_PARAMETRO, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE));
  8414.                     image.setImage(CostantiControlStation.ICONA_VERIFICA);
  8415.                    
  8416.                     de.addImage(image);
  8417.                 }
  8418.                
  8419.                 e.add(de);
  8420.                
  8421.                 // Filtri
  8422.                 boolean showFiltri = behaviourConFiltri;
  8423.                 if(showFiltri &&
  8424.                     (TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(behaviourType) && this.isConnettoreDefault(paSA))
  8425.                     ){
  8426.                     showFiltri = false;
  8427.                 }
  8428.                 if(showFiltri) {
  8429.                     de = new DataElement();
  8430.                     de.setType(DataElementType.BUTTON);
  8431.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRI);
  8432.                     List<String> labelsGruppi = new ArrayList<>();
  8433.                     List<String> valuesGruppi = new ArrayList<>();
  8434.                    
  8435.                     if(paSA.getDatiConnettore() != null) {
  8436.                         for (int i = 0; i < paSA.getDatiConnettore().sizeFiltroList(); i++) {
  8437.                             String filtro = paSA.getDatiConnettore().getFiltro(i);
  8438.                             labelsGruppi.add(filtro);
  8439.                             valuesGruppi.add("label-info-default");
  8440.                         }
  8441.                     }  
  8442.                    
  8443.                     de.setLabels(labelsGruppi);
  8444.                     de.setValues(valuesGruppi);
  8445.                    
  8446.                     image = new DataElementImage();
  8447.                    
  8448.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CHANGE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb,pConfigurazioneFiltro,pAccessoDaAPS, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM);
  8449.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRI));
  8450.                     image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8451.                    
  8452.                     de.addImage(image);
  8453.                    
  8454.                     e.add(de);
  8455.                 }
  8456.                
  8457.                 if(behaviourType.equals(TipoBehaviour.CONSEGNA_LOAD_BALANCE) &&
  8458.                         loadBalancerType.isTypeWithWeight()) {
  8459.                     // Proprieta
  8460.                     de = new DataElement();
  8461.                     de.setType(DataElementType.TEXT);
  8462.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE);

  8463.                     String balancerWeight = org.openspcoop2.pdd.core.behaviour.built_in.load_balance.ConfigurazioneLoadBalancer.readLoadBalancerWeight(paSA);
  8464.                     if(StringUtils.isBlank(balancerWeight))
  8465.                         balancerWeight = " ";
  8466.                     de.setValue(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT+": "+balancerWeight);
  8467.                    
  8468.                     image = new DataElementImage();
  8469.                    
  8470.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_PROPRIETA_FORM,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb, pAccessoDaAPS);
  8471.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE));
  8472.                     image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8473.                    
  8474.                     de.addImage(image );
  8475.                    
  8476.                     e.add(de);
  8477.                 }
  8478.                
  8479.                
  8480.                 if(behaviourType.equals(TipoBehaviour.CUSTOM)) {
  8481.                     // Proprieta
  8482.                     de = new DataElement();
  8483.                     de.setType(DataElementType.TEXT);
  8484.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA);
  8485.                     int sizeProprietaList = paSA.getDatiConnettore() != null ? paSA.getDatiConnettore().sizeProprietaList() : 0;
  8486.                     setStatoProprieta(de, sizeProprietaList);
  8487.                    
  8488.                     image = new DataElementImage();
  8489.                    
  8490.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPERTIES_LIST,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb);
  8491.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO,   PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA));
  8492.                     image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8493.                    
  8494.                     de.addImage(image );
  8495.                    
  8496.                     e.add(de);
  8497.                 }
  8498.                
  8499.                 boolean showGestioneNotifiche = false;
  8500.                 if(behaviourType.equals(TipoBehaviour.CONSEGNA_MULTIPLA) || behaviourType.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE)) {
  8501.                     showGestioneNotifiche = true;
  8502.                     if(is!=null && is.getGetMessage()!=null && StatoFunzionalita.ABILITATO.equals(is.getGetMessage())) {
  8503.                         if(connettore!=null && connettore.getTipo()!=null) {
  8504.                             String tipo = connettore.getTipo();
  8505.                             TipiConnettore tipoC = TipiConnettore.toEnumFromName(tipo);
  8506.                             if(TipiConnettore.DISABILITATO.equals(tipoC)) {
  8507.                                 showGestioneNotifiche = false;
  8508.                             }
  8509.                         }
  8510.                         else {
  8511.                             showGestioneNotifiche = false;
  8512.                         }
  8513.                     }
  8514.                 }
  8515.                 // FIX: la gestione sincrona della connessione e' completamente differente e non può essere gestita con le opzioni di consegna delle notifiche. (es. 3xx accettato su rest normalmente)
  8516.                 if(showGestioneNotifiche && behaviourType.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE) && connettoreDefault) {
  8517.                     showGestioneNotifiche = false;
  8518.                 }
  8519.                 if(showGestioneNotifiche) {
  8520.                    
  8521.                     // Proprieta
  8522.                     de = new DataElement();
  8523.                     de.setType(DataElementType.TEXT);
  8524.                     String label = null;
  8525.                     if(behaviourType.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE) && connettoreDefault) {
  8526.                         label = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_GESTIONE_CONSEGNA;
  8527.                     }
  8528.                     else {
  8529.                         label = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_GESTIONE_NOTIFICHE;
  8530.                     }
  8531.                     de.setLabel(label);
  8532.                    
  8533.                     ConfigurazioneGestioneConsegnaNotifiche configurazioneGestioneConsegnaNotifiche = org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.MultiDeliverUtils.read(paSA);
  8534.                    
  8535.                     String consegnaNotificheLabel = "";
  8536.                    
  8537.                     if(configurazioneGestioneConsegnaNotifiche != null)
  8538.                         consegnaNotificheLabel = org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.GestioneConsegnaNotificheUtils.toString(configurazioneGestioneConsegnaNotifiche,
  8539.                                 serviceBinding.equals(ServiceBinding.SOAP));
  8540.                    
  8541.                     if(paSA.getDatiConnettore() != null) {
  8542.                        
  8543.                         if(paSA.getDatiConnettore().isPrioritaMax()) {
  8544.                             String consegnaNotificheLabelPriorita = "Priorità con "+PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_LEFT;
  8545.                             if(StringUtils.isBlank(consegnaNotificheLabel)) {
  8546.                                 consegnaNotificheLabel = consegnaNotificheLabelPriorita;
  8547.                             }
  8548.                             else {
  8549.                                 consegnaNotificheLabel = consegnaNotificheLabelPriorita+". " +consegnaNotificheLabel;
  8550.                             }
  8551.                         }
  8552.                         else if(paSA.getDatiConnettore().getPriorita() != null) {
  8553.                             ConfigurazionePriorita confPriorita = this.porteApplicativeCore.getConsegnaNotificaConfigurazionePriorita(paSA.getDatiConnettore().getPriorita());
  8554.                             if(!confPriorita.isNessunaPriorita()) {
  8555.                                 String consegnaNotificheLabelPriorita = "Priorità "+confPriorita.getLabel();
  8556.                                 if(StringUtils.isBlank(consegnaNotificheLabel)) {
  8557.                                     consegnaNotificheLabel = consegnaNotificheLabelPriorita;
  8558.                                 }
  8559.                                 else {
  8560.                                     consegnaNotificheLabel = consegnaNotificheLabelPriorita+". " +consegnaNotificheLabel;
  8561.                                 }
  8562.                             }
  8563.                         }
  8564.                        
  8565.                         if(paSA.getDatiConnettore().getCoda() != null && !CostantiConfigurazione.CODA_DEFAULT.equals(paSA.getDatiConnettore().getCoda())) {
  8566.                             String consegnaNotificheLabelCoda = "Coda '"+this.porteApplicativeCore.getConsegnaNotificaCodaLabel(paSA.getDatiConnettore().getCoda())+"'";
  8567.                             if(StringUtils.isBlank(consegnaNotificheLabel)) {
  8568.                                 consegnaNotificheLabel = consegnaNotificheLabelCoda;
  8569.                             }
  8570.                             else {
  8571.                                 consegnaNotificheLabel = consegnaNotificheLabelCoda+". " +consegnaNotificheLabel;
  8572.                             }
  8573.                         }
  8574.                     }
  8575.                    
  8576.                     if(StringUtils.isBlank(consegnaNotificheLabel))
  8577.                         consegnaNotificheLabel = " ";
  8578.                    
  8579.                     de.setValue(consegnaNotificheLabel);
  8580.                    
  8581.                     image = new DataElementImage();
  8582.                    
  8583.                     image.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_PROPRIETA_NOTIFICHE,pIdSogg, pNomePorta, pIdPorta, pIdAsps, pNomePaSA, pIdTAb, pAccessoDaAPS);
  8584.                     image.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE_TOOLTIP_CON_PARAMETRO, label));
  8585.                     image.setImage(CostantiControlStation.ICONA_MODIFICA_CONFIGURAZIONE);
  8586.                    
  8587.                     de.addImage(image );
  8588.                    
  8589.                     e.add(de);
  8590.                 }
  8591.                
  8592.                
  8593.                 // Proprieta
  8594.                 org.openspcoop2.core.config.ProprietaOggetto pOggetto = null;
  8595.                 if(paSA.getDatiConnettore() != null && paSA.getDatiConnettore().getProprietaOggetto()!=null) {
  8596.                     pOggetto = paSA.getDatiConnettore().getProprietaOggetto();
  8597.                 }
  8598.                 ProprietaOggetto p = convertToProprietaOggettoRegistro(pOggetto);
  8599.                 if(sa!=null && !ServiziApplicativiCostanti.VALUE_SERVIZI_APPLICATIVI_TIPO_SERVER.equals(sa.getTipo())) {
  8600.                     boolean consideraDataCreazioneComeDataModifica  = true;
  8601.                     p = this.mergeProprietaOggetto(p, sa.getProprietaOggetto(), !consideraDataCreazioneComeDataModifica);
  8602.                    
  8603.                 }
  8604.                 if(p!=null) {
  8605.                     if(p.getUtenteUltimaModifica()==null && p.getDataUltimaModifica()!=null &&
  8606.                             connettoreDefault &&
  8607.                             pa.getProprietaOggetto()!=null) {
  8608.                         p.setUtenteUltimaModifica(pa.getProprietaOggetto().getUtenteUltimaModifica());
  8609.                     }
  8610.                     this.addProprietaOggetto(e, p);
  8611.                 }

  8612.                 dati.add(e);
  8613.                 idTab ++;
  8614.             }
  8615.            
  8616.             this.pd.setDati(dati);
  8617.             this.pd.setSelect(true);
  8618.             this.pd.setAddButton(true);
  8619.             this.pd.setRemoveButton(pa.sizeServizioApplicativoList() > 1);
  8620.            
  8621.         }  catch (Exception e) {
  8622.             this.logError(e.getMessage(), e);
  8623.             throw new ControlStationCoreException(e.getMessage(),e);
  8624.         }
  8625.     }
  8626.    
  8627.     public List<PortaApplicativaServizioApplicativo> applicaFiltriRicercaConnettoriMultipli(ISearch ricerca, int idLista,
  8628.             List<PortaApplicativaServizioApplicativo> lista, IDSoggetto idSoggettoProprietario) throws DriverConfigurazioneException {
  8629.        
  8630.         String filtroConnettoreNome = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_MULTIPLO_NOME);
  8631.         String filtroConnettoreFiltro = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_MULTIPLO_FILTRO);
  8632.         String filtroConnettoreTipo = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TIPO);
  8633.         String filtroConnettoreTipoPlugin = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TIPO_PLUGIN);
  8634.         String filtroConnettoreTokenPolicy = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TOKEN_POLICY);
  8635.         String filtroConnettoreEndpoint = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_ENDPOINT);
  8636.         String filtroConnettoreKeystore = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_KEYSTORE);
  8637.         String filtroConnettoreDebug = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_DEBUG);
  8638.         if((filtroConnettoreTipo!=null && "".equals(filtroConnettoreTipo))) {
  8639.             filtroConnettoreTipo=null;
  8640.         }
  8641.         if((filtroConnettoreTipoPlugin!=null && "".equals(filtroConnettoreTipoPlugin))) {
  8642.             filtroConnettoreTipoPlugin=null;
  8643.         }
  8644.         if((filtroConnettoreTokenPolicy!=null && "".equals(filtroConnettoreTokenPolicy))) {
  8645.             filtroConnettoreTokenPolicy=null;
  8646.         }
  8647.         if((filtroConnettoreEndpoint!=null && "".equals(filtroConnettoreEndpoint))) {
  8648.             filtroConnettoreEndpoint=null;
  8649.         }
  8650.         if((filtroConnettoreKeystore!=null && "".equals(filtroConnettoreKeystore))) {
  8651.             filtroConnettoreKeystore=null;
  8652.         }
  8653.         if((filtroConnettoreDebug!=null && "".equals(filtroConnettoreDebug))) {
  8654.             filtroConnettoreDebug=null;
  8655.         }
  8656.         boolean joinConnettore =  filtroConnettoreTipo!=null    || filtroConnettoreTokenPolicy!=null || filtroConnettoreEndpoint!=null || filtroConnettoreKeystore!=null || filtroConnettoreDebug!=null;
  8657.         TipiConnettore tipoConnettore = null;
  8658.         String endpointType = null;
  8659.         boolean tipoConnettoreIntegrationManager = false;
  8660.         if(filtroConnettoreTipo!=null && !"".equals(filtroConnettoreTipo)) {
  8661.             if(Filtri.FILTRO_CONNETTORE_TIPO_VALORE_IM.equals(filtroConnettoreTipo)) {
  8662.                 tipoConnettoreIntegrationManager = true;
  8663.             }
  8664.             else {
  8665.                 tipoConnettore = TipiConnettore.toEnumFromName(filtroConnettoreTipo);
  8666.                 if(tipoConnettore!=null) {
  8667.                     endpointType = (TipiConnettore.CUSTOM.equals(tipoConnettore)) ? filtroConnettoreTipoPlugin : tipoConnettore.getNome();
  8668.                 }
  8669.             }
  8670.         }
  8671.        
  8672. //      String search = ServletUtils.getSearchFromSession(ricerca, idLista);
  8673.        
  8674.         this.log.debug("filtroConnettoreNome : " + filtroConnettoreNome);
  8675.         this.log.debug("filtroConnettoreFiltro : " + filtroConnettoreFiltro);
  8676.         this.log.debug("filtroConnettoreTipo : " + filtroConnettoreTipo);
  8677.         this.log.debug("filtroConnettoreTokenPolicy : " + filtroConnettoreTokenPolicy);
  8678.         this.log.debug("filtroConnettoreEndpoint : " + filtroConnettoreEndpoint);
  8679.         this.log.debug("filtroConnettoreKeystore : " + filtroConnettoreKeystore);
  8680.         this.log.debug("filtroConnettoreDebug : " + filtroConnettoreDebug);
  8681.         this.log.debug("filtroConnettoreTipoPlugin : " + filtroConnettoreTipoPlugin);
  8682.        
  8683.         List<PortaApplicativaServizioApplicativo> listaFiltrata = new ArrayList<PortaApplicativaServizioApplicativo>();
  8684.        
  8685.         if(StringUtils.isNotBlank(filtroConnettoreNome) || StringUtils.isNotBlank(filtroConnettoreFiltro) || joinConnettore) {
  8686.            
  8687.             List<String> mapSA_ok = null;
  8688.             List<String> mapSA_filtrati = null;
  8689.             if(StringUtils.isNotBlank(filtroConnettoreFiltro) || joinConnettore) {
  8690.                 mapSA_ok = new ArrayList<>();
  8691.                 mapSA_filtrati = new ArrayList<>();
  8692.             }
  8693.            
  8694.             for (PortaApplicativaServizioApplicativo paSA : lista) {
  8695.            
  8696.                 // filtro nome
  8697.                 if(StringUtils.isNotBlank(filtroConnettoreNome)) {
  8698.                     String nome = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  8699.                     if(nome != null) {
  8700.                         if(!nome.toLowerCase().contains(filtroConnettoreNome.toLowerCase())) {
  8701.                             continue;
  8702.                         }
  8703.                     }
  8704.                 }
  8705.                
  8706.                 // filtro
  8707.                 if(StringUtils.isNotBlank(filtroConnettoreFiltro)) {
  8708.                     if(paSA.getDatiConnettore()==null || paSA.getDatiConnettore().sizeFiltroList()<=0) {
  8709.                         if(mapSA_filtrati!=null) {
  8710.                             mapSA_filtrati.add(paSA.getNome());
  8711.                         }
  8712.                         continue;
  8713.                     }
  8714.                     boolean find = false;
  8715.                     for (String filtro : paSA.getDatiConnettore().getFiltroList()) {
  8716.                         if(filtro!=null && filtro.toLowerCase().contains(filtroConnettoreFiltro.toLowerCase())) {
  8717.                             find=true;
  8718.                         }
  8719.                     }
  8720.                     if(!find) {
  8721.                         if(mapSA_filtrati!=null) {
  8722.                             mapSA_filtrati.add(paSA.getNome());
  8723.                         }
  8724.                         continue;
  8725.                     }
  8726.                 }
  8727.                
  8728.                 if(joinConnettore) {
  8729.                
  8730.                     if(mapSA_filtrati!=null && mapSA_filtrati.contains(paSA.getNome())) {
  8731.                         continue;
  8732.                     }
  8733.                     if(!mapSA_ok.contains(paSA.getNome())) {
  8734.                        
  8735.                         IDServizioApplicativo idSA = new IDServizioApplicativo();
  8736.                         idSA.setNome(paSA.getNome());
  8737.                         idSA.setIdSoggettoProprietario(idSoggettoProprietario);
  8738.                         ServizioApplicativo sa = this.saCore.getServizioApplicativo(idSA);
  8739.                         Connettore connettore = null;
  8740.                         if(sa.getInvocazioneServizio()!=null) {
  8741.                             connettore = sa.getInvocazioneServizio().getConnettore();
  8742.                         }
  8743.                        
  8744.                         if(connettore==null) {
  8745.                             if(mapSA_filtrati!=null) {
  8746.                                 mapSA_filtrati.add(paSA.getNome());
  8747.                             }
  8748.                             continue;
  8749.                         }
  8750.                        
  8751.                         if(endpointType!=null) {
  8752.                             if(connettore.getTipo()==null || !connettore.getTipo().equalsIgnoreCase(endpointType)) {
  8753.                                 if(mapSA_filtrati!=null) {
  8754.                                     mapSA_filtrati.add(paSA.getNome());
  8755.                                 }
  8756.                                 continue;
  8757.                             }
  8758.                         }
  8759.                         else if(tipoConnettore!=null) {
  8760.                             if(TipiConnettore.CUSTOM.equals(tipoConnettore)) {
  8761.                                 TipiConnettore[] tipi = TipiConnettore.values();
  8762.                                 boolean find = false;
  8763.                                 for (TipiConnettore tipiConnettore : tipi) {
  8764.                                     if(tipiConnettore.getNome().equalsIgnoreCase(connettore.getTipo())) {
  8765.                                         find=true;
  8766.                                         break;
  8767.                                     }
  8768.                                 }
  8769.                                 if(!find) {
  8770.                                     if(mapSA_filtrati!=null) {
  8771.                                         mapSA_filtrati.add(paSA.getNome());
  8772.                                     }
  8773.                                     continue;
  8774.                                 }
  8775.                             }
  8776.                         }
  8777.                        
  8778.                         if(tipoConnettoreIntegrationManager) {
  8779.                             if(sa.getInvocazioneServizio()==null || sa.getInvocazioneServizio().getGetMessage()==null ||
  8780.                                     !StatoFunzionalita.ABILITATO.equals(sa.getInvocazioneServizio().getGetMessage())) {
  8781.                                 if(mapSA_filtrati!=null) {
  8782.                                     mapSA_filtrati.add(paSA.getNome());
  8783.                                 }
  8784.                                 continue;
  8785.                             }
  8786.                         }
  8787.                        
  8788.                         if(filtroConnettoreTokenPolicy!=null) {
  8789.                             String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_TOKEN_POLICY);
  8790.                             if(!filtroConnettoreTokenPolicy.equalsIgnoreCase(valoreProperty)) {
  8791.                                 if(mapSA_filtrati!=null) {
  8792.                                     mapSA_filtrati.add(paSA.getNome());
  8793.                                 }
  8794.                                 continue;
  8795.                             }
  8796.                         }
  8797.                        
  8798.                         if(filtroConnettoreEndpoint!=null) {
  8799.                             boolean find = false;
  8800.                             if((tipoConnettore==null || TipiConnettore.HTTP.equals(tipoConnettore))) {
  8801.                                 String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_HTTP_LOCATION);
  8802.                                 if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8803.                                     find=true;
  8804.                                 }
  8805.                             }
  8806.                             if(!find) {
  8807.                                 if((tipoConnettore==null || TipiConnettore.HTTPS.equals(tipoConnettore))) {
  8808.                                     String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_HTTPS_LOCATION);
  8809.                                     if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8810.                                         find=true;
  8811.                                     }
  8812.                                 }
  8813.                             }
  8814.                             if(!find) {
  8815.                                 //if((tipoConnettore==null || TipiConnettore.FILE.equals(tipoConnettore))) {
  8816.                                 if(tipoConnettore!=null && TipiConnettore.FILE.equals(tipoConnettore)) {
  8817.                                     String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_FILE_REQUEST_OUTPUT_FILE);
  8818.                                     if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8819.                                         find=true;
  8820.                                     }
  8821.                                     if(!find) {
  8822.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_FILE_REQUEST_OUTPUT_FILE_HEADERS);
  8823.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8824.                                             find=true;
  8825.                                         }
  8826.                                     }
  8827.                                     if(!find) {
  8828.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_FILE_RESPONSE_INPUT_FILE);
  8829.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8830.                                             find=true;
  8831.                                         }
  8832.                                     }
  8833.                                     if(!find) {
  8834.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_FILE_RESPONSE_INPUT_FILE_HEADERS);
  8835.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8836.                                             find=true;
  8837.                                         }
  8838.                                     }
  8839.                                 }
  8840.                             }
  8841.                             if(!find) {
  8842.                                 //if((tipoConnettore==null || TipiConnettore.JMS.equals(tipoConnettore))) {
  8843.                                 if(tipoConnettore!=null && TipiConnettore.JMS.equals(tipoConnettore)) {
  8844.                                     String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_JMS_NOME);
  8845.                                     if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8846.                                         find=true;
  8847.                                     }
  8848.                                     if(!find) {
  8849.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_JMS_CONTEXT_JAVA_NAMING_PROVIDER_URL);
  8850.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8851.                                             find=true;
  8852.                                         }
  8853.                                     }
  8854.                                     if(!find) {
  8855.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_JMS_CONNECTION_FACTORY);
  8856.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8857.                                             find=true;
  8858.                                         }
  8859.                                     }
  8860.                                     if(!find) {
  8861.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_JMS_CONTEXT_JAVA_NAMING_FACTORY_URL_PKG);
  8862.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8863.                                             find=true;
  8864.                                         }
  8865.                                     }
  8866.                                     if(!find) {
  8867.                                         valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_JMS_CONTEXT_JAVA_NAMING_FACTORY_INITIAL);
  8868.                                         if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreEndpoint.toLowerCase())) {
  8869.                                             find=true;
  8870.                                         }
  8871.                                     }
  8872.                                 }
  8873.                             }
  8874.                             if(!find) {
  8875.                                 mapSA_filtrati.add(paSA.getNome());
  8876.                                 continue;
  8877.                             }
  8878.                         }
  8879.                        
  8880.                         if(filtroConnettoreKeystore!=null &&
  8881.                                 (tipoConnettore==null || TipiConnettore.HTTPS.equals(tipoConnettore))
  8882.                                 ) {
  8883.                             boolean find = false;
  8884.                             String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_HTTPS_KEY_STORE_LOCATION);
  8885.                             if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreKeystore.toLowerCase())) {
  8886.                                 find=true;
  8887.                             }
  8888.                             if(!find) {
  8889.                                 valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_HTTPS_TRUST_STORE_LOCATION);
  8890.                                 if(valoreProperty!=null && valoreProperty.toLowerCase().contains(filtroConnettoreKeystore.toLowerCase())) {
  8891.                                     find=true;
  8892.                                 }
  8893.                             }
  8894.                             if(!find) {
  8895.                                 mapSA_filtrati.add(paSA.getNome());
  8896.                                 continue;
  8897.                             }
  8898.                         }
  8899.                        
  8900.                         if(filtroConnettoreDebug!=null) {
  8901.                             String valoreProperty = readValueFromProperties(connettore, CostantiDB.CONNETTORE_DEBUG);
  8902.                             boolean find = false;
  8903.                             if("true".equals(valoreProperty)) {
  8904.                                 if(Filtri.FILTRO_CONNETTORE_DEBUG_VALORE_ABILITATO.equals(filtroConnettoreDebug)) {
  8905.                                     find=true;
  8906.                                 }
  8907.                             }
  8908.                             else {
  8909.                                 if(Filtri.FILTRO_CONNETTORE_DEBUG_VALORE_DISABILITATO.equals(filtroConnettoreDebug)) {
  8910.                                     find=true;
  8911.                                 }
  8912.                             }
  8913.                            
  8914.                             if(!find) {
  8915.                                 mapSA_filtrati.add(paSA.getNome());
  8916.                                 continue;
  8917.                             }
  8918.                         }
  8919.                        
  8920.                     }
  8921.                    
  8922.                     mapSA_ok.add(paSA.getNome());
  8923.                 }
  8924.                                
  8925.                 listaFiltrata.add(paSA);
  8926.             }
  8927.            
  8928.             return listaFiltrata;
  8929.         }
  8930.        
  8931.         return lista;
  8932.     }
  8933.    
  8934.     private String readValueFromProperties(Connettore connettore, String nomeProprieta) {
  8935.         for (int i = 0; i < connettore.sizePropertyList(); i++) {
  8936.             String nomeProperty = connettore.getProperty(i).getNome();
  8937.             if (nomeProperty.equals(nomeProprieta)){
  8938.                 String valoreProperty = connettore.getProperty(i).getValore();
  8939.                 return valoreProperty;
  8940.             }
  8941.         }
  8942.         return null;
  8943.     }
  8944.    
  8945.     private PortaApplicativaServizioApplicativo getFiltroNomeConnettore(String filtroNome, List<PortaApplicativaServizioApplicativo> lista) {
  8946.        
  8947.         for (PortaApplicativaServizioApplicativo paSA : lista) {
  8948.             String nome = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  8949.            
  8950.             if(nome != null) {
  8951.                 if(nome.toLowerCase().equals(filtroNome.toLowerCase()))
  8952.                     return paSA;
  8953.             }
  8954.         }
  8955.        
  8956.         for (PortaApplicativaServizioApplicativo paSA : lista) {
  8957.             String nome = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  8958.            
  8959.             if(nome != null) {
  8960.                 if(nome.toLowerCase().contains(filtroNome.toLowerCase()))
  8961.                     return paSA;
  8962.             }
  8963.         }
  8964.        
  8965.         return null;
  8966.     }
  8967.    
  8968.     public List<DataElement> addConnettoriMultipliToDati(List<DataElement> dati, TipoOperazione tipoOp,
  8969.             TipoBehaviour beaBehaviourType, String nomeSAConnettore,
  8970.             String nome, String descrizione, String stato, boolean behaviourConFiltri, String filtri, String vDatiGenerali, String vDescrizione, String vFiltri, String vConnettore,
  8971.             PortaApplicativaServizioApplicativo paSA) {
  8972.        
  8973.         boolean visualizzaDatiGenerali = ServletUtils.isCheckBoxEnabled(vDatiGenerali);
  8974.         boolean visualizzaDescrizione = ServletUtils.isCheckBoxEnabled(vDescrizione);
  8975.         boolean visualizzaFiltri = ServletUtils.isCheckBoxEnabled(vFiltri);
  8976.        
  8977.         DataElement de = new DataElement();
  8978.        
  8979.         if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && (visualizzaDatiGenerali || visualizzaDescrizione || visualizzaFiltri))) {
  8980.             if(tipoOp.equals(TipoOperazione.ADD)) {
  8981.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DATI_GENERALI);
  8982.             }
  8983.             else {
  8984.                 if(visualizzaDescrizione) {
  8985.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE);
  8986.                 }
  8987.                 else if(visualizzaFiltri) {
  8988.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRI);
  8989.                 }
  8990.                 else {
  8991.                     de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME);
  8992.                 }
  8993.             }
  8994.             de.setType(DataElementType.TITLE);
  8995.             dati.add(de);
  8996.         }
  8997.        
  8998.         de = new DataElement();
  8999.         de.setLabel("");
  9000.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA);
  9001.         de.setType(DataElementType.HIDDEN);
  9002.         de.setValue(nomeSAConnettore);
  9003.         dati.add(de);
  9004.        
  9005.         // Nome
  9006.         de = new DataElement();
  9007.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME);
  9008.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME);
  9009.        
  9010.        
  9011.         if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDatiGenerali)) {
  9012.             de.setType(DataElementType.TEXT_EDIT);
  9013.             de.setValue(nome);
  9014.             de.setRequired(true);
  9015.         } else {
  9016.             de.setType(DataElementType.HIDDEN);
  9017.             de.setValue(nome);
  9018.         }
  9019.         dati.add(de);
  9020.        
  9021.         // Stato
  9022.         de = new DataElement();
  9023.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO);
  9024.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO);
  9025.        
  9026.         if(tipoOp.equals(TipoOperazione.ADD)) {
  9027.             de.setType(DataElementType.SELECT);
  9028.             //String [] values = { StatoFunzionalita.ABILITATO.getValue() , StatoFunzionalita.DISABILITATO.getValue()};
  9029.             String [] values = { StatoFunzionalita.ABILITATO.getValue() ,
  9030.                     PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO_MA_NON_SCHEDULATO,
  9031.                     StatoFunzionalita.DISABILITATO.getValue()};
  9032.             String [] labels = { StatoFunzionalita.ABILITATO.getValue() ,
  9033.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO_ABILITATO_MA_NON_SCHEDULATO,
  9034.                     StatoFunzionalita.DISABILITATO.getValue()};
  9035.             de.setValues(values);
  9036.             de.setLabels(labels);
  9037.             de.setSelected(stato);
  9038.         } else {
  9039.             de.setType(DataElementType.HIDDEN);
  9040.             de.setValue(stato);
  9041.         }
  9042.         dati.add(de);
  9043.        
  9044.         // Descrizione
  9045.         de = new DataElement();
  9046.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE);
  9047.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE);
  9048.        
  9049.            
  9050.         if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDescrizione)) {
  9051.             de.setType(DataElementType.TEXT_AREA);
  9052.             if((tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDescrizione)) {
  9053.                 de.setRows(CostantiControlStation.TEXT_AREA_DESCRIZIONE_ROWS);
  9054.                 de.setLabel(CostantiControlStation.LABEL_PROPRIETA_DESCRIZIONE_EMPTY);
  9055.             }
  9056.             de.setValue(descrizione);
  9057.         } else {
  9058.             de.setType(DataElementType.HIDDEN);
  9059.             de.setValue(descrizione);
  9060.         }
  9061.         dati.add(de);
  9062.        
  9063.         // filtri
  9064.         de = new DataElement();
  9065.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRI);
  9066.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_FILTRI);
  9067.         boolean showFiltri = behaviourConFiltri;
  9068.         if(showFiltri) {
  9069.             if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(beaBehaviourType) && paSA!=null && this.isConnettoreDefault(paSA)) {
  9070.                 showFiltri = false;
  9071.             }
  9072.         }
  9073.         if(showFiltri) {
  9074.             if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaFiltri)) {
  9075.                 de.setType(DataElementType.TEXT_EDIT);
  9076.                 de.enableTags();
  9077.                 de.setValue(filtri);
  9078.             } else {
  9079.                 de.setType(DataElementType.HIDDEN);
  9080.                 de.setValue(filtri);
  9081.             }
  9082.         } else {
  9083.             de.setType(DataElementType.HIDDEN);
  9084.             de.setValue(filtri);
  9085.         }
  9086.         dati.add(de);
  9087.        
  9088.         dati = this.addInformazioniGruppiAsHiddenToDati(tipoOp, dati, vDatiGenerali, vDescrizione, vConnettore, vFiltri);
  9089.        
  9090.         return dati;
  9091.     }
  9092.    
  9093.     public List<DataElement> addInformazioniGruppiAsHiddenToDati(TipoOperazione tipoOp, List<DataElement> dati,
  9094.             String visualizzaDatiGenerali, String visualizzaDescrizione, String visualizzaConnettore, String visualizzaFiltri) {
  9095.        
  9096. //      Parameter pConfigurazioneDatiGenerali = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DATI_GENERALI, visualizzaDatiGenerali);
  9097. //      Parameter pConfigurazioneDescrizione = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DESCRIZIONE, visualizzaDescrizione);
  9098. //      Parameter pConfigurazioneFiltro = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_FILTRO, visualizzaFiltri);
  9099. //      Parameter pConfigurazioneConnettore = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONNETTORE, visualizzaConnettore);
  9100.        
  9101.         if(visualizzaDatiGenerali != null) {
  9102.             DataElement de = new DataElement();
  9103.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DATI_GENERALI);
  9104.             de.setType(DataElementType.HIDDEN);
  9105.             de.setValue(visualizzaDatiGenerali);
  9106.             dati.add(de);
  9107.         }
  9108.        
  9109.         if(visualizzaDescrizione != null) {
  9110.             DataElement de = new DataElement();
  9111.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_DESCRIZIONE);
  9112.             de.setType(DataElementType.HIDDEN);
  9113.             de.setValue(visualizzaDescrizione);
  9114.             dati.add(de);
  9115.         }
  9116.        
  9117.         if(visualizzaFiltri != null) {
  9118.             DataElement de = new DataElement();
  9119.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_FILTRO);
  9120.             de.setType(DataElementType.HIDDEN);
  9121.             de.setValue(visualizzaFiltri);
  9122.             dati.add(de);
  9123.         }
  9124.        
  9125.         if(visualizzaConnettore != null) {
  9126.             DataElement de = new DataElement();
  9127.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONNETTORE);
  9128.             de.setType(DataElementType.HIDDEN);
  9129.             de.setValue(visualizzaConnettore);
  9130.             dati.add(de);
  9131.         }
  9132.        
  9133.         return dati;
  9134.     }
  9135.    
  9136.     public List<DataElement> addConnettoriMultipliLoadBalanceToDati(List<DataElement> dati, TipoOperazione tipoOp,
  9137.             TipoBehaviour beaBehaviourType, String nomeSAConnettore, String peso) {
  9138.        
  9139.         DataElement de = new DataElement();
  9140.        
  9141.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE);
  9142.         de.setType(DataElementType.TITLE);
  9143.         dati.add(de);
  9144.        
  9145.         de = new DataElement();
  9146.         de.setLabel("");
  9147.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA);
  9148.         de.setType(DataElementType.HIDDEN);
  9149.         de.setValue(nomeSAConnettore);
  9150.         dati.add(de);
  9151.        
  9152.         // Nome
  9153.         de = new DataElement();
  9154.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT);
  9155.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT);
  9156.        
  9157.         de.setType(DataElementType.NUMBER);
  9158.         de.setValue(peso);
  9159.         de.setRequired(true);
  9160.         de.setMinValue(1);
  9161.         dati.add(de);
  9162.        
  9163.         return dati;
  9164.     }
  9165.    
  9166.     public boolean connettoriMultipliCheckData(TipoOperazione tipoOp, PortaApplicativa pa , TipoBehaviour beaBehaviourType, String nomeSAConnettore,
  9167.             String oldNome, String nome, String descrizione, String stato, String filtri, String vDatiGenerali, String vDescrizione, String vFiltri, String vConnettore,
  9168.             String getmsg, String getmsgUsername, String getmsgPassword, ServizioApplicativo oldSA) throws Exception{
  9169.         try{
  9170.             boolean visualizzaDatiGenerali = ServletUtils.isCheckBoxEnabled(vDatiGenerali);
  9171.             if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDatiGenerali)) {
  9172.                
  9173.                 if(StringUtils.isEmpty(nome)) {
  9174.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  9175.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME));
  9176.                     return false;
  9177.                 }
  9178.                
  9179.                 // Controllo che non ci siano spazi nei campi di testo
  9180.                 if ((nome.indexOf(" ") != -1)) {
  9181.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEI_CAMPI_DI_TESTO);
  9182.                     return false;
  9183.                 }
  9184.                
  9185.                 // Check Lunghezza
  9186.                 if(this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME)==false) {
  9187.                     return false;
  9188.                 }
  9189.                
  9190.                 if(StringUtils.isEmpty(stato)) {
  9191.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  9192.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STATO));
  9193.                     return false;
  9194.                 }
  9195.             }
  9196.            
  9197.             boolean visualizzaDescrizione = ServletUtils.isCheckBoxEnabled(vDescrizione);
  9198.            
  9199.             if( (tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDescrizione))
  9200.                     &&
  9201.                 (StringUtils.isNotEmpty(descrizione))
  9202.                     &&
  9203.                 (!this.checkLength4000(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DESCRIZIONE))
  9204.                 ){
  9205.                 return false;
  9206.             }
  9207.            
  9208.             // check univocita' del nome
  9209.             if(tipoOp.equals(TipoOperazione.ADD) || (tipoOp.equals(TipoOperazione.CHANGE) && visualizzaDatiGenerali)) {
  9210.                
  9211.                 List<PortaApplicativaServizioApplicativo> servizioApplicativoList = pa.getServizioApplicativoList();
  9212.                
  9213.                 if(tipoOp.equals(TipoOperazione.ADD)) {
  9214.                     for (PortaApplicativaServizioApplicativo paSA : servizioApplicativoList) {
  9215.                         String nomePaSA = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9216.                         if(nome.equals(nomePaSA)) {
  9217.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_NOME_GIA_UTILIZZATO,
  9218.                                     nome));
  9219.                             return false;
  9220.                         }
  9221.                     }
  9222.                 }
  9223.                
  9224.                 // solo se ho cambiato il nome
  9225.                 if(tipoOp.equals(TipoOperazione.CHANGE) && !nome.equals(oldNome)) {
  9226.                     for (PortaApplicativaServizioApplicativo paSA : servizioApplicativoList) {
  9227.                         String nomePaSA = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9228.                         if(nome.equals(nomePaSA)) {
  9229.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_NOME_GIA_UTILIZZATO,
  9230.                                     nome));
  9231.                             return false;
  9232.                         }
  9233.                     }
  9234.                    
  9235.                     // check utilizzo del nome nel connettore nei criteri di applicabilita delle trasformazioni
  9236.                     // NON serve: nei criteri di applicabilità ci finisce il nome del servizio applicativo
  9237.                     /*if(pa.getTrasformazioni()!=null && pa.getTrasformazioni().sizeRegolaList()>0){
  9238.                        
  9239.                         String check = null;
  9240.                         for (PortaApplicativaServizioApplicativo paSA : servizioApplicativoList) {
  9241.                             String nomePaSA = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9242.                             if(oldNome.equals(nomePaSA)) {
  9243.                                 check = paSA.getNome();
  9244.                                 break;
  9245.                             }
  9246.                         }
  9247.                        
  9248.                         for (TrasformazioneRegola tr : pa.getTrasformazioni().getRegolaList()) {
  9249.                             if(tr.getApplicabilita()!=null && tr.getApplicabilita().sizeConnettoreList()>0 && tr.getApplicabilita().getConnettoreList()!=null){
  9250.                                 if(tr.getApplicabilita().getConnettoreList().contains(check)) {
  9251.                                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_NOME_UTILIZZATO_CRITERI_APPLICABILITA_TRASFORMAZIONI,
  9252.                                             oldNome, tr.getNome()));
  9253.                                     return false;
  9254.                                 }
  9255.                             }
  9256.                         }
  9257.                     }*/
  9258.                 }
  9259.             }
  9260.            
  9261.             // check univocita' applicativo server
  9262.            
  9263.             if(tipoOp.equals(TipoOperazione.ADD)) {
  9264.                 String erogazioneServizioApplicativoServerEnabledS = this.getParameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ABILITA_USO_APPLICATIVO_SERVER);
  9265.                 boolean erogazioneServizioApplicativoServerEnabled = ServletUtils.isCheckBoxEnabled(erogazioneServizioApplicativoServerEnabledS);
  9266.                 String erogazioneServizioApplicativoServer = this.getParameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID_APPLICATIVO_SERVER);
  9267.                 if(erogazioneServizioApplicativoServerEnabled) {
  9268.                     for (PortaApplicativaServizioApplicativo paSA : pa.getServizioApplicativoList()) {
  9269.                         if(paSA.getNome().equals(erogazioneServizioApplicativoServer)) {
  9270.                             String nomeConfigurazione = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9271.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_APPLICATIVO_SERVER_GIA_UTILIZZATO,
  9272.                                     erogazioneServizioApplicativoServer,nomeConfigurazione));
  9273.                             return false;
  9274.                         }
  9275.                     }
  9276.                 }
  9277.             }
  9278.            
  9279.             if(tipoOp.equals(TipoOperazione.CHANGE)) {
  9280.                 String erogazioneServizioApplicativoServerEnabledS = this.getParameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ABILITA_USO_APPLICATIVO_SERVER);
  9281.                 boolean erogazioneServizioApplicativoServerEnabled = ServletUtils.isCheckBoxEnabled(erogazioneServizioApplicativoServerEnabledS);
  9282.                 String erogazioneServizioApplicativoServer = this.getParameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID_APPLICATIVO_SERVER);
  9283.                 if(erogazioneServizioApplicativoServerEnabled) {
  9284.                     for (PortaApplicativaServizioApplicativo paSA : pa.getServizioApplicativoList()) {
  9285.                         // usato da un altro PASA che non sia quello in corso di modifica
  9286.                         if(!paSA.getNome().equals(nomeSAConnettore) &&   paSA.getNome().equals(erogazioneServizioApplicativoServer) ) {
  9287.                             String nomeConfigurazione = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9288.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_APPLICATIVO_SERVER_GIA_UTILIZZATO,
  9289.                                     erogazioneServizioApplicativoServer,nomeConfigurazione));
  9290.                             return false;
  9291.                         }
  9292.                     }
  9293.                 }
  9294.             }
  9295.                        
  9296.             // check univocita' filtro
  9297.             if(TipoBehaviour.CONSEGNA_CONDIZIONALE.equals(beaBehaviourType) &&
  9298.                     !this.porteApplicativeCore.isConnettoriMultipliConsegnaCondizionaleStessFiltroPermesso()) {
  9299.                
  9300.                 if(StringUtils.isNotEmpty(filtri)) {
  9301.                     List<String> filtriV = Arrays.asList(filtri.split(","));
  9302.                    
  9303.                     for (String filtro : filtriV) {
  9304.                        
  9305.                         if(tipoOp.equals(TipoOperazione.ADD)) {
  9306.                             for (PortaApplicativaServizioApplicativo paSA : pa.getServizioApplicativoList()) {
  9307.                                 if(paSA.getDatiConnettore()!=null && paSA.getDatiConnettore().sizeFiltroList()>0) {
  9308.                                     for (String filtroCheck : paSA.getDatiConnettore().getFiltroList()) {
  9309.                                         if(filtroCheck.equals(filtro)) {
  9310.                                             String nomeConfigurazione = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9311.                                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_FILTRO_GIA_UTILIZZATO,
  9312.                                                     filtro,nomeConfigurazione));
  9313.                                             return false;
  9314.                                         }          
  9315.                                     }
  9316.                                 }
  9317.                             }
  9318.                         }
  9319.                        
  9320.                         if(tipoOp.equals(TipoOperazione.CHANGE)) {
  9321.                             for (PortaApplicativaServizioApplicativo paSA : pa.getServizioApplicativoList()) {
  9322.                                 if(paSA.getDatiConnettore()!=null && paSA.getDatiConnettore().sizeFiltroList()>0) {
  9323.                                     for (String filtroCheck : paSA.getDatiConnettore().getFiltroList()) {
  9324.                                         // usato da un altro PASA che non sia quello in corso di modifica
  9325.                                         if(!paSA.getNome().equals(nomeSAConnettore) && filtroCheck.equals(filtro) ) {
  9326.                                             String nomeConfigurazione = getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9327.                                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CONNETTORI_MULTIPLI_FILTRO_GIA_UTILIZZATO,
  9328.                                                     filtro,nomeConfigurazione));
  9329.                                             return false;
  9330.                                         }
  9331.                                     }
  9332.                                 }
  9333.                             }
  9334.                         }
  9335.                        
  9336.                     }
  9337.                 }
  9338.                    
  9339.             }
  9340.            
  9341.             // Controllo che i campi DataElementType.SELECT abbiano uno dei valori ammessi
  9342.             if (!CostantiConfigurazione.ABILITATO.toString().equals(getmsg) && !CostantiConfigurazione.DISABILITATO.toString().equals(getmsg)) {
  9343.                 this.pd.setMessage("Servizio '"+ServiziApplicativiCostanti.LABEL_SERVIZIO_MESSAGE_BOX+"' dev'essere "+CostantiConfigurazione.ABILITATO+" o "+CostantiConfigurazione.DISABILITATO);
  9344.                 return false;
  9345.             }
  9346.             if (getmsg!=null && getmsg.equals(CostantiConfigurazione.ABILITATO.toString()) ){
  9347.                
  9348.                 boolean add = tipoOp.equals(TipoOperazione.ADD);
  9349.                 boolean encryptEnabled = this.saCore.isApplicativiPasswordEncryptEnabled();
  9350.                
  9351.                 boolean validaPassword = false;
  9352.                 if(add || !encryptEnabled) {
  9353.                     validaPassword = true;
  9354.                 }
  9355.                 else {
  9356.                     boolean oldAbilitato = oldSA!=null && oldSA.getInvocazioneServizio()!=null && StatoFunzionalita.ABILITATO.equals(oldSA.getInvocazioneServizio().getGetMessage());
  9357.                     if(oldAbilitato) {
  9358.                         String changePwd = this.getParameter(ConnettoriCostanti.PARAMETRO_CREDENZIALI_AUTENTICAZIONE_CHANGE_PASSWORD);
  9359.                         if(ServletUtils.isCheckBoxEnabled(changePwd)) {
  9360.                             validaPassword = true;
  9361.                         }
  9362.                     }
  9363.                     else {
  9364.                         validaPassword = true;
  9365.                     }
  9366.                 }
  9367.                
  9368.                 boolean passwordEmpty = false;
  9369.                 if(validaPassword) {
  9370.                     if(getmsgPassword==null || getmsgPassword.equals("")) {
  9371.                         passwordEmpty = true;
  9372.                     }
  9373.                 }
  9374.                
  9375.                 if(getmsgUsername==null || "".equals(getmsgUsername)) {
  9376.                     this.pd.setMessage("Dati incompleti. &Egrave; necessario indicare 'Username' per il servizio '"+ServiziApplicativiCostanti.LABEL_SERVIZIO_MESSAGE_BOX+"'");
  9377.                     return false;
  9378.                 }
  9379.                 if(passwordEmpty) {
  9380.                     this.pd.setMessage("Dati incompleti. &Egrave; necessario indicare 'Password' per il servizio '"+ServiziApplicativiCostanti.LABEL_SERVIZIO_MESSAGE_BOX+"'");
  9381.                     return false;
  9382.                 }
  9383.                 if (((getmsgUsername.indexOf(" ") != -1) || (validaPassword && getmsgPassword.indexOf(" ") != -1))) {
  9384.                     this.pd.setMessage("Non inserire spazi nei campi di testo");
  9385.                     return false;
  9386.                 }
  9387.                
  9388.                 if(validaPassword) {
  9389.                     PasswordVerifier passwordVerifier = this.saCore.getApplicativiPasswordVerifier();
  9390.                     if(passwordVerifier!=null){
  9391.                         StringBuilder motivazioneErrore = new StringBuilder();
  9392.                         if(passwordVerifier.validate(getmsgUsername, getmsgPassword, motivazioneErrore)==false){
  9393.                             this.pd.setMessage(motivazioneErrore.toString());
  9394.                             return false;
  9395.                         }
  9396.                     }
  9397.                 }
  9398.                
  9399.                 // recupera lista servizi applicativi con stesse credenziali
  9400.                 boolean checkPassword = this.saCore.isApplicativiCredenzialiBasicCheckUniqueUsePassword(); // la password non viene utilizzata per riconoscere se l'username e' già utilizzato.
  9401.                 List<ServizioApplicativo> saList = this.saCore.servizioApplicativoWithCredenzialiBasicList(getmsgUsername, getmsgPassword, checkPassword);

  9402.                 for (int i = 0; i < saList.size(); i++) {
  9403.                     ServizioApplicativo sa = saList.get(i);

  9404.                     if(oldSA!=null && oldSA.getId().longValue() == sa.getId().longValue()) {
  9405.                         continue;
  9406.                     }

  9407.                     // Messaggio di errore
  9408.                     IDSoggetto idSoggettoProprietario = new IDSoggetto(sa.getTipoSoggettoProprietario(), sa.getNomeSoggettoProprietario());
  9409.                     String labelSoggetto = this.getLabelNomeSoggetto(idSoggettoProprietario);
  9410.                     if(sa.getTipo()!=null && StringUtils.isNotEmpty(sa.getTipo())) {
  9411.                         this.pd.setMessage("L'applicativo "+sa.getNome()+" (soggetto: "+labelSoggetto+") possiede già l'utente (http-basic) indicato");
  9412.                     }
  9413.                     else {
  9414.                         IDServizioApplicativo idSA = new IDServizioApplicativo();
  9415.                         idSA.setIdSoggettoProprietario(idSoggettoProprietario);
  9416.                         idSA.setNome(sa.getNome());
  9417.                         List<IDPortaApplicativa> list = this.porteApplicativeCore.porteApplicativeWithApplicativoErogatore(idSA);
  9418.                         String labelErogazione = sa.getNome();
  9419.                         if(list!=null && !list.isEmpty()) {
  9420.                             try {
  9421.                                 PortaApplicativa paFound = this.porteApplicativeCore.getPortaApplicativa(list.get(0));
  9422.                                 MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(paFound);
  9423.                                 labelErogazione = this.getLabelIdServizio(mappingPA.getIdServizio());
  9424.                                 if(!mappingPA.isDefault()) {
  9425.                                     labelErogazione = labelErogazione+" (gruppo:"+mappingPA.getDescrizione()+")";
  9426.                                 }
  9427.                             }catch(Throwable t) {
  9428.                                 this.logError("Errore durante l'identificazione dell'erogazione: "+t.getMessage(),t);
  9429.                             }
  9430.                         }
  9431.                         this.pd.setMessage("L'erogazione "+labelErogazione+" possiede già l'utente (http-basic) indicato per il servizio '"+ServiziApplicativiCostanti.LABEL_SERVIZIO_MESSAGE_BOX+"'");
  9432.                     }
  9433.                     return false;
  9434.                 }
  9435.             }
  9436.            
  9437.            
  9438.         } catch (Exception e) {
  9439.             this.logError(e.getMessage(), e);
  9440.             throw new ControlStationCoreException(e.getMessage(),e);
  9441.         }
  9442.         return true;
  9443.     }
  9444.    
  9445.     public boolean connettoriMultipliLoadBalanceCheckData(TipoOperazione tipoOp, PortaApplicativa pa , TipoBehaviour beaBehaviourType, String nomeSAConnettore, String peso) throws Exception{
  9446.         try{
  9447.            
  9448.             if(StringUtils.isEmpty(peso)) {
  9449.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  9450.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT));
  9451.                 return false;
  9452.             }
  9453.            
  9454.             int w = -1;
  9455.             try {
  9456.                 w = Integer.parseInt(peso);
  9457.             }catch (Exception e) {
  9458.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  9459.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT));
  9460.                 return false;
  9461.             }
  9462.            
  9463.             if(w < 1) {
  9464.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_MIN_XX_NON_VALIDO,
  9465.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LOAD_BALANCE_WEIGHT, 1));
  9466.                 return false;
  9467.             }
  9468.            
  9469.         } catch (Exception e) {
  9470.             this.logError(e.getMessage(), e);
  9471.             throw new ControlStationCoreException(e.getMessage(),e);
  9472.         }
  9473.         return true;
  9474.     }  
  9475.    
  9476.     public String getLabelNomePortaApplicativaServizioApplicativo(String functionDi, String function, PortaApplicativaServizioApplicativo paSA) {
  9477.         boolean showGroup = true;
  9478.             String prefix = "";
  9479.             if(functionDi!=null) {
  9480.                 prefix = functionDi;
  9481.                 if(showGroup) {
  9482.                     prefix = this.core.convertPrefixConfigDelConnettore(prefix);
  9483.                 }
  9484.             }
  9485.                    
  9486.         return prefix+this.core.getLabelGroup(this.getLabelNomePortaApplicativaServizioApplicativo(paSA));
  9487.     }
  9488.    
  9489.     public String getMessaggioConfermaModificaRegolaStatoConnettoreMultiplo(boolean fromAPI, PortaApplicativaServizioApplicativo paSA, boolean abilitazione,
  9490.             boolean multiline,boolean listElement,
  9491.             boolean scheduling) throws DriverConfigurazioneException {
  9492.         boolean connettoreDefault = this.isConnettoreDefault(paSA);
  9493.         String nomeConnettore = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  9494.         return this.getMessaggioConfermaModificaStatoConnettore(fromAPI, connettoreDefault, nomeConnettore, abilitazione, multiline, listElement, scheduling);
  9495.     }
  9496.    
  9497.    
  9498.     public String getMessaggioConfermaModificaStatoConnettore(boolean fromAPI, boolean isDefault, String connettore,
  9499.             boolean abilitazione, boolean multiline,boolean listElement,
  9500.             boolean scheduling) throws DriverConfigurazioneException {
  9501.         String pre = Costanti.HTML_MODAL_SPAN_PREFIX;
  9502.         String post = Costanti.HTML_MODAL_SPAN_SUFFIX;
  9503.        
  9504.         if(scheduling) {
  9505.             return pre + ( abilitazione ? MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_CONFERMA_ABILITAZIONE_SCHEDULING_CONNETTORE,connettore) :
  9506.                 MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_CONFERMA_DISABILITAZIONE_SCHEDULING_CONNETTORE,connettore) )  + post;
  9507.         }
  9508.         else {
  9509.             return pre + ( abilitazione ? MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_CONFERMA_ABILITAZIONE_CONNETTORE,connettore) :
  9510.                 MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_CONFERMA_DISABILITAZIONE_CONNETTORE,connettore) )  + post;
  9511.         }
  9512.     }
  9513.    
  9514.    
  9515.     public void preparePorteApplicativeConnettoriMultipliConfigPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista) throws Exception {
  9516.         try {
  9517.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  9518.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  9519.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  9520.             if(idAsps == null)
  9521.                 idAsps = "";

  9522.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  9523.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  9524.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id);
  9525.             Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, nomePorta);
  9526.             Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  9527.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  9528.            
  9529.             String idTabP = this.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  9530.             Parameter pIdTab = new Parameter(CostantiControlStation.PARAMETRO_ID_TAB, idTabP != null ? idTabP : "");
  9531.            
  9532.             String accessoDaAPSParametro = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS);
  9533.             Parameter pAccessoDaAPS = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS, accessoDaAPSParametro != null ? accessoDaAPSParametro : "");
  9534.             String connettoreAccessoGruppi = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  9535.             Parameter pConnettoreAccessoDaGruppi = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI, connettoreAccessoGruppi);
  9536.             String connettoreRegistro = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  9537.             Parameter pConnettoreRegistro = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO, connettoreRegistro);
  9538.             String connettoreAccessoCM = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI);
  9539.             Parameter pConnettoreAccessoCM = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI, connettoreAccessoCM);
  9540.            
  9541.            
  9542.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_PROPERTIES,
  9543.                     pIdPorta, pIdSogg, pIdAsps, pNomePorta, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pAccessoDaAPS, pIdTab, pConnettoreAccessoCM);
  9544.            

  9545.             int idLista = Liste.PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_PROPRIETA;
  9546.             int limit = ricerca.getPageSize(idLista);
  9547.             int offset = ricerca.getIndexIniziale(idLista);
  9548.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  9549.             this.pd.setIndex(offset);
  9550.             this.pd.setPageSize(limit);
  9551.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  9552.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  9553.             String idporta = pa.getNome();
  9554.            
  9555.             long idAspsLong = Long.parseLong(idAsps);
  9556.             AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(idAspsLong);

  9557.             boolean accessoDaListaAPS = false;
  9558.             if(Costanti.CHECK_BOX_ENABLED_TRUE.equals(accessoDaAPSParametro)) {
  9559.                 accessoDaListaAPS = true;
  9560.             }
  9561.            
  9562.             boolean isModalitaCompleta = this.isModalitaCompleta();
  9563.             Boolean vistaErogazioni = ServletUtils.getBooleanAttributeFromSession(ErogazioniCostanti.ASPS_EROGAZIONI_ATTRIBUTO_VISTA_EROGAZIONI, this.session, this.request).getValue();
  9564.             // setto la barra del titolo
  9565.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  9566.            
  9567.             String labelPerPorta = null;
  9568.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  9569.                 if(accessoDaListaAPS) {
  9570.                     if(!isModalitaCompleta) {
  9571.                         if(vistaErogazioni != null && vistaErogazioni.booleanValue()) {
  9572.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  9573.                         } else {
  9574.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI+
  9575.                                     this.getLabelIdServizio(asps);
  9576.                         }
  9577.                     }
  9578.                     else {
  9579.                         labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  9580.                     }
  9581.                 }
  9582.                 else {
  9583.                     labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  9584.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI,
  9585.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG,
  9586.                             pa);
  9587.                 }
  9588.             }
  9589.             else {
  9590.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI+idporta;
  9591.             }
  9592.            
  9593.             if(accessoDaListaAPS) {
  9594.                 lstParam.remove(lstParam.size()-1);
  9595.             }
  9596.            
  9597.             lstParam.add(new Parameter(labelPerPorta,PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONFIGURAZIONE_CONNETTORI_MULTIPLI, pIdSogg, pIdPorta, pIdAsps,
  9598.                     pConnettoreAccessoDaGruppi, pConnettoreRegistro, pConnettoreAccessoCM));
  9599.            
  9600.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_PROPRIETA;
  9601.            
  9602.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  9603.             if(search.equals("")){
  9604.                 this.pd.setSearchDescription("");
  9605.                 lstParam.add(new Parameter(labelPagLista,null));
  9606.             }
  9607.             else{
  9608.                 List<Parameter> listaParametriServletProprietaCustom = new ArrayList<>();
  9609.                 listaParametriServletProprietaCustom.add(pIdSogg);
  9610.                 listaParametriServletProprietaCustom.add(pIdPorta);
  9611.                 listaParametriServletProprietaCustom.add(pNomePorta);
  9612.                 listaParametriServletProprietaCustom.add(pIdAsps);
  9613.                 listaParametriServletProprietaCustom.add(pIdTab);
  9614.                 listaParametriServletProprietaCustom.add(pAccessoDaAPS);
  9615.                 listaParametriServletProprietaCustom.add(pConnettoreAccessoDaGruppi);
  9616.                 listaParametriServletProprietaCustom.add(pConnettoreRegistro);
  9617.                 listaParametriServletProprietaCustom.add(pConnettoreAccessoCM);
  9618.                 lstParam.add(new Parameter(labelPagLista, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_PROPERTIES_LIST,   listaParametriServletProprietaCustom.toArray(new Parameter[listaParametriServletProprietaCustom.size()])));
  9619.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  9620.             }

  9621.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  9622.            
  9623.             // imposta menu' contestuale
  9624.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  9625.             // controllo eventuali risultati ricerca
  9626.             if (!search.equals("")) {
  9627.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_PROPRIETA, search);
  9628.             }

  9629.             // setto le label delle colonne
  9630.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_NOME , CostantiControlStation.LABEL_PARAMETRO_VALORE };
  9631.             this.pd.setLabels(labels);

  9632.             // preparo i dati
  9633.             List<List<DataElement>> dati = new ArrayList<>();

  9634.             if (lista != null) {
  9635.                 Iterator<Proprieta> it = lista.iterator();
  9636.                 while (it.hasNext()) {
  9637.                     Proprieta proprieta = it.next();
  9638.        
  9639.                     List<DataElement> e = new ArrayList<>();
  9640.        
  9641.                     DataElement de = new DataElement();
  9642.                     de.setValue(proprieta.getNome());
  9643.                     de.setIdToRemove(proprieta.getId() + "");
  9644.                     e.add(de);
  9645.                    
  9646.                     de = new DataElement();
  9647.                     de.setValue(proprieta.getValore());
  9648.                     e.add(de);
  9649.        
  9650.                     dati.add(e);
  9651.                 }
  9652.             }

  9653.             this.pd.setDati(dati);
  9654.             this.pd.setAddButton(true);

  9655.         } catch (Exception e) {
  9656.             this.logError(e.getMessage(), e);
  9657.             throw new ControlStationCoreException(e.getMessage(),e);
  9658.         }
  9659.     }
  9660.    
  9661.     public boolean proprietaConnettoriMultipliConfigCheckData(TipoOperazione tipoOp, String idPorta, String nome,String valore) throws Exception {
  9662.         try {
  9663.             // Campi obbligatori
  9664.             if (nome.equals("") || valore.equals("")) {
  9665.                 String tmpElenco = "";
  9666.                 if (nome.equals("")) {
  9667.                     tmpElenco = "Nome";
  9668.                 }
  9669.                 if (valore.equals("")) {
  9670.                     if (tmpElenco.equals("")) {
  9671.                         tmpElenco = "Valore";
  9672.                     } else {
  9673.                         tmpElenco = tmpElenco + ", Valore";
  9674.                     }
  9675.                 }
  9676.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  9677.                 return false;
  9678.             }
  9679.            
  9680.             // Check Lunghezza
  9681.             if(this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)==false) {
  9682.                 return false;
  9683.             }
  9684.             if(this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE)==false) {
  9685.                 return false;
  9686.             }
  9687.            
  9688.             // Se tipoOp = add, controllo che la property non sia gia'
  9689.             // stata
  9690.             // registrata per la porta applicativa
  9691.             if (tipoOp.equals(TipoOperazione.ADD)) {
  9692.                 boolean giaRegistrato = false;
  9693.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));

  9694.                 PortaApplicativaBehaviour behaviour = pa.getBehaviour();
  9695.                 for (int i = 0; i < behaviour.sizeProprietaList(); i++) {
  9696.                     Proprieta tmpProp = behaviour.getProprieta(i);
  9697.                     if (nome.equals(tmpProp.getNome())) {
  9698.                         giaRegistrato = true;
  9699.                         break;
  9700.                     }
  9701.                 }

  9702.                 if (giaRegistrato) {
  9703.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_ALLA_CONFIGURAZIONE, nome));
  9704.                     return false;
  9705.                 }
  9706.             }

  9707.             return true;
  9708.         } catch (Exception e) {
  9709.             this.logError(e.getMessage(), e);
  9710.             throw new ControlStationCoreException(e.getMessage(),e);
  9711.         }
  9712.     }
  9713.    
  9714.     public void preparePorteApplicativeConnettoriMultipliPropList(String nomePorta, ISearch ricerca, List<Proprieta> lista) throws Exception {
  9715.         try {
  9716.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  9717.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  9718.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  9719.             if(idAsps == null)
  9720.                 idAsps = "";

  9721.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  9722.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);
  9723.             String nomeSAConnettore = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA);

  9724.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id);
  9725.             Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, nomePorta);
  9726.             Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  9727.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  9728.             Parameter pNomePASA = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA, nomeSAConnettore);
  9729.            
  9730.             String idTabP = this.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  9731.             Parameter pIdTab = new Parameter(CostantiControlStation.PARAMETRO_ID_TAB, idTabP != null ? idTabP : "");
  9732.            
  9733.             String accessoDaAPSParametro = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS);
  9734.             Parameter pAccessoDaAPS = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS, accessoDaAPSParametro != null ? accessoDaAPSParametro : "");
  9735.             String connettoreAccessoGruppi = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  9736.             Parameter pConnettoreAccessoDaGruppi = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI, connettoreAccessoGruppi);
  9737.             String connettoreRegistro = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  9738.             Parameter pConnettoreRegistro = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO, connettoreRegistro);
  9739.             String connettoreAccessoCM = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI);
  9740.             Parameter pConnettoreAccessoCM = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI, connettoreAccessoCM);
  9741.            
  9742.            
  9743.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPERTIES,
  9744.                     pIdPorta, pIdSogg, pIdAsps, pNomePorta, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pAccessoDaAPS, pIdTab, pConnettoreAccessoCM, pNomePASA);
  9745.            

  9746.             int idLista = Liste.PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA;
  9747.             int limit = ricerca.getPageSize(idLista);
  9748.             int offset = ricerca.getIndexIniziale(idLista);
  9749.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  9750.             this.pd.setIndex(offset);
  9751.             this.pd.setPageSize(limit);
  9752.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  9753.             PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(id));
  9754.             long idAspsLong = Long.parseLong(idAsps);
  9755.             AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(idAspsLong);
  9756.            
  9757.             PortaApplicativaServizioApplicativo paSA = null;
  9758.             for (PortaApplicativaServizioApplicativo paSATmp : pa.getServizioApplicativoList()) {
  9759.                 if(paSATmp.getNome().equals(nomeSAConnettore)) {
  9760.                     paSA = paSATmp;                
  9761.                 }
  9762.             }

  9763.             boolean accessoDaListaAPS = false;
  9764.             if(Costanti.CHECK_BOX_ENABLED_TRUE.equals(accessoDaAPSParametro)) {
  9765.                 accessoDaListaAPS = true;
  9766.             }
  9767.            
  9768.             boolean isModalitaCompleta = this.isModalitaCompleta();
  9769.             Boolean vistaErogazioni = ServletUtils.getBooleanAttributeFromSession(ErogazioniCostanti.ASPS_EROGAZIONI_ATTRIBUTO_VISTA_EROGAZIONI, this.session, this.request).getValue();
  9770.             // setto la barra del titolo
  9771.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  9772.            
  9773.             String labelPerPorta = null;
  9774.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  9775.                 if(accessoDaListaAPS) {
  9776.                     if(!isModalitaCompleta) {
  9777.                         if(vistaErogazioni != null && vistaErogazioni.booleanValue()) {
  9778.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  9779.                         } else {
  9780.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI+
  9781.                                     this.getLabelIdServizio(asps);
  9782.                         }
  9783.                     }
  9784.                     else {
  9785.                         labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  9786.                     }
  9787.                 }
  9788.                 else {
  9789.                     labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  9790.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI,
  9791.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG,
  9792.                             pa);
  9793.                 }
  9794.             }
  9795.             else {
  9796.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_DI+nomePorta;
  9797.             }
  9798.            
  9799.             if(accessoDaListaAPS) {
  9800.                 lstParam.remove(lstParam.size()-1);
  9801.             }
  9802.             List<Parameter> listaParametriServletConnettoriMultipliList = new ArrayList<>();
  9803.             listaParametriServletConnettoriMultipliList.add(pIdSogg);
  9804.             listaParametriServletConnettoriMultipliList.add(pIdPorta);
  9805.             listaParametriServletConnettoriMultipliList.add(pNomePorta);
  9806.             listaParametriServletConnettoriMultipliList.add(pIdAsps);
  9807.             listaParametriServletConnettoriMultipliList.add(pAccessoDaAPS);
  9808.             listaParametriServletConnettoriMultipliList.add(pConnettoreAccessoDaGruppi);
  9809.             listaParametriServletConnettoriMultipliList.add(pConnettoreRegistro);
  9810.             listaParametriServletConnettoriMultipliList.add(pConnettoreAccessoCM);
  9811.            
  9812.             lstParam.add(new Parameter(labelPerPorta,  PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_LIST, listaParametriServletConnettoriMultipliList.toArray(new Parameter[1])));
  9813.            
  9814.             String labelPagLista = this.getLabelNomePortaApplicativaServizioApplicativo(
  9815.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA_DI,
  9816.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA,
  9817.                     paSA);
  9818.            
  9819.             this.pd.setSearchLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  9820.             if(search.equals("")){
  9821.                 this.pd.setSearchDescription("");
  9822.                 lstParam.add(new Parameter(labelPagLista,null));
  9823.             }
  9824.             else{
  9825.                 List<Parameter> listaParametriServletConnettoriMultipliProprietaList = new ArrayList<>();
  9826.                 listaParametriServletConnettoriMultipliProprietaList.addAll(listaParametriServletConnettoriMultipliList);
  9827.                 listaParametriServletConnettoriMultipliProprietaList.add(new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA, nomeSAConnettore));
  9828.                
  9829.                 lstParam.add(new Parameter(labelPagLista, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPERTIES_LIST,  listaParametriServletConnettoriMultipliProprietaList.toArray(new Parameter[listaParametriServletConnettoriMultipliProprietaList.size()])));
  9830.                
  9831.                 lstParam.add(new Parameter(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_RISULTATI_RICERCA, null));

  9832.             }

  9833.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  9834.            
  9835.             // imposta menu' contestuale
  9836.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  9837.             // controllo eventuali risultati ricerca
  9838.             if (!search.equals("")) {
  9839.                 ServletUtils.enabledPageDataSearch(this.pd, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PROPRIETA, search);
  9840.             }

  9841.             // setto le label delle colonne
  9842.             String[] labels = {CostantiControlStation.LABEL_PARAMETRO_NOME , CostantiControlStation.LABEL_PARAMETRO_VALORE };
  9843.             this.pd.setLabels(labels);

  9844.             // preparo i dati
  9845.             List<List<DataElement>> dati = new ArrayList<>();

  9846.             if (lista != null) {
  9847.                 Iterator<Proprieta> it = lista.iterator();
  9848.                 while (it.hasNext()) {
  9849.                     Proprieta proprieta = it.next();
  9850.        
  9851.                     List<DataElement> e = new ArrayList<>();
  9852.        
  9853.                     DataElement de = new DataElement();
  9854.                     de.setValue(proprieta.getNome());
  9855.                     de.setIdToRemove(proprieta.getId() + "");
  9856.                     de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
  9857.                     e.add(de);
  9858.                    
  9859.                     de = new DataElement();
  9860.                     de.setValue(proprieta.getValore());
  9861.                     e.add(de);
  9862.        
  9863.                     dati.add(e);
  9864.                 }
  9865.             }

  9866.             this.pd.setDati(dati);
  9867.             this.pd.setAddButton(true);

  9868.         } catch (Exception e) {
  9869.             this.logError(e.getMessage(), e);
  9870.             throw new ControlStationCoreException(e.getMessage(),e);
  9871.         }
  9872.     }
  9873.    
  9874.     public boolean proprietaConnettoriMultipliCheckData(TipoOperazione tipoOp, String idPorta, String nomeSA, String nome,String valore) throws Exception {
  9875.         try {
  9876.             // Campi obbligatori
  9877.             if (nome.equals("") || valore.equals("")) {
  9878.                 String tmpElenco = "";
  9879.                 if (nome.equals("")) {
  9880.                     tmpElenco = "Nome";
  9881.                 }
  9882.                 if (valore.equals("")) {
  9883.                     if (tmpElenco.equals("")) {
  9884.                         tmpElenco = "Valore";
  9885.                     } else {
  9886.                         tmpElenco = tmpElenco + ", Valore";
  9887.                     }
  9888.                 }
  9889.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  9890.                 return false;
  9891.             }
  9892.            
  9893.             // Check Lunghezza
  9894.             if(this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_NOME)==false) {
  9895.                 return false;
  9896.             }
  9897.             if(this.checkLength255(valore, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_VALORE)==false) {
  9898.                 return false;
  9899.             }
  9900.            
  9901.             // Se tipoOp = add, controllo che la property non sia gia'
  9902.             // stata
  9903.             // registrata per la porta applicativa
  9904.             if (tipoOp.equals(TipoOperazione.ADD)) {
  9905.                 boolean giaRegistrato = false;
  9906.                 PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(Integer.parseInt(idPorta));
  9907.                
  9908.                 PortaApplicativaServizioApplicativo paSA = null;
  9909.                 for (PortaApplicativaServizioApplicativo paSATmp : pa.getServizioApplicativoList()) {
  9910.                     if(paSATmp.getNome().equals(nomeSA)) {
  9911.                         paSA = paSATmp;    
  9912.                         break;
  9913.                     }
  9914.                 }
  9915.                 if(paSA==null) {
  9916.                     throw new Exception("PortaApplicativaServizioApplicativo con nome '"+nomeSA+"' non trovato");
  9917.                 }

  9918.                 PortaApplicativaServizioApplicativoConnettore datiConnettore = paSA.getDatiConnettore();
  9919.                
  9920.                 if(datiConnettore != null) { // succede solo se e' la prima volta che modifico la configurazione di default
  9921.                     for (int i = 0; i < datiConnettore.sizeProprietaList(); i++) {
  9922.                         Proprieta tmpProp = datiConnettore.getProprieta(i);
  9923.                         if (nome.equals(tmpProp.getNome())) {
  9924.                             giaRegistrato = true;
  9925.                             break;
  9926.                         }
  9927.                     }
  9928.                 }

  9929.                 if (giaRegistrato) {
  9930.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_LA_PROPERTY_XX_E_GIA_STATA_ASSOCIATA_AL_CONNETTORE_YY, nome, this.getLabelNomePortaApplicativaServizioApplicativo(paSA)));    
  9931.                     return false;
  9932.                 }
  9933.             }

  9934.             return true;
  9935.         } catch (Exception e) {
  9936.             this.logError(e.getMessage(), e);
  9937.             throw new ControlStationCoreException(e.getMessage(),e);
  9938.         }
  9939.     }
  9940.    
  9941.     public List<DataElement> addProprietaConnettoriMultipliConfigToDati(List<DataElement> dati, TipoOperazione tipoOp, String nome, String valore, String labelTitolo) {
  9942.         return addProprietaConnettoriMultipliConfigToDati(dati, tipoOp, nome, valore, labelTitolo, null);
  9943.     }
  9944.    
  9945.     public List<DataElement> addProprietaConnettoriMultipliConfigToDati(List<DataElement> dati, TipoOperazione tipoOp, String nome, String valore, String labelTitolo, String nomeSA) {

  9946.         DataElement de = new DataElement();
  9947.         de.setLabel(labelTitolo);
  9948.         de.setType(DataElementType.TITLE);
  9949.         dati.add(de);
  9950.        
  9951.         de = new DataElement();
  9952.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  9953.         de.setValue(nome);
  9954.         if(TipoOperazione.ADD.equals(tipoOp)){
  9955.             de.setType(DataElementType.TEXT_EDIT);
  9956.             de.setRequired(true);
  9957.         }
  9958.         else{
  9959.             de.setType(DataElementType.TEXT);
  9960.         }
  9961.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PROP);
  9962.         de.setSize(this.getSize());
  9963.         dati.add(de);

  9964.         de = new DataElement();
  9965.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  9966.         de.setType(DataElementType.TEXT_EDIT);
  9967.         de.setRequired(true);
  9968.         de.setName(CostantiControlStation.PARAMETRO_VALORE);
  9969.         de.setValue(valore);
  9970.         de.setSize(this.getSize());
  9971.         dati.add(de);
  9972.        
  9973.         if(nomeSA != null) {
  9974.             de = new DataElement();
  9975.             de.setLabel("");
  9976.             de.setValue(nomeSA);
  9977.             de.setType(DataElementType.HIDDEN);
  9978.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA);
  9979.             dati.add(de);
  9980.         }
  9981.         return dati;
  9982.        
  9983.     }
  9984.    
  9985.     public String[] getEsitiTransazione(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneMultiDeliver configurazioneMultiDeliver) {
  9986.         String[] esitiTransazione = null;
  9987.         List<String> esitiList = new ArrayList<>();
  9988.        
  9989.         if(configurazioneMultiDeliver.isNotificheByEsito_ok())
  9990.             esitiList.add(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_OK);
  9991.         if(configurazioneMultiDeliver.isNotificheByEsito_fault())
  9992.             esitiList.add(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_FAULT);
  9993.         if(configurazioneMultiDeliver.isNotificheByEsito_erroriConsegna())
  9994.             esitiList.add(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_CONSEGNA);
  9995.         if(configurazioneMultiDeliver.isNotificheByEsito_erroriProcessamento())
  9996.             esitiList.add(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_PROCESSAMENTO);
  9997.         // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  9998.         //if(configurazioneMultiDeliver.isNotificheByEsito_richiesteScartate())
  9999.         //  esitiList.add(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_RICHIESTA_SCARTATE);
  10000.        
  10001.         esitiTransazione = esitiList.toArray(new String[esitiList.size()]);
  10002.         return esitiTransazione;
  10003.     }
  10004.    
  10005.     public org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyConfigurazione toConfigurazioneSticky(boolean sticky, String stickyTipoSelettore, String stickyTipoSelettorePattern, String stickyMaxAge) throws NotFoundException {
  10006.         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyConfigurazione config = new org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyConfigurazione();
  10007.         config.setStickyEnabled(sticky);
  10008.         if(sticky) {
  10009.             config.setTipoSelettore(StickyTipoSelettore.toEnumConstant(stickyTipoSelettore, true));
  10010.             config.setPattern(stickyTipoSelettorePattern);
  10011.             if(!StringUtils.isEmpty(stickyMaxAge)) {
  10012.                 config.setMaxAgeSeconds(Integer.valueOf(stickyMaxAge));
  10013.             }
  10014.         }
  10015.         return config;
  10016.     }
  10017.    
  10018.     public org.openspcoop2.pdd.core.behaviour.built_in.load_balance.health_check.HealthCheckConfigurazione toConfigurazioneHealthCheck(boolean passiveHealthCheck, String passiveHealthCheck_excludeForSeconds) throws NotFoundException {
  10019.         org.openspcoop2.pdd.core.behaviour.built_in.load_balance.health_check.HealthCheckConfigurazione config = new org.openspcoop2.pdd.core.behaviour.built_in.load_balance.health_check.HealthCheckConfigurazione();
  10020.         config.setPassiveCheckEnabled(passiveHealthCheck);
  10021.         if(passiveHealthCheck) {
  10022.             if(!StringUtils.isEmpty(passiveHealthCheck_excludeForSeconds)) {
  10023.                 config.setPassiveHealthCheck_excludeForSeconds(Integer.valueOf(passiveHealthCheck_excludeForSeconds));
  10024.             }
  10025.         }
  10026.         return config;
  10027.     }
  10028.    
  10029.     public org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneMultiDeliver toConfigurazioneMultiDeliver(String connettoreImplementaAPI, boolean notificheCondizionaliEsito, String [] esitiTransazione) {
  10030.        
  10031.         org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneMultiDeliver configurazioneMultiDeliver = new org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneMultiDeliver();
  10032.        
  10033.         if(StringUtils.isNotBlank(connettoreImplementaAPI))
  10034.             configurazioneMultiDeliver.setTransazioneSincrona_nomeConnettore(connettoreImplementaAPI);
  10035.         configurazioneMultiDeliver.setNotificheByEsito(notificheCondizionaliEsito);
  10036.        
  10037.         List<String> esitiList = new ArrayList<>();
  10038.         if(esitiTransazione != null && esitiTransazione.length > 0) {
  10039.             esitiList = Arrays.asList(esitiTransazione);
  10040.         }
  10041.        
  10042.         configurazioneMultiDeliver.setNotificheByEsito_ok(esitiList.contains(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_OK));
  10043.         configurazioneMultiDeliver.setNotificheByEsito_fault(esitiList.contains(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_FAULT));
  10044.         configurazioneMultiDeliver.setNotificheByEsito_erroriConsegna(esitiList.contains(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_CONSEGNA));
  10045.         configurazioneMultiDeliver.setNotificheByEsito_erroriProcessamento(esitiList.contains(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_PROCESSAMENTO));
  10046.         // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  10047.         //configurazioneMultiDeliver.setNotificheByEsito_richiesteScartate(esitiList.contains(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_RICHIESTA_SCARTATE));
  10048.        
  10049.         return configurazioneMultiDeliver;
  10050.     }
  10051.    
  10052.     public org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneCondizionale toConfigurazioneCondizionale(
  10053.             boolean consegnaCondizionale, String selezioneConnettoreBy, String identificazioneCondizionale, String identificazioneCondizionalePattern,
  10054.             String identificazioneCondizionalePrefisso, String identificazioneCondizionaleSuffisso, boolean condizioneNonIdentificataAbortTransaction, String condizioneNonIdentificataDiagnostico, String condizioneNonIdentificataConnettore,
  10055.             boolean connettoreNonTrovatoAbortTransaction, String connettoreNonTrovatoDiagnostico, String connettoreNonTrovatoConnettore) {
  10056.         org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneCondizionale configurazioneCondizionale = new org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneCondizionale();
  10057.        
  10058.         if(selezioneConnettoreBy.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SELEZIONE_CONNETTORE_BY_FILTRO))
  10059.             configurazioneCondizionale.setByFilter(true);
  10060.         else
  10061.             configurazioneCondizionale.setByFilter(false);
  10062.        
  10063.         ConfigurazioneSelettoreCondizione defaultConfig = new ConfigurazioneSelettoreCondizione();
  10064.        
  10065.         defaultConfig.setTipoSelettore(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale));
  10066.         defaultConfig.setPattern(identificazioneCondizionalePattern);
  10067.         defaultConfig.setPrefix(identificazioneCondizionalePrefisso);
  10068.         defaultConfig.setSuffix(identificazioneCondizionaleSuffisso);
  10069.                
  10070.         configurazioneCondizionale.setDefaultConfig(defaultConfig);
  10071.        
  10072.                
  10073.         IdentificazioneFallitaConfigurazione condizioneNonIdentificata = new IdentificazioneFallitaConfigurazione();
  10074.         condizioneNonIdentificata.setAbortTransaction(condizioneNonIdentificataAbortTransaction);
  10075.        
  10076.        
  10077.         if(condizioneNonIdentificataDiagnostico == null || condizioneNonIdentificataDiagnostico.equals(StatoFunzionalita.DISABILITATO.getValue())) {
  10078.             condizioneNonIdentificata.setEmitDiagnosticError(false);
  10079.             condizioneNonIdentificata.setEmitDiagnosticInfo(false);
  10080.         }else if(condizioneNonIdentificataDiagnostico.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_ERROR)) {
  10081.             condizioneNonIdentificata.setEmitDiagnosticError(true);
  10082.             condizioneNonIdentificata.setEmitDiagnosticInfo(false);
  10083.         } else if(condizioneNonIdentificataDiagnostico.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_INFO)) {
  10084.             condizioneNonIdentificata.setEmitDiagnosticError(false);
  10085.             condizioneNonIdentificata.setEmitDiagnosticInfo(true);
  10086.         }
  10087.        
  10088.         condizioneNonIdentificata.setNomeConnettore(condizioneNonIdentificataConnettore);
  10089.         configurazioneCondizionale.setCondizioneNonIdentificata(condizioneNonIdentificata );
  10090.        
  10091.         IdentificazioneFallitaConfigurazione nessunConnettoreTrovato = new IdentificazioneFallitaConfigurazione();
  10092.        
  10093.         nessunConnettoreTrovato.setAbortTransaction(connettoreNonTrovatoAbortTransaction);
  10094.        
  10095.         if(connettoreNonTrovatoDiagnostico == null || connettoreNonTrovatoDiagnostico.equals(StatoFunzionalita.DISABILITATO.getValue())) {
  10096.             nessunConnettoreTrovato.setEmitDiagnosticError(false);
  10097.             nessunConnettoreTrovato.setEmitDiagnosticInfo(false);
  10098.         }else if(connettoreNonTrovatoDiagnostico.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_ERROR)) {
  10099.             nessunConnettoreTrovato.setEmitDiagnosticError(true);
  10100.             nessunConnettoreTrovato.setEmitDiagnosticInfo(false);
  10101.         } else if(connettoreNonTrovatoDiagnostico.equals(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA_DIAGNOSTICO_INFO)) {
  10102.             nessunConnettoreTrovato.setEmitDiagnosticError(false);
  10103.             nessunConnettoreTrovato.setEmitDiagnosticInfo(true);
  10104.         }
  10105.        
  10106.         nessunConnettoreTrovato.setNomeConnettore(connettoreNonTrovatoConnettore);
  10107.        
  10108.         configurazioneCondizionale.setNessunConnettoreTrovato(nessunConnettoreTrovato);
  10109.        
  10110.         return configurazioneCondizionale;
  10111.     }
  10112.        
  10113.     public void preparePorteApplicativeConnettoriMultipliConfigAzioniList(PortaApplicativa pa,
  10114.             org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneCondizionale configurazioneCondizionale, ISearch ricerca, Set<String> lista) throws Exception {
  10115.         try {
  10116.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  10117.             Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
  10118.             String idAsps = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS);
  10119.             if(idAsps == null)
  10120.                 idAsps = "";

  10121.             String id = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID);
  10122.             String idsogg = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO);

  10123.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id);
  10124.             Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, pa.getNome());
  10125.             Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  10126.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  10127.            
  10128.             String idTabP = this.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  10129.             Parameter pIdTab = new Parameter(CostantiControlStation.PARAMETRO_ID_TAB, idTabP != null ? idTabP : "");
  10130.            
  10131.             String accessoDaAPSParametro = this.getParameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS);
  10132.             Parameter pAccessoDaAPS = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORE_DA_LISTA_APS, accessoDaAPSParametro != null ? accessoDaAPSParametro : "");
  10133.             String connettoreAccessoGruppi = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  10134.             Parameter pConnettoreAccessoDaGruppi = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI, connettoreAccessoGruppi);
  10135.             String connettoreRegistro = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  10136.             Parameter pConnettoreRegistro = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO, connettoreRegistro);
  10137.             String connettoreAccessoCM = this.getParameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI);
  10138.             Parameter pConnettoreAccessoCM = new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI, connettoreAccessoCM);
  10139.            
  10140.            
  10141.             ServletUtils.addListElementIntoSession(this.request, this.session, PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_AZIONI,
  10142.                     pIdPorta, pIdSogg, pIdAsps, pNomePorta, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pAccessoDaAPS, pIdTab, pConnettoreAccessoCM);
  10143.            
  10144.             ServletUtils.disabledPageDataSearch(this.pd);
  10145.            
  10146.             this.pd.setNumEntries(lista != null ? lista.size() : 0);
  10147.             String idporta = pa.getNome();
  10148.            
  10149.             long idAspsLong = Long.parseLong(idAsps);
  10150.             AccordoServizioParteSpecifica asps = this.apsCore.getAccordoServizioParteSpecifica(idAspsLong);
  10151.             AccordoServizioParteComuneSintetico as = null;
  10152.             if(this.porteApplicativeCore.isRegistroServiziLocale()){
  10153.                 int idAcc = asps.getIdAccordo().intValue();
  10154.                 as = this.apcCore.getAccordoServizioSintetico(idAcc);
  10155.             }
  10156.             else{
  10157.                 as = this.apcCore.getAccordoServizioSintetico(IDAccordoFactory.getInstance().getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  10158.             }

  10159.             boolean accessoDaListaAPS = false;
  10160.             if(Costanti.CHECK_BOX_ENABLED_TRUE.equals(accessoDaAPSParametro)) {
  10161.                 accessoDaListaAPS = true;
  10162.             }
  10163.            
  10164.             boolean isModalitaCompleta = this.isModalitaCompleta();
  10165.             Boolean vistaErogazioni = ServletUtils.getBooleanAttributeFromSession(ErogazioniCostanti.ASPS_EROGAZIONI_ATTRIBUTO_VISTA_EROGAZIONI, this.session, this.request).getValue();
  10166.             // setto la barra del titolo
  10167.             List<Parameter> lstParam = this.getTitoloPA(parentPA, idsogg, idAsps);
  10168.            
  10169.             String labelPerPorta = null;
  10170.             if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
  10171.                 if(accessoDaListaAPS) {
  10172.                     if(!isModalitaCompleta) {
  10173.                         if(vistaErogazioni != null && vistaErogazioni.booleanValue()) {
  10174.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  10175.                         } else {
  10176.                             labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI+
  10177.                                     this.getLabelIdServizio(asps);
  10178.                         }
  10179.                     }
  10180.                     else {
  10181.                         labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG;
  10182.                     }
  10183.                 }
  10184.                 else {
  10185.                     labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
  10186.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI,
  10187.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG,
  10188.                             pa);
  10189.                 }
  10190.             }
  10191.             else {
  10192.                 labelPerPorta = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_DI+idporta;
  10193.             }
  10194.            
  10195.             if(accessoDaListaAPS) {
  10196.                 lstParam.remove(lstParam.size()-1);
  10197.             }
  10198.            
  10199.             lstParam.add(new Parameter(labelPerPorta,PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONFIGURAZIONE_CONNETTORI_MULTIPLI, pIdSogg, pIdPorta, pIdAsps,
  10200.                     pAccessoDaAPS, pConnettoreAccessoDaGruppi,  pConnettoreRegistro, pConnettoreAccessoCM));
  10201.            
  10202.             String labelPagLista = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_AZIONI_REGOLE;
  10203.            
  10204.             lstParam.add(new Parameter(labelPagLista,null));

  10205.             ServletUtils.setPageDataTitle(this.pd, lstParam.toArray(new Parameter[lstParam.size()]));
  10206.            
  10207.             // imposta menu' contestuale
  10208.             this.impostaComandiMenuContestualePA(idsogg, idAsps);

  10209.             ServiceBinding serviceBinding = this.porteApplicativeCore.toMessageServiceBinding(as.getServiceBinding());
  10210.            
  10211.             // setto le label delle colonne
  10212.             String[] labels = {PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_NOME_LIST, this.getLabelAzione(serviceBinding )};
  10213.             this.pd.setLabels(labels);

  10214.             // preparo i dati
  10215.             List<List<DataElement>> dati = new ArrayList<>();

  10216.             if (lista != null) {
  10217.                 Iterator<String> it = lista.iterator();
  10218.                 while (it.hasNext()) {
  10219.                     String nomeRegola = it.next();
  10220.                     ConfigurazioneSelettoreCondizioneRegola regola = configurazioneCondizionale.getRegola(nomeRegola);
  10221.                     Parameter pNomeRegola = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_OLD_NOME, nomeRegola);
  10222.                    
  10223.                     List<DataElement> e = new ArrayList<>();
  10224.        
  10225.                     DataElement de = new DataElement();
  10226.                     de.setValue(nomeRegola);
  10227.                     de.setIdToRemove(nomeRegola + "");
  10228.                     de.setUrl(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIG_AZIONI_CHANGE,
  10229.                             pIdPorta, pIdSogg, pIdAsps, pNomePorta, pConnettoreAccessoDaGruppi, pConnettoreRegistro, pAccessoDaAPS, pIdTab, pConnettoreAccessoCM,pNomeRegola);
  10230.                     e.add(de);
  10231.                    
  10232.                     de = new DataElement();
  10233.                     de.setValue(regola.getPatternOperazione());
  10234.                     e.add(de);
  10235.        
  10236.                     dati.add(e);
  10237.                 }
  10238.             }

  10239.             this.pd.setDati(dati);
  10240.             this.pd.setAddButton(true);

  10241.         } catch (Exception e) {
  10242.             this.logError(e.getMessage(), e);
  10243.             throw new ControlStationCoreException(e.getMessage(),e);
  10244.         }
  10245.     }
  10246.     public List<DataElement> addAzioneConnettoriMultipliConfigToDati(List<DataElement> dati, TipoOperazione tipoOp, String protocollo, ServiceBinding serviceBinding,
  10247.             String oldNome, String nome, String patternOperazione, boolean selezioneConnettoreByFiltro, String identificazioneCondizionale,
  10248.             String identificazioneCondizionalePattern, String identificazioneCondizionalePrefisso, String identificazioneCondizionaleSuffisso,
  10249.             List<String> connettoriValues, List<String> connettoriLabels) throws Exception {
  10250.    
  10251.         DataElement de = new DataElement();
  10252.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_REGOLA);
  10253.         de.setType(DataElementType.TITLE);
  10254.         dati.add(de);
  10255.        
  10256.         // vecchio nome
  10257.         if(tipoOp.equals(TipoOperazione.CHANGE)) {
  10258.             de = new DataElement();
  10259.             de.setLabel("");
  10260.             de.setValue(oldNome);
  10261.             de.setType(DataElementType.HIDDEN);
  10262.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_OLD_NOME);
  10263.             dati.add(de);
  10264.         }
  10265.        
  10266.         // nome
  10267.         de = new DataElement();
  10268.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_NOME_FORM);
  10269.         de.setValue(nome);
  10270.         de.setType(DataElementType.TEXT_EDIT);
  10271.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_NOME);
  10272.         de.setRequired(true);
  10273.         dati.add(de);
  10274.        
  10275.         // operationPattern
  10276.         de = new DataElement();
  10277.         de.setLabel(this.getLabelAzione(serviceBinding));
  10278.         de.setValue(patternOperazione);
  10279.         de.setType(DataElementType.TEXT_AREA);
  10280.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_PATTERN_OPERAZIONE);
  10281.         de.setRequired(true);
  10282.         DataElementInfo info = new DataElementInfo(this.getLabelAzione(serviceBinding));
  10283.         info.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_PATTERN_AZIONE_INFO_HEADER);
  10284.         if(ServiceBinding.REST.equals(serviceBinding)) {
  10285.             info.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_PATTERN_AZIONE_INFO_BODY_LIST_REST);
  10286.         }
  10287.         else {
  10288.             info.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_PATTERN_AZIONE_INFO_BODY_LIST_SOAP);
  10289.         }
  10290.         de.setInfo(info);
  10291.         dati.add(de);
  10292.        
  10293.         // Identificazione condizionale
  10294.         de = new DataElement();
  10295.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE);
  10296.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE);
  10297.         de.setType(DataElementType.SELECT);
  10298.        
  10299.         org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore tipoSelettoreS = null;
  10300.         if(!PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO.equals(identificazioneCondizionale)) {
  10301.             tipoSelettoreS = org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale, true);
  10302.         }
  10303.                        
  10304.         String [] identificazioneCondizionale_values = {
  10305.                 PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO,
  10306.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.HEADER_BASED.getValue(),
  10307.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.getValue(),
  10308.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FORM_BASED.getValue(),
  10309.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.SOAPACTION_BASED.getValue(),
  10310.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.getValue(),
  10311.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP.getValue(),
  10312.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP_FORWARDED.getValue(),
  10313.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.getValue(),
  10314.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.getValue(),
  10315.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.VELOCITY_TEMPLATE.getValue()
  10316.                 };
  10317.        
  10318.         List<String> identificazioneCondizionale_labels = ModalitaIdentificazione.getLabels(
  10319.                 ModalitaIdentificazione.STATIC,
  10320.                 ModalitaIdentificazione.HEADER_BASED,
  10321.                 ModalitaIdentificazione.URL_BASED,
  10322.                 ModalitaIdentificazione.FORM_BASED,
  10323.                 ModalitaIdentificazione.SOAP_ACTION_BASED,
  10324.                 ModalitaIdentificazione.CONTENT_BASED,
  10325.                 ModalitaIdentificazione.INDIRIZZO_IP_BASED,
  10326.                 ModalitaIdentificazione.X_FORWARD_FOR_BASED,
  10327.                 ModalitaIdentificazione.GOVWAY_TEMPLATE,
  10328.                 ModalitaIdentificazione.FREEMARKER_TEMPLATE,
  10329.                 ModalitaIdentificazione.VELOCITY_TEMPLATE
  10330.             );
  10331.        
  10332.         de.setValues(identificazioneCondizionale_values);
  10333.         de.setLabels(identificazioneCondizionale_labels);
  10334.         de.setPostBack(true);
  10335.         de.setSelected(identificazioneCondizionale);
  10336.         dati.add(de);  
  10337.        
  10338.         // nome
  10339.         de = new DataElement();
  10340.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_PATTERN);
  10341.         de.setLabel(this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale, selezioneConnettoreByFiltro));
  10342.         de.setValue(identificazioneCondizionalePattern);
  10343.         if(identificazioneCondizionale==null ||
  10344.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.SOAPACTION_BASED.equals(identificazioneCondizionale)  ||
  10345.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP.equals(identificazioneCondizionale) ||
  10346.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.INDIRIZZO_IP_FORWARDED.equals(identificazioneCondizionale)){
  10347.             de.setType(DataElementType.HIDDEN);
  10348.         }
  10349.         else if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.equals(identificazioneCondizionale) ||
  10350.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.equals(identificazioneCondizionale)||
  10351.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.equals(identificazioneCondizionale)||
  10352.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.VELOCITY_TEMPLATE.equals(identificazioneCondizionale)||
  10353.                 org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.equals(identificazioneCondizionale)) {
  10354.             de.setRequired(true);
  10355.             de.setType(DataElementType.TEXT_AREA);
  10356.             if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  10357.                 de.setRows(10);
  10358.             }
  10359.         }else if(PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO.equals(identificazioneCondizionale)) { // static
  10360.             if(selezioneConnettoreByFiltro) {
  10361.                 de.setRequired(true);
  10362.                 de.setType(DataElementType.TEXT_EDIT);
  10363.             } else {
  10364.                 de.setType(DataElementType.SELECT);
  10365.                 de.setValues(connettoriValues);
  10366.                 de.setLabels(connettoriLabels);
  10367.                 de.setSelected(identificazioneCondizionalePattern);
  10368.             }
  10369.         }
  10370.         else{
  10371.             de.setRequired(true);
  10372.             de.setType(DataElementType.TEXT_EDIT);
  10373.         }
  10374.        
  10375.         if(tipoSelettoreS!=null && tipoSelettoreS.isTemplate()) {
  10376.             DataElementInfo dInfoPattern = null;
  10377.             if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.TEMPLATE.equals(identificazioneCondizionale)) {
  10378.                 dInfoPattern = new DataElementInfo(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabel());
  10379.                 dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  10380.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  10381.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), false, false));
  10382.                 }
  10383.                 else {
  10384.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), false, false));
  10385.                 }
  10386.             }
  10387.             else if(org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.FREEMARKER_TEMPLATE.equals(identificazioneCondizionale)) {
  10388.                 dInfoPattern = new DataElementInfo(ModalitaIdentificazione.FREEMARKER_TEMPLATE.getLabel());
  10389.                 dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  10390.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  10391.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  10392.                 }
  10393.                 else {
  10394.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), false, false));
  10395.                 }
  10396.             }
  10397.             else {
  10398.                 dInfoPattern = new DataElementInfo(ModalitaIdentificazione.VELOCITY_TEMPLATE.getLabel());
  10399.                 dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  10400.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  10401.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  10402.                 }
  10403.                 else {
  10404.                     dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), false, false));
  10405.                 }
  10406.             }
  10407.             de.setInfo(dInfoPattern);
  10408.         }
  10409.        
  10410.         dati.add(de);
  10411.        
  10412.         // prefisso
  10413.         de = new DataElement();
  10414.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO);
  10415.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO);
  10416.         de.setSize(this.getSize());
  10417.         de.setValue(identificazioneCondizionalePrefisso);
  10418.         if( (tipoSelettoreS!=null && tipoSelettoreS.isTemplate())
  10419.                 ||
  10420.                 (PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO.equals(identificazioneCondizionale))
  10421.                 ) {
  10422.              de.setType(DataElementType.HIDDEN);
  10423.         } else {
  10424.              de.setType(DataElementType.TEXT_EDIT);
  10425.         }
  10426.         dati.add(de);
  10427.        
  10428.         // suffisso
  10429.         de = new DataElement();
  10430.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO);
  10431.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO);
  10432.         de.setSize(this.getSize());
  10433.         de.setValue(identificazioneCondizionaleSuffisso);
  10434.         if( (tipoSelettoreS!=null && tipoSelettoreS.isTemplate())
  10435.                 ||
  10436.                 (PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO.equals(identificazioneCondizionale))
  10437.                 ) {
  10438.              de.setType(DataElementType.HIDDEN);
  10439.         } else {
  10440.              de.setType(DataElementType.TEXT_EDIT);
  10441.         }
  10442.         dati.add(de);
  10443.        
  10444.        
  10445.        
  10446.         return dati;
  10447.     }
  10448.     public boolean azioneConnettoriMultipliConfigCheckData(TipoOperazione tipoOp, ServiceBinding serviceBinding, String idPorta, String oldNome,
  10449.             String nome, String patternOperazione, boolean selezioneConnettoreByFiltro, String identificazioneCondizionale,
  10450.             String identificazioneCondizionalePattern, String identificazioneCondizionalePrefisso,
  10451.             String identificazioneCondizionaleSuffisso, Set<String> regoleEsistenti) throws Exception {
  10452.        
  10453.         // campi obbligatori
  10454.         if (nome.equals("")){
  10455.             this.pd.setMessage("Il campo "+ PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_NOME_FORM +" non pu&ograve; essere vuoto");
  10456.             return false;
  10457.         }
  10458.        
  10459.         if (patternOperazione.equals("")){
  10460.             this.pd.setMessage("Il campo "+ this.getLabelAzione(serviceBinding) +" non pu&ograve; essere vuoto");
  10461.             return false;
  10462.         }
  10463.        
  10464.         // Check Lunghezza
  10465.         if(this.checkLength255(nome, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_NOME_FORM)==false) {
  10466.             return false;
  10467.         }
  10468.        
  10469.         if(this.checkLength4000(patternOperazione, this.getLabelAzione(serviceBinding))==false) {
  10470.             return false;
  10471.         }
  10472.        
  10473.         if (identificazioneCondizionale.equals("")){
  10474.             this.pd.setMessage("Il campo "+ PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE +" non pu&ograve; essere vuoto");
  10475.             return false;
  10476.         }
  10477.        
  10478.         if(!PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_AZIONI_IDENTIFICAZIONE_CONDIZIONALE_STATIC_INFO.equals(identificazioneCondizionale)) {
  10479.             org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore tipo = org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.toEnumConstant(identificazioneCondizionale);
  10480.                                
  10481.             if(tipo.hasParameter()) {
  10482.                 if (StringUtils.isEmpty(identificazioneCondizionalePattern)) {
  10483.                     this.pd.setMessage("Il campo "+ this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale) +" non pu&ograve; essere vuoto");
  10484.                     return false;
  10485.                 }
  10486.                
  10487.                 if(this.checkLength4000(identificazioneCondizionalePattern, this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale))==false) {
  10488.                     return false;
  10489.                 }
  10490.                
  10491.                 if (org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.URLBASED.equals(tipo)) {
  10492.                     if(this.checkRegexp(identificazioneCondizionalePattern,ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  10493.                         return false;
  10494.                     }
  10495.                 }
  10496.                 if (org.openspcoop2.pdd.core.behaviour.conditional.TipoSelettore.CONTENT_BASED.equals(tipo)) {
  10497.                     if(ServiceBinding.SOAP.equals(serviceBinding)) {
  10498.                         if(this.checkXPath(identificazioneCondizionalePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  10499.                             return false;
  10500.                         }
  10501.                     }
  10502.                     else {
  10503.                         if(this.checkXPathOrJsonPath(identificazioneCondizionalePattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  10504.                             return false;
  10505.                         }
  10506.                     }
  10507.                 }
  10508.             }
  10509.            
  10510.                                
  10511.             if(!tipo.isTemplate()){  // e' un caso in cui e' visibile
  10512.                 if(this.checkLength255(identificazioneCondizionalePrefisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO)==false) {
  10513.                     return false;
  10514.                 }
  10515.                
  10516.                 if(this.checkLength255(identificazioneCondizionaleSuffisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO)==false) {
  10517.                     return false;
  10518.                 }
  10519.             }
  10520.         } else { // caso static
  10521.             if (StringUtils.isEmpty(identificazioneCondizionalePattern)) {
  10522.                 this.pd.setMessage("Il campo "+ this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale, selezioneConnettoreByFiltro) +" non pu&ograve; essere vuoto");
  10523.                 return false;
  10524.             }
  10525.            
  10526.             if(selezioneConnettoreByFiltro) {
  10527.                 if(this.checkLength255(identificazioneCondizionalePattern, this.getLabelIdentificazioneCondizionalePattern(identificazioneCondizionale, selezioneConnettoreByFiltro))==false) {
  10528.                     return false;
  10529.                 }
  10530.             }
  10531.            
  10532.             if(this.checkLength255(identificazioneCondizionalePrefisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_PREFISSO)==false) {
  10533.                 return false;
  10534.             }
  10535.            
  10536.             if(this.checkLength255(identificazioneCondizionaleSuffisso, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_IDENTIFICAZIONE_CONDIZIONALE_SUFFISSO)==false) {
  10537.                 return false;
  10538.             }
  10539.         }
  10540.        
  10541.        
  10542.         if(tipoOp.equals(TipoOperazione.ADD)) {
  10543.             if(regoleEsistenti != null && regoleEsistenti.contains(nome)) {
  10544.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_ESISTE_GIA_UNA_REGOLA_XX, nome));
  10545.                 return false;
  10546.             }
  10547.         }
  10548.        
  10549.         if(tipoOp.equals(TipoOperazione.CHANGE)) {
  10550.             if(!oldNome.equals(nome)) { // cambio nome alla regola nella change
  10551.                 if(regoleEsistenti != null && regoleEsistenti.contains(nome)) {
  10552.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_ESISTE_GIA_UNA_REGOLA_XX, nome));
  10553.                     return false;
  10554.                 }
  10555.             }
  10556.         }
  10557.        
  10558.         return true;
  10559.     }
  10560.    
  10561.     public boolean isConnettoreMultiploInUso(int numeroElementiDaControllare, String nomePaSA,
  10562.             PortaApplicativa pa, AccordoServizioParteSpecifica asps,
  10563.             AccordoServizioParteComuneSintetico apc, ServiceBinding serviceBinding, List<String> messaggiSezioniConnettore) throws DriverConfigurazioneException, Exception,
  10564.             DriverRegistroServiziException, DriverConfigurazioneNotFound, BehaviourException {
  10565.        
  10566.         boolean connettoreUtilizzatiConfig = false;
  10567.        
  10568.         for (int j = 0; j < pa.sizeServizioApplicativoList(); j++) {
  10569.             PortaApplicativaServizioApplicativo paSA = pa.getServizioApplicativo(j);
  10570.             String nomeConnettore = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  10571.             if (nomePaSA.equals(paSA.getNome())) {
  10572.                 if(pa.getBehaviour() != null) {
  10573.                     boolean connettoreInUso = false;
  10574.                     List<String> titoliSezioniAggiornate = new ArrayList<>();
  10575.                     TipoBehaviour behaviourType = TipoBehaviour.toEnumConstant(pa.getBehaviour().getNome());

  10576.                     boolean consegnaCondizionale = false;
  10577.                     if(behaviourType.equals(TipoBehaviour.CONSEGNA_MULTIPLA)
  10578.                             || behaviourType.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE)
  10579.                             || behaviourType.equals(TipoBehaviour.CONSEGNA_CONDIZIONALE)
  10580.                             || behaviourType.equals(TipoBehaviour.CONSEGNA_LOAD_BALANCE)) {
  10581.                         consegnaCondizionale = org.openspcoop2.pdd.core.behaviour.conditional.ConditionalUtils.isConfigurazioneCondizionale(pa, ControlStationCore.getLog());

  10582.                         if(behaviourType.equals(TipoBehaviour.CONSEGNA_CON_NOTIFICHE)) {
  10583.                                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.ConfigurazioneMultiDeliver configurazioneMultiDeliver =
  10584.                                         org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.MultiDeliverUtils.read(pa);

  10585.                             if(configurazioneMultiDeliver != null) {
  10586.                                 if(configurazioneMultiDeliver.getTransazioneSincrona_nomeConnettore() != null) {
  10587.                                     if(configurazioneMultiDeliver.getTransazioneSincrona_nomeConnettore().equals(nomeConnettore)) {
  10588.                                         // MESSAGGIO!
  10589.                                         titoliSezioniAggiornate.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_SEZIONE_NOTIFICHE
  10590.                                                 + " -> " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_IMPLEMENTA_API);
  10591.                                         connettoreInUso = true;
  10592.                                     }
  10593.                                 }
  10594.                             }
  10595.                         }


  10596.                         if(consegnaCondizionale) {
  10597.                             org.openspcoop2.pdd.core.behaviour.conditional.ConfigurazioneCondizionale configurazioneCondizionale =
  10598.                                     org.openspcoop2.pdd.core.behaviour.conditional.ConditionalUtils.read(pa, ControlStationCore.getLog());
  10599.                            
  10600.                             for (String nomeRegola : configurazioneCondizionale.getRegoleOrdinate()) {
  10601.                                 ConfigurazioneSelettoreCondizioneRegola regola = configurazioneCondizionale.getRegola(nomeRegola);
  10602.                                 if(!configurazioneCondizionale.isByFilter()) {
  10603.                                     if(regola.getStaticInfo() != null) {
  10604.                                         if(regola.getStaticInfo().equals(nomeConnettore)) {
  10605.                                             // MESSAGGIO!

  10606.                                             titoliSezioniAggiornate.add(
  10607.                                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONDIZIONALITA
  10608.                                                     + " -> " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_PER_AZIONI);
  10609.                                             connettoreInUso = true;
  10610.                                             break;
  10611.                                         }
  10612.                                     }
  10613.                                 }
  10614.                             }

  10615.                             org.openspcoop2.pdd.core.behaviour.conditional.IdentificazioneFallitaConfigurazione condizioneNonIdentificata =
  10616.                                     configurazioneCondizionale.getCondizioneNonIdentificata();

  10617.                             if(condizioneNonIdentificata.getNomeConnettore() != null) {
  10618.                                 if(condizioneNonIdentificata.getNomeConnettore().equals(nomeConnettore)) {
  10619.                                     // MESSAGGIO!

  10620.                                     titoliSezioniAggiornate.add(

  10621.                                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONDIZIONALITA
  10622.                                             + " -> " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONDIZIONE_NON_IDENTIFICATA);
  10623.                                     connettoreInUso = true;
  10624.                                 }
  10625.                             }

  10626.                             org.openspcoop2.pdd.core.behaviour.conditional.IdentificazioneFallitaConfigurazione connettoreNonTrovato =
  10627.                                     configurazioneCondizionale.getNessunConnettoreTrovato();

  10628.                             if(connettoreNonTrovato.getNomeConnettore() != null) {
  10629.                                 if(connettoreNonTrovato.getNomeConnettore().equals(nomeConnettore)) {
  10630.                                     // MESSAGGIO!
  10631.                                     titoliSezioniAggiornate.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONFIGURAZIONE_CONDIZIONALITA
  10632.                                             + " -> " + PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_NON_TROVATO);
  10633.                                     connettoreInUso = true;
  10634.                                 }
  10635.                             }
  10636.                         }

  10637.                         if(connettoreInUso) {
  10638.                             StringBuilder sbMsg = new StringBuilder();
  10639.                             if(numeroElementiDaControllare > 1) {
  10640.                                 sbMsg.append(nomeConnettore).append(":").append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  10641.                             }

  10642.                             sbMsg.append(DBOggettiInUsoUtils.formatList(titoliSezioniAggiornate, org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE));
  10643.                             messaggiSezioniConnettore.add(sbMsg.toString());
  10644.                             connettoreUtilizzatiConfig = true;
  10645.                         }

  10646.                     }
  10647.                 }
  10648.                 break;
  10649.             }
  10650.         } // end for tutti i pasa
  10651.        
  10652.         return connettoreUtilizzatiConfig;
  10653.     }
  10654.    
  10655.     public boolean isConnettoreMultiploInUsoCriteriApplicabilitaTrasformazioni(int numeroElementiDaControllare, String nomePaSA,
  10656.             PortaApplicativa pa, ServiceBinding serviceBinding, List<String> messaggiSezioniConnettore) throws DriverConfigurazioneException, Exception,
  10657.             DriverRegistroServiziException, DriverConfigurazioneNotFound, BehaviourException {
  10658.        
  10659.         boolean connettoreUtilizzatiConfig = false;
  10660.        
  10661.         // verifico che non sia associato a criteri di applicabilità delle configurazioni
  10662.         if(pa.getTrasformazioni()!=null && pa.getTrasformazioni().sizeRegolaList()>0) {
  10663.             for (int j = 0; j < pa.sizeServizioApplicativoList(); j++) {
  10664.                 PortaApplicativaServizioApplicativo paSA = pa.getServizioApplicativo(j);
  10665.                 if (nomePaSA.equals(paSA.getNome())) {
  10666.                     String nomeConnettore = this.getLabelNomePortaApplicativaServizioApplicativo(paSA);
  10667.                     for (TrasformazioneRegola tr : pa.getTrasformazioni().getRegolaList()) {
  10668.                         if(tr.getApplicabilita()!=null && tr.getApplicabilita().sizeConnettoreList()>0) {
  10669.                             if(tr.getApplicabilita().getConnettoreList().contains(nomePaSA)){
  10670.                                
  10671.                                 StringBuilder sbMsg = new StringBuilder();
  10672.                                 if(numeroElementiDaControllare > 1) {
  10673.                                     sbMsg.append(nomeConnettore).append(":").append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  10674.                                 }

  10675.                                
  10676.                                 List<String> titoliSezioniAggiornate = new ArrayList<>();
  10677.                                
  10678.                                 titoliSezioniAggiornate.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI
  10679.                                         + " -> " + tr.getNome() +" -> "+ PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_APPLICABILITA);
  10680.                                
  10681.                                 sbMsg.append(DBOggettiInUsoUtils.formatList(titoliSezioniAggiornate, org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE));
  10682.                                 messaggiSezioniConnettore.add(sbMsg.toString());
  10683.                                 connettoreUtilizzatiConfig = true;
  10684.                                
  10685.                                 break;
  10686.                             }  
  10687.                         }
  10688.                     }
  10689.                     break;
  10690.                 }
  10691.             }
  10692.         }  
  10693.                    
  10694.         return connettoreUtilizzatiConfig;      
  10695.                    
  10696.     }
  10697.    
  10698.    
  10699.     public List<DataElement> addConnettoriMultipliNotificheToDati(List<DataElement> dati, TipoOperazione tipoOp,
  10700.             TipoBehaviour beaBehaviourType, String nomeSAConnettore, ServiceBinding serviceBinding, String cadenzaRispedizione,
  10701.             String codiceRisposta2xx, String codiceRisposta2xxValueMin, String codiceRisposta2xxValueMax, String codiceRisposta2xxValue,
  10702.             String codiceRisposta3xx, String codiceRisposta3xxValueMin, String codiceRisposta3xxValueMax, String codiceRisposta3xxValue,
  10703.             String codiceRisposta4xx, String codiceRisposta4xxValueMin, String codiceRisposta4xxValueMax, String codiceRisposta4xxValue,
  10704.             String codiceRisposta5xx, String codiceRisposta5xxValueMin, String codiceRisposta5xxValueMax, String codiceRisposta5xxValue,
  10705.             String gestioneFault, String faultCode, String faultActor, String faultMessage,
  10706.             boolean consegnaSincrona,
  10707.             String coda, String priorita, String prioritaMax,
  10708.             String connettoreTipoMessaggioDaNotificare, String connettoreIniettaContestoSincrono, String httpMethodDaNotificare
  10709.     ) {
  10710.        
  10711.         DataElement de = new DataElement();
  10712.         de.setLabel("");
  10713.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOME_SA);
  10714.         de.setType(DataElementType.HIDDEN);
  10715.         de.setValue(nomeSAConnettore);
  10716.         dati.add(de);
  10717.                
  10718.        
  10719.         if(!consegnaSincrona && TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(beaBehaviourType)) {
  10720.                        
  10721.             de = new DataElement();
  10722.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_CONSEGNA_NOTIFICA_MODALITA);
  10723.             de.setType(DataElementType.TITLE);
  10724.             dati.add(de);
  10725.            
  10726.             // tipo di notifica
  10727.             de = new DataElement();
  10728.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TIPO_MESSAGGIO_DA_NOTIFICARE);
  10729.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TIPO_MESSAGGIO_DA_NOTIFICARE);
  10730.             de.setType(DataElementType.SELECT);
  10731.             de.setValues(PorteApplicativeCostanti.VALORI_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_DA_NOTIFICARE);
  10732.             de.setLabels(PorteApplicativeCostanti.VALORI_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_DA_NOTIFICARE);
  10733.             de.setSelected(connettoreTipoMessaggioDaNotificare);
  10734.             de.setPostBack(true);
  10735.             dati.add(de);
  10736.                        
  10737.             // http notifica
  10738.             if(ServiceBinding.REST.equals(serviceBinding) ||
  10739.                     (connettoreTipoMessaggioDaNotificare!=null && MessaggioDaNotificare.ENTRAMBI.equals(connettoreTipoMessaggioDaNotificare))
  10740.                 ) {
  10741.                 de = new DataElement();
  10742.                 de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TIPO_HTTP_NOTIFICA);
  10743.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TIPO_HTTP_NOTIFICA);
  10744.                 de.setType(DataElementType.SELECT);
  10745.                 if(connettoreTipoMessaggioDaNotificare!=null && MessaggioDaNotificare.RICHIESTA.equals(connettoreTipoMessaggioDaNotificare)) {
  10746.                     de.setValues(PorteApplicativeCostanti.VALORI_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_HTTP_NOTIFICA_RICHIESTA);
  10747.                     de.setLabels(PorteApplicativeCostanti.LABELS_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_HTTP_NOTIFICA_RICHIESTA);
  10748.                 }
  10749.                 else {
  10750.                     de.setValues(PorteApplicativeCostanti.VALORI_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_HTTP_NOTIFICA);
  10751.                     de.setLabels(PorteApplicativeCostanti.VALORI_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_HTTP_NOTIFICA);
  10752.                 }
  10753.                 de.setSelected(httpMethodDaNotificare);
  10754.                 de.setPostBack(false);
  10755.                 dati.add(de);
  10756.             }
  10757.            
  10758.             // contesto sincrono
  10759.             de = new DataElement();
  10760.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_INIETTA_CONTESTO_SINCRONO);
  10761.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_INIETTA_CONTESTO_SINCRONO);
  10762.             de.setType(DataElementType.CHECKBOX);
  10763.             de.setSelected(connettoreIniettaContestoSincrono);
  10764.             dati.add(de);
  10765.            
  10766.         }
  10767.        
  10768.         if(!consegnaSincrona) {
  10769.             de = new DataElement();
  10770.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_PRIORITA_CONSEGNA_NOTIFICA);
  10771.             de.setType(DataElementType.TITLE);
  10772.             dati.add(de);
  10773.         }
  10774.                
  10775.         // Coda
  10776.         de = new DataElement();
  10777.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODA);
  10778.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODA);
  10779.         if(consegnaSincrona) {
  10780.             de.setType(DataElementType.HIDDEN);
  10781.         }
  10782.         else {
  10783.             List<String> code = this.porteApplicativeCore.getConsegnaNotificaCode();
  10784.             if(code==null || code.size()<=1) {
  10785.                 de.setType(DataElementType.HIDDEN);
  10786.             }
  10787.             else {
  10788.                 de.setType(DataElementType.SELECT);
  10789.                 de.setValues(code);
  10790.                 List<String> labels = new ArrayList<>();
  10791.                 for (String codaNome : code) {
  10792.                     labels.add(this.porteApplicativeCore.getConsegnaNotificaCodaLabel(codaNome));
  10793.                 }
  10794.                 de.setLabels(labels);
  10795.                 de.setSelected(coda);
  10796.             }
  10797.         }
  10798.         de.setValue(coda);
  10799.         dati.add(de);
  10800.        
  10801.         // Priorita
  10802.         de = new DataElement();
  10803.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA);
  10804.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA);
  10805.         if(consegnaSincrona) {
  10806.             de.setType(DataElementType.HIDDEN);
  10807.         }
  10808.         else {
  10809.             if(ServletUtils.isCheckBoxEnabled(prioritaMax)) {
  10810.                 de.setType(DataElementType.HIDDEN);
  10811.                
  10812.                 DataElement deLABEL = new DataElement();
  10813.                 deLABEL.setType(DataElementType.TEXT);
  10814.                 deLABEL.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  10815.                 deLABEL.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA);
  10816.                 deLABEL.setValue(this.porteApplicativeCore.getConsegnaNotificaConfigurazionePriorita(priorita).getLabel());
  10817.                 dati.add(deLABEL);
  10818.                
  10819.             }
  10820.             else {
  10821.                 List<String> prioritaList = this.porteApplicativeCore.getConsegnaNotificaPriorita();
  10822.                 de.setType(DataElementType.SELECT);
  10823.                 de.setValues(prioritaList);
  10824.                 List<String> labels = new ArrayList<>();
  10825.                 List<String> listPriorita = new ArrayList<>();
  10826.                 for (String prioritaNome : prioritaList) {
  10827.                     ConfigurazionePriorita conf = this.porteApplicativeCore.getConsegnaNotificaConfigurazionePriorita(prioritaNome);
  10828.                     labels.add(conf.getLabel());
  10829.                     if(conf.isNessunaPriorita()) {
  10830.                         listPriorita.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_INFO_NESSUNA_PRIORITA.
  10831.                                 replace(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_LABEL, conf.getLabel()));
  10832.                     }
  10833.                     else {
  10834.                         listPriorita.add(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_INFO_PRIORITA.
  10835.                                 replace(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_LABEL, conf.getLabel()).
  10836.                                 replace(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_PERCENTUALE, conf.getPercentuale()+""));
  10837.                     }
  10838.                 }
  10839.                 de.setLabels(labels);
  10840.                 de.setSelected(priorita);
  10841.                 DataElementInfo deInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA);
  10842.                 deInfo.setListBody(listPriorita);
  10843.                 de.setInfo(deInfo);
  10844.             }
  10845.         }
  10846.         de.setValue(priorita);
  10847.         dati.add(de);
  10848.        
  10849.        
  10850.         // Priorita Max
  10851.         de = new DataElement();
  10852.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX);
  10853.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_LEFT);
  10854.         if(consegnaSincrona) {
  10855.             de.setType(DataElementType.HIDDEN);
  10856.         }
  10857.         else {
  10858.             de.setType(DataElementType.CHECKBOX);
  10859.             de.setPostBack(true);
  10860.             de.setSelected(ServletUtils.isCheckBoxEnabled(prioritaMax));
  10861.             de.setLabelRight(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_RIGHT);
  10862.             de.setLabelAffiancata(false);
  10863.             de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_NOTE);
  10864.             DataElementInfo deInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_LEFT);
  10865.             deInfo.setBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PRIORITA_MAX_INFO);
  10866.             de.setInfo(deInfo);
  10867.         }
  10868.         de.setValue(priorita);
  10869.         dati.add(de);
  10870.        
  10871.        
  10872.        
  10873.        
  10874.         de = new DataElement();
  10875.         if(consegnaSincrona) {
  10876.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_CONSEGNA);
  10877.         }
  10878.         else {
  10879.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_REGOLE_CONSEGNA_NOTIFICA);
  10880.         }
  10881.         de.setType(DataElementType.TITLE);
  10882.         dati.add(de);
  10883.        
  10884.        
  10885.        
  10886.        
  10887.         String consegnaNotificheLabel = "";
  10888.         try{
  10889.             ConfigurazioneGestioneConsegnaNotifiche nuovaConfigurazioneGestioneConsegnaNotifiche  = this.getConfigurazioneGestioneConsegnaNotifiche(beaBehaviourType, serviceBinding, cadenzaRispedizione,
  10890.                     codiceRisposta2xx, codiceRisposta2xxValueMin, codiceRisposta2xxValueMax, codiceRisposta2xxValue,
  10891.                     codiceRisposta3xx, codiceRisposta3xxValueMin, codiceRisposta3xxValueMax, codiceRisposta3xxValue,
  10892.                     codiceRisposta4xx, codiceRisposta4xxValueMin, codiceRisposta4xxValueMax, codiceRisposta4xxValue,
  10893.                     codiceRisposta5xx, codiceRisposta5xxValueMin, codiceRisposta5xxValueMax, codiceRisposta5xxValue,
  10894.                     gestioneFault, faultCode, faultActor, faultMessage,
  10895.                     consegnaSincrona,
  10896.                     connettoreTipoMessaggioDaNotificare, connettoreIniettaContestoSincrono, httpMethodDaNotificare);
  10897.             if(nuovaConfigurazioneGestioneConsegnaNotifiche != null) {
  10898.                 consegnaNotificheLabel = org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.GestioneConsegnaNotificheUtils.toString(nuovaConfigurazioneGestioneConsegnaNotifiche,
  10899.                         serviceBinding.equals(ServiceBinding.SOAP));
  10900.             }
  10901.         }catch(Exception e) {
  10902.             // nel caso non siano forniti alcuni valori va in errore...
  10903.             // lascio a debug e non verra' presentata la label
  10904.             this.log.debug(e.getMessage(),e);  
  10905.         }
  10906.         if(StringUtils.isNotEmpty(consegnaNotificheLabel)) {
  10907.             DataElement deLABEL = new DataElement();
  10908.             deLABEL.setType(DataElementType.TEXT);
  10909.             deLABEL.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_COMPORTAMENTO);
  10910.             deLABEL.setValue(consegnaNotificheLabel);
  10911.             dati.add(deLABEL);
  10912.         }
  10913.        
  10914.                
  10915.        
  10916.         // subtitolo Codice Risposta HTTP
  10917.         de = new DataElement();
  10918.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP);
  10919.         de.setType(DataElementType.SUBTITLE);
  10920.         dati.add(de);
  10921.        
  10922.        
  10923.         String [] codificaRispostaValues = {
  10924.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getValue(),
  10925.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CONSEGNA_COMPLETATA.getValue(),
  10926.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CONSEGNA_FALLITA.getValue(),
  10927.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getValue()
  10928.         };
  10929.         String [] codificaRispostaLabels = {
  10930.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getLabel(),
  10931.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CONSEGNA_COMPLETATA.getLabel(),
  10932.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CONSEGNA_FALLITA.getLabel(),
  10933.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getLabel()
  10934.         };
  10935.        
  10936.         // selectList 2xx
  10937.         de = new DataElement();
  10938.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX);
  10939.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX );
  10940.         de.setType(DataElementType.SELECT);
  10941.         de.setValues(codificaRispostaValues);
  10942.         de.setLabels(codificaRispostaLabels);
  10943.         de.setSelected(codiceRisposta2xx);
  10944.         de.setPostBack(true);
  10945.         dati.add(de);
  10946.        
  10947.         // intervallo consegna
  10948.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta2xx)) {
  10949.             de = new DataElement();
  10950.             de.setType(DataElementType.INTERVAL_NUMBER);
  10951.             de.setLabel("&nbsp;");
  10952.             de.setValues(Arrays.asList(codiceRisposta2xxValueMin, codiceRisposta2xxValueMax));
  10953.             de.setNames(Arrays.asList(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_VALUE_MIN,
  10954.                     PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_VALUE_MAX));
  10955.             de.setMinValue(200);
  10956.             de.setMaxValue(299);
  10957.             de.setSize(getSize());
  10958.             de.reloadMinValue(false);
  10959.             de.setRequired(true);
  10960.             dati.add(de);
  10961.         }
  10962.         // Codici Consegna
  10963.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta2xx)) {
  10964.             de = new DataElement();
  10965.             de.setType(DataElementType.TEXT_EDIT);
  10966.             de.setLabel("&nbsp;");
  10967.             de.setValue(codiceRisposta2xxValue);
  10968.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_VALUE);
  10969.             de.setSize(getSize());
  10970.             de.setRequired(true);
  10971.             dati.add(de);
  10972.         }
  10973.        
  10974.         // selectList 3xx
  10975.         de = new DataElement();
  10976.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX);
  10977.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX );
  10978.         if(ServiceBinding.REST.equals(serviceBinding)){
  10979.             de.setType(DataElementType.SELECT);
  10980.             de.setValues(codificaRispostaValues);
  10981.             de.setLabels(codificaRispostaLabels);
  10982.             de.setSelected(codiceRisposta3xx);
  10983.             de.setPostBack(true);
  10984.         }
  10985.         else {
  10986.             de.setType(DataElementType.HIDDEN);
  10987.             de.setValue(codiceRisposta3xx);
  10988.         }
  10989.         dati.add(de);
  10990.        
  10991.         // intervallo consegna
  10992.         if(ServiceBinding.REST.equals(serviceBinding) && org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta3xx)) {
  10993.             de = new DataElement();
  10994.             de.setType(DataElementType.INTERVAL_NUMBER);
  10995.             de.setLabel("&nbsp;");
  10996.             de.setValues(Arrays.asList(codiceRisposta3xxValueMin, codiceRisposta3xxValueMax));
  10997.             de.setNames(Arrays.asList(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX_VALUE_MIN,
  10998.                     PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX_VALUE_MAX));
  10999.             de.setMinValue(300);
  11000.             de.setMaxValue(399);
  11001.             de.setSize(getSize());
  11002.             de.reloadMinValue(false);
  11003.             de.setRequired(true);
  11004.             dati.add(de);
  11005.         }
  11006.         // Codici Consegna
  11007.         if(ServiceBinding.REST.equals(serviceBinding) && org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta3xx)) {
  11008.             de = new DataElement();
  11009.             de.setType(DataElementType.TEXT_EDIT);
  11010.             de.setLabel("&nbsp;");
  11011.             de.setValue(codiceRisposta3xxValue);
  11012.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX_VALUE);
  11013.             de.setSize(getSize());
  11014.             de.setRequired(true);
  11015.             dati.add(de);
  11016.         }
  11017.        
  11018.         // selectList 4xx
  11019.         de = new DataElement();
  11020.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX);
  11021.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX );
  11022.         de.setType(DataElementType.SELECT);
  11023.         de.setValues(codificaRispostaValues);
  11024.         de.setLabels(codificaRispostaLabels);
  11025.         de.setSelected(codiceRisposta4xx);
  11026.         de.setPostBack(true);
  11027.         dati.add(de);
  11028.        
  11029.         // intervallo consegna
  11030.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta4xx)) {
  11031.             de = new DataElement();
  11032.             de.setType(DataElementType.INTERVAL_NUMBER);
  11033.             de.setLabel("&nbsp;");
  11034.             de.setValues(Arrays.asList(codiceRisposta4xxValueMin, codiceRisposta4xxValueMax));
  11035.             de.setNames(Arrays.asList(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX_VALUE_MIN,
  11036.                     PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX_VALUE_MAX));
  11037.             de.setMinValue(400);
  11038.             de.setMaxValue(499);
  11039.             de.setSize(getSize());
  11040.             de.reloadMinValue(false);
  11041.             de.setRequired(true);
  11042.             dati.add(de);
  11043.         }
  11044.         // Codici Consegna
  11045.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta4xx)) {
  11046.             de = new DataElement();
  11047.             de.setType(DataElementType.TEXT_EDIT);
  11048.             de.setLabel("&nbsp;");
  11049.             de.setValue(codiceRisposta4xxValue);
  11050.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX_VALUE);
  11051.             de.setSize(getSize());
  11052.             de.setRequired(true);
  11053.             dati.add(de);
  11054.         }
  11055.        
  11056.         // selectList 5xx
  11057.         de = new DataElement();
  11058.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX);
  11059.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX );
  11060.         de.setType(DataElementType.SELECT);
  11061.         de.setValues(codificaRispostaValues);
  11062.         de.setLabels(codificaRispostaLabels);
  11063.         de.setSelected(codiceRisposta5xx);
  11064.         de.setPostBack(true);
  11065.         dati.add(de);
  11066.        
  11067.         // intervallo consegna
  11068.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.INTERVALLO_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta5xx)) {
  11069.             de = new DataElement();
  11070.             de.setType(DataElementType.INTERVAL_NUMBER);
  11071.             de.setLabel("&nbsp;");
  11072.             de.setValues(Arrays.asList(codiceRisposta5xxValueMin, codiceRisposta5xxValueMax));
  11073.             de.setNames(Arrays.asList(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX_VALUE_MIN,
  11074.                     PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX_VALUE_MAX));
  11075.             de.setMinValue(500);
  11076.             de.setMaxValue(599);
  11077.             de.setSize(getSize());
  11078.             de.reloadMinValue(false);
  11079.             de.setRequired(true);
  11080.             dati.add(de);
  11081.         }
  11082.         // Codici Consegna
  11083.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaTrasporto.CODICI_CONSEGNA_COMPLETATA.getValue().equals(codiceRisposta5xx)) {
  11084.             de = new DataElement();
  11085.             de.setType(DataElementType.TEXT_EDIT);
  11086.             de.setLabel("&nbsp;");
  11087.             de.setValue(codiceRisposta5xxValue);
  11088.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX_VALUE);
  11089.             de.setSize(getSize());
  11090.             de.setRequired(true);
  11091.             dati.add(de);
  11092.         }
  11093.        
  11094.         String [] gestioneValues = {
  11095.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA.getValue(),
  11096.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA.getValue(),
  11097.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA_PERSONALIZZATA.getValue(),
  11098.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA_PERSONALIZZATA.getValue()
  11099.         };
  11100.         String [] gestioneLabels = {
  11101.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA.getLabel(),
  11102.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA.getLabel(),
  11103.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA_PERSONALIZZATA.getLabel(),
  11104.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA_PERSONALIZZATA.getLabel()
  11105.         };
  11106.        
  11107.         de = new DataElement();
  11108.         if(serviceBinding.equals(ServiceBinding.SOAP)) { // label SOAP Fault
  11109.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_SOAP_FAULT);
  11110.         } else {  // label Problem
  11111.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PROBLEM_DETAIL);
  11112.         }
  11113.         de.setType(DataElementType.SUBTITLE);
  11114.         dati.add(de);
  11115.        
  11116.         // SelectList scelta tipogestione notifica
  11117.         de = new DataElement();
  11118.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_GESTIONE);
  11119.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_GESTIONE );
  11120.         de.setType(DataElementType.SELECT);
  11121.         de.setValues(gestioneValues);
  11122.         de.setLabels(gestioneLabels);
  11123.         de.setSelected(gestioneFault);
  11124.         de.setPostBack(true);
  11125.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA_PERSONALIZZATA.getValue().equals(gestioneFault) ||
  11126.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA_PERSONALIZZATA.getValue().equals(gestioneFault)) {
  11127.             StringBuilder sb = new StringBuilder();
  11128.            
  11129.             sb.append("'");
  11130.             sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE :
  11131.                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE);
  11132.             sb.append("', '");
  11133.            
  11134.             sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR :
  11135.                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS);
  11136.            
  11137.             sb.append("' o '");
  11138.            
  11139.             sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE :
  11140.                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS);
  11141.            
  11142.             sb.append("'");
  11143.            
  11144.             de.setNote(MessageFormat.format(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_GESTIONE_CUSTOM_NOTE,  sb.toString()));
  11145.         }
  11146.         dati.add(de);
  11147.        
  11148.         if(org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_COMPLETATA_PERSONALIZZATA.getValue().equals(gestioneFault) ||
  11149.                 org.openspcoop2.pdd.core.behaviour.built_in.multi_deliver.TipoGestioneNotificaFault.CONSEGNA_FALLITA_PERSONALIZZATA.getValue().equals(gestioneFault)) {
  11150.             //code
  11151.             de = new DataElement();
  11152.             de.setType(DataElementType.TEXT_EDIT);
  11153.             DataElementInfo dInfo = null;
  11154.             if(serviceBinding.equals(ServiceBinding.SOAP)) { // SOAP : Code
  11155.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE);
  11156.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE);
  11157.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE_INFO_HEADER);
  11158.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE_INFO_LIST);
  11159.             } else { // REST: Type
  11160.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS);
  11161.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS);
  11162.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE_INFO_HEADER);
  11163.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE_INFO_LIST);
  11164.             }
  11165.             de.setValue(faultCode);
  11166.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE);
  11167.             de.setSize(getSize());
  11168.             de.setInfo(dInfo);
  11169.             dati.add(de);
  11170.            
  11171.            
  11172.             // actor
  11173.             de = new DataElement();
  11174.             de.setType(DataElementType.TEXT_EDIT);
  11175.             if(serviceBinding.equals(ServiceBinding.SOAP)) { // SOAP: Actor
  11176.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR);
  11177.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR);
  11178.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR_INFO_HEADER);
  11179.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR_INFO_LIST);
  11180.             } else { // REST: Status
  11181.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE);
  11182.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE);
  11183.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS_INFO_HEADER);
  11184.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS_INFO_LIST);
  11185.             }
  11186.             de.setValue(faultActor);
  11187.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR);
  11188.             de.setSize(getSize());
  11189.             de.setInfo(dInfo);
  11190.             dati.add(de);
  11191.            
  11192.            
  11193.             // message
  11194.             de = new DataElement();
  11195.             if(serviceBinding.equals(ServiceBinding.SOAP)) { // SOAP: Messagge
  11196.                 de.setType(DataElementType.TEXT_EDIT);
  11197.                 de.setSize(getSize());
  11198.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE);
  11199.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE);
  11200.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE_INFO_HEADER);
  11201.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE_INFO_LIST);
  11202.             } else { // REST: Claims
  11203.                 de.setType(DataElementType.TEXT_AREA);
  11204.                 de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS);
  11205.                 de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS_NOTE);
  11206.                 dInfo = new DataElementInfo(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS);
  11207.                 dInfo.setHeaderBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS_NOTE);
  11208.                 //dInfo.setListBody(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS_INFO_LIST);
  11209.             }
  11210.            
  11211.             de.setValue(faultMessage);
  11212.             de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE);
  11213.             de.setInfo(dInfo);
  11214.             dati.add(de);
  11215.         }
  11216.        
  11217.        
  11218.        
  11219.         if(!consegnaSincrona) {
  11220.             de = new DataElement();
  11221.             de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONSEGNA_FALLITA);
  11222.             de.setType(DataElementType.SUBTITLE);
  11223.             dati.add(de);
  11224.         }
  11225.        
  11226.         // cadenza rispedizione
  11227.         de = new DataElement();
  11228.         de.setLabel(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE);
  11229.         de.setName(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE );
  11230.         if(consegnaSincrona) {
  11231.             de.setType(DataElementType.HIDDEN);
  11232.         }
  11233.         else {
  11234.             de.setNote(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE_NOTE);
  11235.             de.setType(DataElementType.NUMBER);
  11236.             de.setMinValue(0);
  11237.             de.reloadMinValue(false);
  11238.         }
  11239.         de.setValue(cadenzaRispedizione);
  11240.         dati.add(de);
  11241.        
  11242.         return dati;
  11243.     }
  11244.    
  11245.     public ConfigurazioneGestioneConsegnaNotifiche getConfigurazioneGestioneConsegnaNotifiche(TipoBehaviour beaBehaviourType, ServiceBinding serviceBinding, String cadenzaRispedizione,
  11246.             String codiceRisposta2xx, String codiceRisposta2xxValueMin, String codiceRisposta2xxValueMax, String codiceRisposta2xxValue,
  11247.             String codiceRisposta3xx, String codiceRisposta3xxValueMin, String codiceRisposta3xxValueMax, String codiceRisposta3xxValue,
  11248.             String codiceRisposta4xx, String codiceRisposta4xxValueMin, String codiceRisposta4xxValueMax, String codiceRisposta4xxValue,
  11249.             String codiceRisposta5xx, String codiceRisposta5xxValueMin, String codiceRisposta5xxValueMax, String codiceRisposta5xxValue,
  11250.             String gestioneFault, String faultCode, String faultActor, String faultMessage,
  11251.             boolean consegnaSincrona,
  11252.             String connettoreTipoMessaggioDaNotificare, String connettoreIniettaContestoSincrono, String httpMethodDaNotificare) throws Exception {
  11253.        
  11254.         ConfigurazioneGestioneConsegnaNotifiche configurazioneGestioneConsegnaNotifiche = new ConfigurazioneGestioneConsegnaNotifiche();
  11255.        
  11256.         if(TipoBehaviour.CONSEGNA_CON_NOTIFICHE.equals(beaBehaviourType) && !consegnaSincrona) {
  11257.             MessaggioDaNotificare tipo = null;
  11258.             if(connettoreTipoMessaggioDaNotificare!=null) {
  11259.                 tipo = MessaggioDaNotificare.toEnumConstant(connettoreTipoMessaggioDaNotificare, false);
  11260.             }
  11261.             configurazioneGestioneConsegnaNotifiche.setMessaggioDaNotificare(tipo);
  11262.            
  11263.             configurazioneGestioneConsegnaNotifiche.setInjectTransactionSyncContext(ServletUtils.isCheckBoxEnabled(connettoreIniettaContestoSincrono));
  11264.            
  11265.             HttpRequestMethod tipoHttp = null;
  11266.             if(httpMethodDaNotificare!=null && !PorteApplicativeCostanti.VALORE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONNETTORE_MESSAGGIO_HTTP_NOTIFICA_USA_QUELLO_DELLA_RICHIESTA.equals(httpMethodDaNotificare)) {
  11267.                 try {
  11268.                     tipoHttp = HttpRequestMethod.valueOf(httpMethodDaNotificare);
  11269.                 }catch(Throwable t) {}
  11270.             }
  11271.             configurazioneGestioneConsegnaNotifiche.setHttpMethod(tipoHttp);
  11272.         }
  11273.        
  11274.         if(StringUtils.isNotEmpty(cadenzaRispedizione)) {
  11275.             configurazioneGestioneConsegnaNotifiche.setCadenzaRispedizione(Integer.parseInt(cadenzaRispedizione));
  11276.         }
  11277.        
  11278.         // 2xx
  11279.         TipoGestioneNotificaTrasporto gestioneTrasporto2xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta2xx);
  11280.         switch(gestioneTrasporto2xx) {
  11281.         case CODICI_CONSEGNA_COMPLETATA:
  11282.             List<String> codiceRisposta2xxValues = Arrays.asList(codiceRisposta2xxValue.split(","));
  11283.             List<Integer> gestioneTrasporto2xx_codes = new ArrayList<Integer>();
  11284.            
  11285.             for (String code : codiceRisposta2xxValues) {
  11286.                 gestioneTrasporto2xx_codes.add(Integer.parseInt(code));
  11287.             }
  11288.            
  11289.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto2xx_codes(gestioneTrasporto2xx_codes );
  11290.             break;
  11291.         case INTERVALLO_CONSEGNA_COMPLETATA:
  11292.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto2xx_leftInterval(Integer.parseInt(codiceRisposta2xxValueMin));
  11293.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto2xx_rightInterval(Integer.parseInt(codiceRisposta2xxValueMax));
  11294.             break;
  11295.         case CONSEGNA_COMPLETATA:
  11296.         case CONSEGNA_FALLITA:
  11297.             break;      
  11298.         }
  11299.        
  11300.         configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto2xx(gestioneTrasporto2xx);
  11301.        
  11302.         // 3xx
  11303.         TipoGestioneNotificaTrasporto gestioneTrasporto3xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta3xx);
  11304.         switch(gestioneTrasporto3xx) {
  11305.         case CODICI_CONSEGNA_COMPLETATA:
  11306.             List<String> codiceRisposta3xxValues = Arrays.asList(codiceRisposta3xxValue.split(","));
  11307.             List<Integer> gestioneTrasporto3xx_codes = new ArrayList<Integer>();
  11308.            
  11309.             for (String code : codiceRisposta3xxValues) {
  11310.                 gestioneTrasporto3xx_codes.add(Integer.parseInt(code));
  11311.             }
  11312.            
  11313.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto3xx_codes(gestioneTrasporto3xx_codes );
  11314.             break;
  11315.         case INTERVALLO_CONSEGNA_COMPLETATA:
  11316.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto3xx_leftInterval(Integer.parseInt(codiceRisposta3xxValueMin));
  11317.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto3xx_rightInterval(Integer.parseInt(codiceRisposta3xxValueMax));
  11318.             break;
  11319.         case CONSEGNA_COMPLETATA:
  11320.         case CONSEGNA_FALLITA:
  11321.             break;      
  11322.         }
  11323.        
  11324.         configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto3xx(gestioneTrasporto3xx);
  11325.        
  11326.         // 4xx
  11327.         TipoGestioneNotificaTrasporto gestioneTrasporto4xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta4xx);
  11328.         switch(gestioneTrasporto4xx) {
  11329.         case CODICI_CONSEGNA_COMPLETATA:
  11330.             List<String> codiceRisposta4xxValues = Arrays.asList(codiceRisposta4xxValue.split(","));
  11331.             List<Integer> gestioneTrasporto4xx_codes = new ArrayList<Integer>();
  11332.            
  11333.             for (String code : codiceRisposta4xxValues) {
  11334.                 gestioneTrasporto4xx_codes.add(Integer.parseInt(code));
  11335.             }
  11336.            
  11337.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto4xx_codes(gestioneTrasporto4xx_codes );
  11338.             break;
  11339.         case INTERVALLO_CONSEGNA_COMPLETATA:
  11340.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto4xx_leftInterval(Integer.parseInt(codiceRisposta4xxValueMin));
  11341.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto4xx_rightInterval(Integer.parseInt(codiceRisposta4xxValueMax));
  11342.             break;
  11343.         case CONSEGNA_COMPLETATA:
  11344.         case CONSEGNA_FALLITA:
  11345.             break;      
  11346.         }
  11347.        
  11348.         configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto4xx(gestioneTrasporto4xx);
  11349.        
  11350.         // 5xx
  11351.         TipoGestioneNotificaTrasporto gestioneTrasporto5xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta5xx);
  11352.         switch(gestioneTrasporto5xx) {
  11353.         case CODICI_CONSEGNA_COMPLETATA:
  11354.             List<String> codiceRisposta5xxValues = Arrays.asList(codiceRisposta5xxValue.split(","));
  11355.             List<Integer> gestioneTrasporto5xx_codes = new ArrayList<Integer>();
  11356.            
  11357.             for (String code : codiceRisposta5xxValues) {
  11358.                 gestioneTrasporto5xx_codes.add(Integer.parseInt(code));
  11359.             }
  11360.            
  11361.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto5xx_codes(gestioneTrasporto5xx_codes );
  11362.             break;
  11363.         case INTERVALLO_CONSEGNA_COMPLETATA:
  11364.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto5xx_leftInterval(Integer.parseInt(codiceRisposta5xxValueMin));
  11365.             configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto5xx_rightInterval(Integer.parseInt(codiceRisposta5xxValueMax));
  11366.             break;
  11367.         case CONSEGNA_COMPLETATA:
  11368.         case CONSEGNA_FALLITA:
  11369.             break;      
  11370.         }
  11371.        
  11372.         configurazioneGestioneConsegnaNotifiche.setGestioneTrasporto5xx(gestioneTrasporto5xx);
  11373.        
  11374.         TipoGestioneNotificaFault fault = TipoGestioneNotificaFault.toEnumConstant(gestioneFault);
  11375.         switch(fault) {
  11376.         case CONSEGNA_COMPLETATA:
  11377.         case CONSEGNA_FALLITA:
  11378.             break;
  11379.         case CONSEGNA_COMPLETATA_PERSONALIZZATA:
  11380.         case CONSEGNA_FALLITA_PERSONALIZZATA:
  11381.             configurazioneGestioneConsegnaNotifiche.setFaultCode(faultCode);
  11382.             configurazioneGestioneConsegnaNotifiche.setFaultActor(faultActor);
  11383.             configurazioneGestioneConsegnaNotifiche.setFaultMessage(faultMessage);
  11384.             break;
  11385.         }
  11386.        
  11387.         configurazioneGestioneConsegnaNotifiche.setFault(fault);
  11388.        
  11389.         return configurazioneGestioneConsegnaNotifiche;
  11390.     }
  11391.    
  11392.    
  11393.     public boolean connettoriMultipliNotificheCheckData(TipoOperazione tipoOp, PortaApplicativa pa , TipoBehaviour beaBehaviourType, ServiceBinding serviceBinding, String nomeSAConnettore, String cadenzaRispedizione,
  11394.             String codiceRisposta2xx, String codiceRisposta2xxValueMin, String codiceRisposta2xxValueMax, String codiceRisposta2xxValue,
  11395.             String codiceRisposta3xx, String codiceRisposta3xxValueMin, String codiceRisposta3xxValueMax, String codiceRisposta3xxValue,
  11396.             String codiceRisposta4xx, String codiceRisposta4xxValueMin, String codiceRisposta4xxValueMax, String codiceRisposta4xxValue,
  11397.             String codiceRisposta5xx, String codiceRisposta5xxValueMin, String codiceRisposta5xxValueMax, String codiceRisposta5xxValue,
  11398.             String gestioneFault, String faultCode, String faultActor, String faultMessage) throws Exception{
  11399.         try{
  11400.            
  11401.             if(!StringUtils.isEmpty(cadenzaRispedizione)) {
  11402. //              this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11403. //                      PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE));
  11404. //              return false;
  11405.            
  11406.                 int w = -1;
  11407.                 try {
  11408.                     w = Integer.parseInt(cadenzaRispedizione);
  11409.                 }catch (Exception e) {
  11410.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11411.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE));
  11412.                     return false;
  11413.                 }
  11414.                
  11415.                 if(w < 0) {
  11416.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_MIN_XX_NON_VALIDO,
  11417.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CADENZA_RISPEDIZIONE, 0));
  11418.                     return false;
  11419.                 }
  11420.             }
  11421.            
  11422.             if(StringUtils.isEmpty(codiceRisposta2xx)) {
  11423.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11424.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11425.                 return false;
  11426.             }
  11427.            
  11428.             boolean almenoUnaConsegnaCompletata = false;
  11429.            
  11430.             // 2xx
  11431.             TipoGestioneNotificaTrasporto gestioneTrasporto2xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta2xx);
  11432.             switch(gestioneTrasporto2xx) {
  11433.             case CODICI_CONSEGNA_COMPLETATA:
  11434.                 almenoUnaConsegnaCompletata=true;
  11435.                 if(StringUtils.isEmpty(codiceRisposta2xxValue)) {
  11436.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11437.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11438.                     return false;
  11439.                 }
  11440.                
  11441.                 if(!StringUtils.containsOnly(codiceRisposta2xxValue, PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_CARATTERI_CONSENTITI)) {
  11442.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CODICI_NON_VALIDI_NEL_CAMPO_XX,
  11443.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11444.                     return false;
  11445.                 }
  11446.                
  11447.                 List<String> codiceRisposta2xxValues = Arrays.asList(codiceRisposta2xxValue.split(","));
  11448.                
  11449.                 for (String code : codiceRisposta2xxValues) {
  11450.                     try {
  11451.                         int val = Integer.parseInt(code);
  11452.                        
  11453.                         if(val < 200 || val > 299) {
  11454.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_CODICE_MIN_MAX_XX_NON_VALIDO,
  11455.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX, 200, 299));
  11456.                             return false;
  11457.                         }
  11458.                     }catch (Exception e) {
  11459.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11460.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11461.                         return false;
  11462.                     }
  11463.                 }
  11464.                 break;
  11465.             case INTERVALLO_CONSEGNA_COMPLETATA:
  11466.                 almenoUnaConsegnaCompletata=true;
  11467.                 if(StringUtils.isEmpty(codiceRisposta2xxValueMin)) {
  11468.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11469.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11470.                     return false;
  11471.                 }
  11472.                 try {
  11473.                     Integer.parseInt(codiceRisposta2xxValueMin);
  11474.                 }catch (Exception e) {
  11475.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11476.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11477.                     return false;
  11478.                 }
  11479.                
  11480.                 if(StringUtils.isEmpty(codiceRisposta2xxValueMax)) {
  11481.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11482.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11483.                     return false;
  11484.                 }
  11485.                 try {
  11486.                     Integer.parseInt(codiceRisposta2xxValueMax);
  11487.                 }catch (Exception e) {
  11488.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11489.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX));
  11490.                     return false;
  11491.                 }
  11492.                 break;
  11493.             case CONSEGNA_COMPLETATA:
  11494.                 almenoUnaConsegnaCompletata=true;
  11495.                 break;  
  11496.             case CONSEGNA_FALLITA:
  11497.                 break;      
  11498.             }
  11499.            
  11500.             if(StringUtils.isEmpty(codiceRisposta3xx)) {
  11501.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11502.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11503.                 return false;
  11504.             }
  11505.            
  11506.             // 3xx
  11507.             TipoGestioneNotificaTrasporto gestioneTrasporto3xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta3xx);
  11508.             switch(gestioneTrasporto3xx) {
  11509.             case CODICI_CONSEGNA_COMPLETATA:
  11510.                 almenoUnaConsegnaCompletata=true;
  11511.                 if(StringUtils.isEmpty(codiceRisposta3xxValue)) {
  11512.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11513.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11514.                     return false;
  11515.                 }
  11516.                
  11517.                 if(!StringUtils.containsOnly(codiceRisposta3xxValue, PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_CARATTERI_CONSENTITI)) {
  11518.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CODICI_NON_VALIDI_NEL_CAMPO_XX,
  11519.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11520.                     return false;
  11521.                 }
  11522.                
  11523.                 List<String> codiceRisposta3xxValues = Arrays.asList(codiceRisposta3xxValue.split(","));
  11524.                
  11525.                 for (String code : codiceRisposta3xxValues) {
  11526.                     try {
  11527.                         int val = Integer.parseInt(code);
  11528.                        
  11529.                         if(val < 300 || val > 399) {
  11530.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_CODICE_MIN_MAX_XX_NON_VALIDO,
  11531.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX, 300, 399));
  11532.                             return false;
  11533.                         }
  11534.                     }catch (Exception e) {
  11535.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11536.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11537.                         return false;
  11538.                     }
  11539.                 }
  11540.                
  11541.                 break;
  11542.             case INTERVALLO_CONSEGNA_COMPLETATA:
  11543.                 almenoUnaConsegnaCompletata=true;
  11544.                 if(StringUtils.isEmpty(codiceRisposta3xxValueMin)) {
  11545.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11546.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11547.                     return false;
  11548.                 }
  11549.                 try {
  11550.                     Integer.parseInt(codiceRisposta3xxValueMin);
  11551.                 }catch (Exception e) {
  11552.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11553.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11554.                     return false;
  11555.                 }
  11556.                
  11557.                 if(StringUtils.isEmpty(codiceRisposta3xxValueMax)) {
  11558.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11559.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11560.                     return false;
  11561.                 }
  11562.                 try {
  11563.                     Integer.parseInt(codiceRisposta3xxValueMax);
  11564.                 }catch (Exception e) {
  11565.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11566.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX));
  11567.                     return false;
  11568.                 }
  11569.                
  11570.                 break;
  11571.             case CONSEGNA_COMPLETATA:
  11572.                 almenoUnaConsegnaCompletata=true;
  11573.                 break;  
  11574.             case CONSEGNA_FALLITA:
  11575.                 break;      
  11576.             }
  11577.            
  11578.             if(StringUtils.isEmpty(codiceRisposta4xx)) {
  11579.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11580.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11581.                 return false;
  11582.             }
  11583.            
  11584.             // 4xx
  11585.             TipoGestioneNotificaTrasporto gestioneTrasporto4xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta4xx);
  11586.             switch(gestioneTrasporto4xx) {
  11587.             case CODICI_CONSEGNA_COMPLETATA:
  11588.                 almenoUnaConsegnaCompletata=true;
  11589.                 if(StringUtils.isEmpty(codiceRisposta4xxValue)) {
  11590.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11591.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11592.                     return false;
  11593.                 }
  11594.                
  11595.                 if(!StringUtils.containsOnly(codiceRisposta4xxValue, PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_CARATTERI_CONSENTITI)) {
  11596.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CODICI_NON_VALIDI_NEL_CAMPO_XX,
  11597.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11598.                     return false;
  11599.                 }
  11600.                
  11601.                 List<String> codiceRisposta4xxValues = Arrays.asList(codiceRisposta4xxValue.split(","));
  11602.                
  11603.                 for (String code : codiceRisposta4xxValues) {
  11604.                     try {
  11605.                         int val = Integer.parseInt(code);
  11606.                        
  11607.                         if(val < 400 || val > 499) {
  11608.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_CODICE_MIN_MAX_XX_NON_VALIDO,
  11609.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX, 400, 499));
  11610.                             return false;
  11611.                         }
  11612.                     }catch (Exception e) {
  11613.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11614.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11615.                         return false;
  11616.                     }
  11617.                 }
  11618.                
  11619.                 break;
  11620.             case INTERVALLO_CONSEGNA_COMPLETATA:
  11621.                 almenoUnaConsegnaCompletata=true;
  11622.                 if(StringUtils.isEmpty(codiceRisposta4xxValueMin)) {
  11623.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11624.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11625.                     return false;
  11626.                 }
  11627.                 try {
  11628.                     Integer.parseInt(codiceRisposta4xxValueMin);
  11629.                 }catch (Exception e) {
  11630.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11631.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11632.                     return false;
  11633.                 }
  11634.                
  11635.                 if(StringUtils.isEmpty(codiceRisposta4xxValueMax)) {
  11636.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11637.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11638.                     return false;
  11639.                 }
  11640.                 try {
  11641.                     Integer.parseInt(codiceRisposta4xxValueMax);
  11642.                 }catch (Exception e) {
  11643.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11644.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX));
  11645.                     return false;
  11646.                 }
  11647.                 break;
  11648.             case CONSEGNA_COMPLETATA:
  11649.                 almenoUnaConsegnaCompletata=true;
  11650.                 break;  
  11651.             case CONSEGNA_FALLITA:
  11652.                 break;      
  11653.             }
  11654.            
  11655.             if(StringUtils.isEmpty(codiceRisposta5xx)) {
  11656.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11657.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11658.                 return false;
  11659.             }
  11660.            
  11661.             // 5xx
  11662.             TipoGestioneNotificaTrasporto gestioneTrasporto5xx = TipoGestioneNotificaTrasporto.toEnumConstant(codiceRisposta5xx);
  11663.             switch(gestioneTrasporto5xx) {
  11664.             case CODICI_CONSEGNA_COMPLETATA:
  11665.                 almenoUnaConsegnaCompletata=true;
  11666.                 if(StringUtils.isEmpty(codiceRisposta5xxValue)) {
  11667.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11668.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11669.                     return false;
  11670.                 }
  11671.                
  11672.                 if(!StringUtils.containsOnly(codiceRisposta5xxValue, PorteApplicativeCostanti.VALUE_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX_CARATTERI_CONSENTITI)) {
  11673.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_CODICI_NON_VALIDI_NEL_CAMPO_XX,
  11674.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11675.                     return false;
  11676.                 }
  11677.                
  11678.                 List<String> codiceRisposta5xxValues = Arrays.asList(codiceRisposta5xxValue.split(","));
  11679.                
  11680.                 for (String code : codiceRisposta5xxValues) {
  11681.                     try {
  11682.                         int val = Integer.parseInt(code);
  11683.                        
  11684.                         if(val < 500 || val > 599) {
  11685.                             this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_CODICE_MIN_MAX_XX_NON_VALIDO,
  11686.                                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX, 500, 599));
  11687.                             return false;
  11688.                         }
  11689.                     }catch (Exception e) {
  11690.                         this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11691.                                 PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11692.                         return false;
  11693.                     }
  11694.                 }
  11695.                
  11696.                 break;
  11697.             case INTERVALLO_CONSEGNA_COMPLETATA:
  11698.                 almenoUnaConsegnaCompletata=true;
  11699.                 if(StringUtils.isEmpty(codiceRisposta5xxValueMin)) {
  11700.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11701.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11702.                     return false;
  11703.                 }
  11704.                 try {
  11705.                     Integer.parseInt(codiceRisposta5xxValueMin);
  11706.                 }catch (Exception e) {
  11707.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11708.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11709.                     return false;
  11710.                 }
  11711.                
  11712.                 if(StringUtils.isEmpty(codiceRisposta5xxValueMax)) {
  11713.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11714.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11715.                     return false;
  11716.                 }
  11717.                 try {
  11718.                     Integer.parseInt(codiceRisposta5xxValueMax);
  11719.                 }catch (Exception e) {
  11720.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRRORE_FORMATO_NUMERICO_XX_NON_VALIDO,
  11721.                             PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX));
  11722.                     return false;
  11723.                 }
  11724.                 break;
  11725.             case CONSEGNA_COMPLETATA:
  11726.                 almenoUnaConsegnaCompletata=true;
  11727.                 break;  
  11728.             case CONSEGNA_FALLITA:
  11729.                 break;      
  11730.             }
  11731.            
  11732.             if(StringUtils.isEmpty(gestioneFault)) {
  11733.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  11734.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_GESTIONE));
  11735.                 return false;
  11736.             }
  11737.            
  11738.             TipoGestioneNotificaFault fault = TipoGestioneNotificaFault.toEnumConstant(gestioneFault);
  11739.             String tipoFaultCompletato = null;
  11740.             switch(fault) {
  11741.             case CONSEGNA_COMPLETATA:
  11742.                 almenoUnaConsegnaCompletata=true;
  11743.                 break;
  11744.             case CONSEGNA_FALLITA:
  11745.                 break;
  11746.             case CONSEGNA_COMPLETATA_PERSONALIZZATA:
  11747.             case CONSEGNA_FALLITA_PERSONALIZZATA:
  11748.                 almenoUnaConsegnaCompletata=true;
  11749.                 // almeno un elemento obbligatorio
  11750.                 if(StringUtils.isEmpty(faultCode) && StringUtils.isEmpty(faultActor) && StringUtils.isEmpty(faultMessage)) {
  11751.                     StringBuilder sb = new StringBuilder();
  11752.                    
  11753.                     sb.append("'");
  11754.                     sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE :
  11755.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE);
  11756.                     sb.append("', '");
  11757.                    
  11758.                     sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR :
  11759.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS);
  11760.                    
  11761.                     sb.append("' o '");
  11762.                    
  11763.                     sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE :
  11764.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS);
  11765.                    
  11766.                     sb.append("'");
  11767.                    
  11768.                     this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_ALMENO_UNO_TRA_XX,  sb.toString()));
  11769.                     return false;
  11770.                 }
  11771.                 if(!StringUtils.isEmpty(faultCode)) {
  11772.                     String label = serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODE :
  11773.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_TYPE;
  11774. //                  this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, label));
  11775. //                  return false;
  11776.                     tipoFaultCompletato = label;
  11777.                 }
  11778.                 if(!StringUtils.isEmpty(faultActor)) {
  11779.                     String label = serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_ACTOR :
  11780.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_STATUS;
  11781. //                  this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, label));
  11782. //                  return false;
  11783.                     if(tipoFaultCompletato!=null) {
  11784.                         tipoFaultCompletato = tipoFaultCompletato +", ";
  11785.                     }
  11786.                     else {
  11787.                         tipoFaultCompletato = "";
  11788.                     }
  11789.                     tipoFaultCompletato = tipoFaultCompletato + label;
  11790.                 }
  11791.                 if(!StringUtils.isEmpty(faultMessage)) {
  11792.                    
  11793.                     String label = serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_MESSAGE :
  11794.                         PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS;
  11795.                    
  11796.                     if(serviceBinding.equals(ServiceBinding.REST) ) {
  11797.                         Scanner scanner = new Scanner(faultMessage);
  11798.                         try {
  11799.                             while (scanner.hasNextLine()) {
  11800.                                 String line = scanner.nextLine();
  11801.                                 if(line==null || line.trim().equals("")) {
  11802.                                     continue;
  11803.                                 }
  11804.                                 if(line.contains("=")==false) {
  11805.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_TOKEN);
  11806.                                     return false;
  11807.                                 }
  11808.                             }
  11809.                         }finally {
  11810.                             scanner.close();
  11811.                         }
  11812.                        
  11813.                         if(this.checkLength(faultMessage, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CLAIMS,-1,4000)==false) {
  11814.                             return false;
  11815.                         }
  11816.                     }
  11817.                    
  11818.                     if(tipoFaultCompletato!=null) {
  11819.                         tipoFaultCompletato = tipoFaultCompletato +", ";
  11820.                     }
  11821.                     else {
  11822.                         tipoFaultCompletato = "";
  11823.                     }
  11824.                     tipoFaultCompletato = tipoFaultCompletato + label;
  11825.                 }
  11826.                
  11827.                 if(tipoFaultCompletato!=null) {
  11828.                     String prefix = "";
  11829.                     if(TipoGestioneNotificaFault.CONSEGNA_FALLITA_PERSONALIZZATA.equals(fault)) {
  11830.                         prefix = " non";
  11831.                     }
  11832.                     tipoFaultCompletato = prefix+" contenente le personalizzazioni definite per "+tipoFaultCompletato;
  11833.                 }
  11834.                 break;
  11835.             }
  11836.            
  11837.             if(!almenoUnaConsegnaCompletata) {
  11838.                
  11839.                 StringBuilder sb = new StringBuilder();
  11840.                 sb.append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_2XX);
  11841.                 sb.append(", ");
  11842.                 sb.append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_3XX);
  11843.                 sb.append(", ");
  11844.                 sb.append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_4XX);
  11845.                 sb.append(", ");
  11846.                 sb.append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CODICE_RISPOSTA_HTTP_5XX);
  11847.                 sb.append(", ");
  11848.                 sb.append(serviceBinding.equals(ServiceBinding.SOAP) ? PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_SOAP_FAULT :
  11849.                     PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_PROBLEM_DETAIL);
  11850.                
  11851.                 this.pd.setMessage(MessageFormat.format(PorteApplicativeCostanti.MESSAGGIO_ERRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_ALMENO_UNA_CONSEGNA_COMPLETATA_XX,  sb.toString()));
  11852.                 return false;
  11853.             }
  11854.            
  11855.         } catch (Exception e) {
  11856.             this.logError(e.getMessage(), e);
  11857.             throw new ControlStationCoreException(e.getMessage(),e);
  11858.         }
  11859.         return true;
  11860.     }
  11861. }