ConsoleHelper.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;

  21. import java.io.ByteArrayInputStream;
  22. import java.io.ByteArrayOutputStream;
  23. import java.io.File;
  24. import java.io.FileInputStream;
  25. import java.io.FileOutputStream;
  26. import java.io.InputStream;
  27. import java.lang.reflect.Constructor;
  28. import java.net.URL;
  29. import java.sql.Connection;
  30. import java.text.MessageFormat;
  31. import java.util.ArrayList;
  32. import java.util.Arrays;
  33. import java.util.Collections;
  34. import java.util.Date;
  35. import java.util.Enumeration;
  36. import java.util.HashMap;
  37. import java.util.Iterator;
  38. import java.util.List;
  39. import java.util.Map;
  40. import java.util.Properties;
  41. import java.util.Scanner;
  42. import java.util.UUID;
  43. import java.util.stream.Collectors;

  44. import javax.mail.BodyPart;
  45. import javax.servlet.http.HttpServletRequest;
  46. import javax.servlet.http.HttpSession;

  47. import org.apache.commons.io.FilenameUtils;
  48. import org.apache.commons.io.IOUtils;
  49. import org.apache.commons.lang.StringEscapeUtils;
  50. import org.apache.commons.lang.StringUtils;
  51. import org.openspcoop2.core.allarmi.Allarme;
  52. import org.openspcoop2.core.allarmi.constants.RuoloPorta;
  53. import org.openspcoop2.core.allarmi.constants.StatoAllarme;
  54. import org.openspcoop2.core.allarmi.utils.AllarmiConverterUtils;
  55. import org.openspcoop2.core.commons.DBUtils;
  56. import org.openspcoop2.core.commons.Filtri;
  57. import org.openspcoop2.core.commons.ISearch;
  58. import org.openspcoop2.core.commons.Liste;
  59. import org.openspcoop2.core.commons.ModalitaIdentificazione;
  60. import org.openspcoop2.core.commons.SearchUtils;
  61. import org.openspcoop2.core.config.AttributeAuthority;
  62. import org.openspcoop2.core.config.AutorizzazioneScope;
  63. import org.openspcoop2.core.config.CanaleConfigurazione;
  64. import org.openspcoop2.core.config.CanaliConfigurazione;
  65. import org.openspcoop2.core.config.Configurazione;
  66. import org.openspcoop2.core.config.ConfigurazionePortaHandler;
  67. import org.openspcoop2.core.config.ConfigurazioneTracciamentoPorta;
  68. import org.openspcoop2.core.config.ConfigurazioneUrlInvocazione;
  69. import org.openspcoop2.core.config.Connettore;
  70. import org.openspcoop2.core.config.CorrelazioneApplicativa;
  71. import org.openspcoop2.core.config.CorrelazioneApplicativaRisposta;
  72. import org.openspcoop2.core.config.CorsConfigurazione;
  73. import org.openspcoop2.core.config.CorsConfigurazioneHeaders;
  74. import org.openspcoop2.core.config.CorsConfigurazioneMethods;
  75. import org.openspcoop2.core.config.CorsConfigurazioneOrigin;
  76. import org.openspcoop2.core.config.Dump;
  77. import org.openspcoop2.core.config.DumpConfigurazione;
  78. import org.openspcoop2.core.config.DumpConfigurazioneRegola;
  79. import org.openspcoop2.core.config.GenericProperties;
  80. import org.openspcoop2.core.config.GestioneToken;
  81. import org.openspcoop2.core.config.MessageSecurity;
  82. import org.openspcoop2.core.config.MtomProcessor;
  83. import org.openspcoop2.core.config.MtomProcessorFlowParameter;
  84. import org.openspcoop2.core.config.PortaApplicativa;
  85. import org.openspcoop2.core.config.PortaApplicativaAutorizzazioneToken;
  86. import org.openspcoop2.core.config.PortaApplicativaServizioApplicativo;
  87. import org.openspcoop2.core.config.PortaDelegata;
  88. import org.openspcoop2.core.config.PortaDelegataAutorizzazioneToken;
  89. import org.openspcoop2.core.config.PortaDelegataLocalForward;
  90. import org.openspcoop2.core.config.PortaTracciamento;
  91. import org.openspcoop2.core.config.Property;
  92. import org.openspcoop2.core.config.Proprieta;
  93. import org.openspcoop2.core.config.ResponseCachingConfigurazione;
  94. import org.openspcoop2.core.config.ResponseCachingConfigurazioneControl;
  95. import org.openspcoop2.core.config.ResponseCachingConfigurazioneGenerale;
  96. import org.openspcoop2.core.config.ResponseCachingConfigurazioneHashGenerator;
  97. import org.openspcoop2.core.config.ResponseCachingConfigurazioneRegola;
  98. import org.openspcoop2.core.config.ServizioApplicativo;
  99. import org.openspcoop2.core.config.Soggetto;
  100. import org.openspcoop2.core.config.TrasformazioneRegola;
  101. import org.openspcoop2.core.config.TrasformazioneRegolaRichiesta;
  102. import org.openspcoop2.core.config.TrasformazioneRegolaRisposta;
  103. import org.openspcoop2.core.config.TrasformazioneSoap;
  104. import org.openspcoop2.core.config.TrasformazioneSoapRisposta;
  105. import org.openspcoop2.core.config.Trasformazioni;
  106. import org.openspcoop2.core.config.ValidazioneContenutiApplicativi;
  107. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  108. import org.openspcoop2.core.config.constants.MTOMProcessorType;
  109. import org.openspcoop2.core.config.constants.PluginCostanti;
  110. import org.openspcoop2.core.config.constants.RuoloTipoMatch;
  111. import org.openspcoop2.core.config.constants.ScopeTipoMatch;
  112. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  113. import org.openspcoop2.core.config.constants.StatoFunzionalitaBloccante;
  114. import org.openspcoop2.core.config.constants.StatoFunzionalitaCacheDigestQueryParameter;
  115. import org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione;
  116. import org.openspcoop2.core.config.constants.StatoFunzionalitaConWarning;
  117. import org.openspcoop2.core.config.constants.TipoAutenticazione;
  118. import org.openspcoop2.core.config.constants.TipoAutenticazionePrincipal;
  119. import org.openspcoop2.core.config.constants.TipoAutorizzazione;
  120. import org.openspcoop2.core.config.constants.TipoBehaviour;
  121. import org.openspcoop2.core.config.constants.TipoGestioneCORS;
  122. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  123. import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
  124. import org.openspcoop2.core.config.driver.db.IDServizioApplicativoDB;
  125. import org.openspcoop2.core.config.utils.TracciamentoCompatibilitaFiltroEsiti;
  126. import org.openspcoop2.core.constants.CostantiConnettori;
  127. import org.openspcoop2.core.constants.CostantiDB;
  128. import org.openspcoop2.core.constants.CostantiLabel;
  129. import org.openspcoop2.core.constants.TipiConnettore;
  130. import org.openspcoop2.core.constants.TipoPdD;
  131. import org.openspcoop2.core.controllo_traffico.AttivazionePolicy;
  132. import org.openspcoop2.core.controllo_traffico.ConfigurazionePolicy;
  133. import org.openspcoop2.core.controllo_traffico.constants.RuoloPolicy;
  134. import org.openspcoop2.core.controllo_traffico.constants.TipoRisorsaPolicyAttiva;
  135. import org.openspcoop2.core.controllo_traffico.driver.PolicyGroupByActiveThreadsType;
  136. import org.openspcoop2.core.id.IDAccordo;
  137. import org.openspcoop2.core.id.IDAccordoCooperazione;
  138. import org.openspcoop2.core.id.IDFruizione;
  139. import org.openspcoop2.core.id.IDGruppo;
  140. import org.openspcoop2.core.id.IDPortaApplicativa;
  141. import org.openspcoop2.core.id.IDPortaDelegata;
  142. import org.openspcoop2.core.id.IDRuolo;
  143. import org.openspcoop2.core.id.IDServizio;
  144. import org.openspcoop2.core.id.IDServizioApplicativo;
  145. import org.openspcoop2.core.id.IDSoggetto;
  146. import org.openspcoop2.core.mapping.MappingErogazionePortaApplicativa;
  147. import org.openspcoop2.core.mapping.MappingFruizionePortaDelegata;
  148. import org.openspcoop2.core.mvc.properties.Config;
  149. import org.openspcoop2.core.mvc.properties.constants.ItemType;
  150. import org.openspcoop2.core.mvc.properties.provider.ExternalResources;
  151. import org.openspcoop2.core.mvc.properties.provider.ProviderException;
  152. import org.openspcoop2.core.mvc.properties.provider.ProviderValidationException;
  153. import org.openspcoop2.core.mvc.properties.utils.ConfigManager;
  154. import org.openspcoop2.core.mvc.properties.utils.PropertiesSourceConfiguration;
  155. import org.openspcoop2.core.plugins.Plugin;
  156. import org.openspcoop2.core.plugins.constants.TipoPlugin;
  157. import org.openspcoop2.core.registry.AccordoCooperazione;
  158. import org.openspcoop2.core.registry.AccordoServizioParteComune;
  159. import org.openspcoop2.core.registry.AccordoServizioParteSpecifica;
  160. import org.openspcoop2.core.registry.Azione;
  161. import org.openspcoop2.core.registry.Documento;
  162. import org.openspcoop2.core.registry.Fruitore;
  163. import org.openspcoop2.core.registry.Operation;
  164. import org.openspcoop2.core.registry.PortType;
  165. import org.openspcoop2.core.registry.ProprietaOggetto;
  166. import org.openspcoop2.core.registry.ProtocolProperty;
  167. import org.openspcoop2.core.registry.Resource;
  168. import org.openspcoop2.core.registry.Ruolo;
  169. import org.openspcoop2.core.registry.beans.AccordoServizioParteComuneSintetico;
  170. import org.openspcoop2.core.registry.beans.ResourceSintetica;
  171. import org.openspcoop2.core.registry.constants.CostantiRegistroServizi;
  172. import org.openspcoop2.core.registry.constants.FormatoSpecifica;
  173. import org.openspcoop2.core.registry.constants.HttpMethod;
  174. import org.openspcoop2.core.registry.constants.RuoliDocumento;
  175. import org.openspcoop2.core.registry.constants.RuoloContesto;
  176. import org.openspcoop2.core.registry.constants.RuoloTipologia;
  177. import org.openspcoop2.core.registry.constants.ScopeContesto;
  178. import org.openspcoop2.core.registry.constants.StatiAccordo;
  179. import org.openspcoop2.core.registry.constants.TipiDocumentoSicurezza;
  180. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  181. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  182. import org.openspcoop2.core.registry.driver.FiltroRicercaAccordi;
  183. import org.openspcoop2.core.registry.driver.FiltroRicercaGruppi;
  184. import org.openspcoop2.core.registry.driver.FiltroRicercaRuoli;
  185. import org.openspcoop2.core.registry.driver.FiltroRicercaScope;
  186. import org.openspcoop2.core.registry.driver.IDAccordoCooperazioneFactory;
  187. import org.openspcoop2.core.registry.driver.IDAccordoFactory;
  188. import org.openspcoop2.core.registry.driver.IDServizioFactory;
  189. import org.openspcoop2.core.transazioni.utils.PropertiesSerializator;
  190. import org.openspcoop2.generic_project.exception.NotFoundException;
  191. import org.openspcoop2.message.constants.MessageType;
  192. import org.openspcoop2.message.constants.ServiceBinding;
  193. import org.openspcoop2.monitor.engine.alarm.wrapper.ConfigurazioneAllarmeBean;
  194. import org.openspcoop2.monitor.engine.condition.EsitoUtils;
  195. import org.openspcoop2.pdd.config.CostantiProprieta;
  196. import org.openspcoop2.pdd.core.autenticazione.ParametriAutenticazioneApiKey;
  197. import org.openspcoop2.pdd.core.autenticazione.ParametriAutenticazionePrincipal;
  198. import org.openspcoop2.pdd.core.autorizzazione.CostantiAutorizzazione;
  199. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.ConfigurazioneLoadBalancer;
  200. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.LoadBalancerType;
  201. import org.openspcoop2.pdd.core.behaviour.built_in.load_balance.sticky.StickyUtils;
  202. import org.openspcoop2.pdd.core.behaviour.conditional.ConditionalUtils;
  203. import org.openspcoop2.pdd.core.connettori.ConnettoreCheck;
  204. import org.openspcoop2.pdd.core.connettori.ConnettoreNULL;
  205. import org.openspcoop2.pdd.core.connettori.ConnettoreNULLEcho;
  206. import org.openspcoop2.pdd.core.connettori.ConnettoreStatus;
  207. import org.openspcoop2.pdd.core.controllo_traffico.policy.config.PolicyConfiguration;
  208. import org.openspcoop2.pdd.core.dynamic.DynamicHelperCostanti;
  209. import org.openspcoop2.pdd.core.dynamic.DynamicUtils;
  210. import org.openspcoop2.pdd.core.integrazione.GruppoIntegrazione;
  211. import org.openspcoop2.pdd.core.integrazione.TipoIntegrazione;
  212. import org.openspcoop2.pdd.core.token.TokenUtilities;
  213. import org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione;
  214. import org.openspcoop2.pdd.logger.LogLevels;
  215. import org.openspcoop2.protocol.engine.ProtocolFactoryManager;
  216. import org.openspcoop2.protocol.engine.utils.NamingUtils;
  217. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  218. import org.openspcoop2.protocol.sdk.ProtocolException;
  219. import org.openspcoop2.protocol.sdk.constants.ArchiveType;
  220. import org.openspcoop2.protocol.sdk.constants.ConsoleItemType;
  221. import org.openspcoop2.protocol.sdk.constants.ConsoleItemValueType;
  222. import org.openspcoop2.protocol.sdk.constants.ConsoleOperationType;
  223. import org.openspcoop2.protocol.sdk.constants.EsitoTransazioneName;
  224. import org.openspcoop2.protocol.sdk.constants.FunzionalitaProtocollo;
  225. import org.openspcoop2.protocol.sdk.properties.AbstractConsoleItem;
  226. import org.openspcoop2.protocol.sdk.properties.AbstractProperty;
  227. import org.openspcoop2.protocol.sdk.properties.BaseConsoleItem;
  228. import org.openspcoop2.protocol.sdk.properties.BinaryConsoleItem;
  229. import org.openspcoop2.protocol.sdk.properties.BinaryProperty;
  230. import org.openspcoop2.protocol.sdk.properties.BooleanConsoleItem;
  231. import org.openspcoop2.protocol.sdk.properties.BooleanProperty;
  232. import org.openspcoop2.protocol.sdk.properties.ConsoleConfiguration;
  233. import org.openspcoop2.protocol.sdk.properties.IConsoleDynamicConfiguration;
  234. import org.openspcoop2.protocol.sdk.properties.IConsoleHelper;
  235. import org.openspcoop2.protocol.sdk.properties.NumberConsoleItem;
  236. import org.openspcoop2.protocol.sdk.properties.NumberProperty;
  237. import org.openspcoop2.protocol.sdk.properties.ProtocolProperties;
  238. import org.openspcoop2.protocol.sdk.properties.ProtocolPropertiesFactory;
  239. import org.openspcoop2.protocol.sdk.properties.ProtocolPropertiesUtils;
  240. import org.openspcoop2.protocol.sdk.properties.StringConsoleItem;
  241. import org.openspcoop2.protocol.sdk.properties.StringProperty;
  242. import org.openspcoop2.protocol.sdk.properties.SubtitleConsoleItem;
  243. import org.openspcoop2.protocol.sdk.properties.TitleConsoleItem;
  244. import org.openspcoop2.protocol.sdk.registry.IConfigIntegrationReader;
  245. import org.openspcoop2.protocol.sdk.registry.IRegistryReader;
  246. import org.openspcoop2.protocol.sdk.validator.ValidazioneResult;
  247. import org.openspcoop2.protocol.utils.EsitiConfigUtils;
  248. import org.openspcoop2.protocol.utils.EsitiProperties;
  249. import org.openspcoop2.utils.BooleanNullable;
  250. import org.openspcoop2.utils.UtilsException;
  251. import org.openspcoop2.utils.certificate.byok.BYOKManager;
  252. import org.openspcoop2.utils.certificate.ocsp.OCSPManager;
  253. import org.openspcoop2.utils.mime.MimeMultipart;
  254. import org.openspcoop2.utils.properties.PropertiesUtilities;
  255. import org.openspcoop2.utils.regexp.RegExpException;
  256. import org.openspcoop2.utils.regexp.RegExpNotFoundException;
  257. import org.openspcoop2.utils.regexp.RegExpNotValidException;
  258. import org.openspcoop2.utils.regexp.RegularExpressionEngine;
  259. import org.openspcoop2.utils.resources.Charset;
  260. import org.openspcoop2.utils.resources.FileSystemUtilities;
  261. import org.openspcoop2.utils.transport.http.HttpRequestMethod;
  262. import org.openspcoop2.utils.xml.AbstractXPathExpressionEngine;
  263. import org.openspcoop2.utils.xml.XPathExpressionEngine;
  264. import org.openspcoop2.utils.xml2json.JsonXmlPathExpressionEngine;
  265. import org.openspcoop2.web.ctrlstat.config.ConsoleProperties;
  266. import org.openspcoop2.web.ctrlstat.core.AutorizzazioneUtilities;
  267. import org.openspcoop2.web.ctrlstat.core.Connettori;
  268. import org.openspcoop2.web.ctrlstat.core.ConsoleSearch;
  269. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  270. import org.openspcoop2.web.ctrlstat.core.ControlStationLogger;
  271. import org.openspcoop2.web.ctrlstat.core.DBManager;
  272. import org.openspcoop2.web.ctrlstat.core.InitListener;
  273. import org.openspcoop2.web.ctrlstat.core.Utilities;
  274. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  275. import org.openspcoop2.web.ctrlstat.costanti.InUsoType;
  276. import org.openspcoop2.web.ctrlstat.costanti.TipologiaConnettori;
  277. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationException;
  278. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationNotFound;
  279. import org.openspcoop2.web.ctrlstat.plugins.ExtendedMenuItem;
  280. import org.openspcoop2.web.ctrlstat.plugins.IExtendedMenu;
  281. import org.openspcoop2.web.ctrlstat.servlet.ac.AccordiCooperazioneCore;
  282. import org.openspcoop2.web.ctrlstat.servlet.ac.AccordiCooperazioneCostanti;
  283. import org.openspcoop2.web.ctrlstat.servlet.apc.AccordiServizioParteComuneCore;
  284. import org.openspcoop2.web.ctrlstat.servlet.apc.AccordiServizioParteComuneCostanti;
  285. import org.openspcoop2.web.ctrlstat.servlet.apc.api.ApiCostanti;
  286. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaCore;
  287. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaCostanti;
  288. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaFruitoriPorteDelegateMappingInfo;
  289. import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaPorteApplicativeMappingInfo;
  290. import org.openspcoop2.web.ctrlstat.servlet.aps.erogazioni.ErogazioniCostanti;
  291. import org.openspcoop2.web.ctrlstat.servlet.archivi.ArchiviCore;
  292. import org.openspcoop2.web.ctrlstat.servlet.archivi.ArchiviCostanti;
  293. import org.openspcoop2.web.ctrlstat.servlet.archivi.ExporterUtils;
  294. import org.openspcoop2.web.ctrlstat.servlet.config.ConfigurazioneCore;
  295. import org.openspcoop2.web.ctrlstat.servlet.config.ConfigurazioneCostanti;
  296. import org.openspcoop2.web.ctrlstat.servlet.connettori.ConnettoriCore;
  297. import org.openspcoop2.web.ctrlstat.servlet.connettori.ConnettoriCostanti;
  298. import org.openspcoop2.web.ctrlstat.servlet.gruppi.GruppiCore;
  299. import org.openspcoop2.web.ctrlstat.servlet.gruppi.GruppiCostanti;
  300. import org.openspcoop2.web.ctrlstat.servlet.monitor.MonitorCostanti;
  301. import org.openspcoop2.web.ctrlstat.servlet.operazioni.OperazioniCore;
  302. import org.openspcoop2.web.ctrlstat.servlet.operazioni.OperazioniCostanti;
  303. import org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeCore;
  304. import org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeCostanti;
  305. import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateCore;
  306. import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateCostanti;
  307. import org.openspcoop2.web.ctrlstat.servlet.pdd.PddCore;
  308. import org.openspcoop2.web.ctrlstat.servlet.pdd.PddCostanti;
  309. import org.openspcoop2.web.ctrlstat.servlet.protocol_properties.ProtocolPropertiesCore;
  310. import org.openspcoop2.web.ctrlstat.servlet.protocol_properties.ProtocolPropertiesCostanti;
  311. import org.openspcoop2.web.ctrlstat.servlet.protocol_properties.ProtocolPropertiesUtilities;
  312. import org.openspcoop2.web.ctrlstat.servlet.remote_stores.RemoteStoresCore;
  313. import org.openspcoop2.web.ctrlstat.servlet.remote_stores.RemoteStoresCostanti;
  314. import org.openspcoop2.web.ctrlstat.servlet.ruoli.RuoliCore;
  315. import org.openspcoop2.web.ctrlstat.servlet.ruoli.RuoliCostanti;
  316. import org.openspcoop2.web.ctrlstat.servlet.sa.ServiziApplicativiCore;
  317. import org.openspcoop2.web.ctrlstat.servlet.sa.ServiziApplicativiCostanti;
  318. import org.openspcoop2.web.ctrlstat.servlet.scope.ScopeCore;
  319. import org.openspcoop2.web.ctrlstat.servlet.scope.ScopeCostanti;
  320. import org.openspcoop2.web.ctrlstat.servlet.soggetti.SoggettiCore;
  321. import org.openspcoop2.web.ctrlstat.servlet.soggetti.SoggettiCostanti;
  322. import org.openspcoop2.web.ctrlstat.servlet.utenti.UtentiCore;
  323. import org.openspcoop2.web.ctrlstat.servlet.utenti.UtentiCostanti;
  324. import org.openspcoop2.web.ctrlstat.servlet.utils.UtilsCostanti;
  325. import org.openspcoop2.web.lib.audit.web.AuditCostanti;
  326. import org.openspcoop2.web.lib.audit.web.AuditHelper;
  327. import org.openspcoop2.web.lib.mvc.BinaryParameter;
  328. import org.openspcoop2.web.lib.mvc.CheckboxStatusType;
  329. import org.openspcoop2.web.lib.mvc.Costanti;
  330. import org.openspcoop2.web.lib.mvc.DataElement;
  331. import org.openspcoop2.web.lib.mvc.DataElement.STATO_APERTURA_SEZIONI;
  332. import org.openspcoop2.web.lib.mvc.DataElementInfo;
  333. import org.openspcoop2.web.lib.mvc.DataElementType;
  334. import org.openspcoop2.web.lib.mvc.Dialog;
  335. import org.openspcoop2.web.lib.mvc.Dialog.BodyElement;
  336. import org.openspcoop2.web.lib.mvc.MenuEntry;
  337. import org.openspcoop2.web.lib.mvc.PageData;
  338. import org.openspcoop2.web.lib.mvc.Parameter;
  339. import org.openspcoop2.web.lib.mvc.ServletUtils;
  340. import org.openspcoop2.web.lib.mvc.TargetType;
  341. import org.openspcoop2.web.lib.mvc.TipoOperazione;
  342. import org.openspcoop2.web.lib.mvc.properties.beans.BaseItemBean;
  343. import org.openspcoop2.web.lib.mvc.properties.beans.ConfigBean;
  344. import org.openspcoop2.web.lib.mvc.properties.exception.UserInputValidationException;
  345. import org.openspcoop2.web.lib.users.dao.InterfaceType;
  346. import org.openspcoop2.web.lib.users.dao.PermessiUtente;
  347. import org.openspcoop2.web.lib.users.dao.User;
  348. import org.slf4j.Logger;

  349. /**
  350.  * ctrlstatHelper
  351.  *
  352.  * @author Andrea Poli (apoli@link.it)
  353.  * @author Stefano Corallo (corallo@link.it)
  354.  * @author Sandra Giangrandi (sandra@link.it)
  355.  * @author $Author$
  356.  * @version $Rev$, $Date$
  357.  *
  358.  */
  359. public class ConsoleHelper implements IConsoleHelper {
  360.    
  361.     protected HttpServletRequest request;
  362.     @Override
  363.     public HttpServletRequest getRequest() {
  364.         return this.request;
  365.     }
  366.     protected PageData pd;
  367.     public PageData getPd() {
  368.         return this.pd;
  369.     }
  370.     protected HttpSession session;
  371.     @Override
  372.     public HttpSession getSession() {
  373.         return this.session;
  374.     }
  375.    
  376.     protected void logError(String msg,Throwable e) {
  377.         if(this.log!=null) {
  378.             this.log.error(msg,e);
  379.         }
  380.     }
  381.     protected void logError(String msg) {
  382.         if(this.log!=null) {
  383.             this.log.error(msg);
  384.         }
  385.     }
  386.    
  387.     @Override
  388.     public void setMessage(String message, boolean append) throws DriverControlStationException {
  389.         this.setMessage(message, append, null);
  390.     }
  391.     @Override
  392.     public void setMessage(String message, boolean append, String type) throws DriverControlStationException {
  393.        
  394.         org.openspcoop2.web.lib.mvc.MessageType messageType = org.openspcoop2.web.lib.mvc.MessageType.ERROR;
  395.         if(type!=null) {
  396.             try {
  397.                 messageType = org.openspcoop2.web.lib.mvc.MessageType.fromValue(type);
  398.             }catch(Exception t) {
  399.                 // ignore
  400.             }
  401.             if(messageType==null) {
  402.                 try {
  403.                     messageType = org.openspcoop2.web.lib.mvc.MessageType.valueOf(type.toUpperCase());
  404.                 }catch(Exception t) {
  405.                     // ignore
  406.                 }
  407.             }
  408.             if(messageType==null) {
  409.                 messageType = org.openspcoop2.web.lib.mvc.MessageType.ERROR;
  410.             }
  411.         }
  412.        
  413.         if(this.pd!=null) {
  414.             StringBuilder sb = new StringBuilder();
  415.             if(append) {
  416.                 String actualMsg = this.pd.getMessage();
  417.                 if(actualMsg!=null && StringUtils.isNotEmpty(actualMsg)) {
  418.                     sb.append(actualMsg);
  419.                     sb.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  420.                 }
  421.             }
  422.             sb.append(message);
  423.             this.pd.setMessage(message, messageType);
  424.         }
  425.     }
  426.    
  427.     @Override
  428.     public boolean isEditModeInProgress() throws DriverControlStationException{
  429.         String editMode = this.getParameter(Costanti.DATA_ELEMENT_EDIT_MODE_NAME);
  430.         return ServletUtils.isEditModeInProgress(editMode);    
  431.     }

  432.     @Override
  433.     public boolean isEditModeFinished() throws DriverControlStationException{
  434.         String editMode = this.getParameter(Costanti.DATA_ELEMENT_EDIT_MODE_NAME);
  435.         return ServletUtils.isEditModeFinished(editMode);      
  436.     }
  437.    
  438.     @Override
  439.     public String getPostBackElementName() throws DriverControlStationException{
  440.         return this.getParameter(Costanti.POSTBACK_ELEMENT_NAME);
  441.     }
  442.    
  443.     @Override
  444.     public boolean isPostBack() throws DriverControlStationException{
  445.         String postbackElementName = this.getPostBackElementName();
  446.         return postbackElementName!=null && !"".equals(postbackElementName);
  447.     }
  448.    
  449.     @Override
  450.     public boolean isPostBackFilterElement() throws DriverControlStationException{
  451.         String postbackElementName = this.getPostBackElementName();
  452.         return postbackElementName!=null && postbackElementName.startsWith(Costanti.PARAMETRO_FILTER_VALUE);
  453.     }
  454.    
  455.     @Override
  456.     public <T> T getAttributeFromSession(String attributeName, Class<T> type){
  457.         return ServletUtils.getObjectFromSession(this.request, this.session, type, attributeName);
  458.     }
  459.    
  460.     public void clearFiltroSoggettoByPostBackProtocollo(int posizioneFiltroProtocollo, ISearch ricerca, int idLista) throws DriverControlStationException {
  461.         String postBackElement = this.getPostBackElementName();
  462.         if((Costanti.PARAMETRO_FILTER_VALUE+posizioneFiltroProtocollo).equals(postBackElement)) {
  463.             // verifico se si tratta del profilo di interoperabilita.
  464.             if(Filtri.FILTRO_PROTOCOLLO.equals(this.getParameter((Costanti.PARAMETRO_FILTER_NAME+posizioneFiltroProtocollo)))) {
  465.                 String value = this.getParameter((Costanti.PARAMETRO_FILTER_VALUE+posizioneFiltroProtocollo));
  466.                 if( (value==null ||
  467.                         //"".equals(value) ||
  468.                         CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(value))){
  469.                     ricerca.clearFilter(idLista, Filtri.FILTRO_SOGGETTO);
  470.                 }
  471.             }
  472.         }
  473.     }
  474.    
  475.     protected ControlStationCore core = null;
  476.     public ControlStationCore getCore() {
  477.         return this.core;
  478.     }
  479.     protected PddCore pddCore = null;
  480.     protected SoggettiCore soggettiCore = null;
  481.     protected UtentiCore utentiCore = null;
  482.     protected ServiziApplicativiCore saCore = null;
  483.     protected ArchiviCore archiviCore = null;
  484.     protected AccordiServizioParteComuneCore apcCore = null;
  485.     protected AccordiServizioParteSpecificaCore apsCore = null;
  486.     protected PorteDelegateCore porteDelegateCore = null;
  487.     protected PorteApplicativeCore porteApplicativeCore = null;
  488.     protected AccordiCooperazioneCore acCore = null;
  489.     protected ConfigurazioneCore confCore = null;
  490.     protected ConnettoriCore connettoriCore = null;
  491.     protected OperazioniCore operazioniCore = null;
  492.     protected ProtocolPropertiesCore protocolPropertiesCore = null;
  493.     protected RuoliCore ruoliCore = null;
  494.     protected ScopeCore scopeCore = null;
  495.     protected GruppiCore gruppiCore = null;
  496.     protected RemoteStoresCore remoteStoresCore= null;

  497.     protected AuditHelper auditHelper;
  498.     public AuditHelper getAuditHelper() {
  499.         return this.auditHelper;
  500.     }
  501.    
  502.     /** Gestione dei parametri unica sia per le chiamate multipart che per quelle normali*/
  503.     private boolean multipart = false;
  504.     public boolean isMultipart() {
  505.         return this.multipart;
  506.     }
  507.     private String contentType = null;
  508.     public String getContentType() {
  509.         return this.contentType;
  510.     }
  511.     private MimeMultipart mimeMultipart = null;
  512.     private Map<String, List<InputStream>> mapParametri = null;
  513.     private Map<String, Object> mapParametriReaded = null;
  514.     private Map<String, List<String>> mapNomiFileParametri = null;
  515.     private List<String> idBinaryParameterRicevuti = null;
  516.    
  517.     /** Logger utilizzato per debug. */
  518.     protected Logger log = null;

  519.     protected IDAccordoCooperazioneFactory idAccordoCooperazioneFactory = null;
  520.     protected IDAccordoFactory idAccordoFactory = null;
  521.     protected IDServizioFactory idServizioFactory = null;
  522.    
  523.     private static String tmpDirectory = null;
  524.    
  525.     public static String getTmpDir() throws DriverControlStationException {
  526.         if(tmpDirectory == null)
  527.             initTmpDir();
  528.        
  529.         return tmpDirectory;
  530.     }
  531.    
  532.     public static synchronized void initTmpDir() throws DriverControlStationException {
  533.         if(tmpDirectory == null){
  534.             File file = null;
  535.             try {
  536.                 file = FileSystemUtilities.createTempFile(CostantiControlStation.TEMP_FILE_PREFIX, CostantiControlStation.TEMP_FILE_SUFFIX);
  537.             }catch(Exception e) {
  538.                 throw new DriverControlStationException(e.getMessage(),e);
  539.             }
  540.             tmpDirectory = FilenameUtils.getFullPath(file.getAbsolutePath());
  541.             if(file.exists()) {
  542.                 try {
  543.                     java.nio.file.Files.delete(file.toPath());
  544.                 }catch(Exception eIgnore) {
  545.                     // ignore
  546.                 }
  547.             }
  548.         }
  549.     }
  550.    
  551.     /** Lunghezza label */
  552.     protected int size = 50;
  553.    
  554.    
  555.     /** Modalita Interfaccia */
  556.    
  557.     private static InterfaceType tipoInterfacciaAPI = null; // api rest
  558.     public static InterfaceType getTipoInterfacciaAPI() {
  559.         return tipoInterfacciaAPI;
  560.     }
  561.     public static void setTipoInterfacciaAPI(InterfaceType tipoInterfacciaAPI) {
  562.         ConsoleHelper.tipoInterfacciaAPI = tipoInterfacciaAPI;
  563.     }

  564.     public InterfaceType getTipoInterfaccia() {
  565.         if(tipoInterfacciaAPI!=null) {
  566.             return tipoInterfacciaAPI;
  567.         }
  568.         User user = ServletUtils.getUserFromSession(this.request, this.session);
  569.         if(user!=null) {
  570.             return user.getInterfaceType();
  571.         }
  572.         else {
  573.             return InterfaceType.STANDARD; // default
  574.         }
  575.     }

  576.     @Override
  577.     public boolean isModalitaCompleta() {
  578.         return InterfaceType.equals(this.getTipoInterfaccia(),
  579.                 InterfaceType.COMPLETA);
  580.     }
  581.     @Override
  582.     public boolean isModalitaAvanzata() {
  583.         // considero anche l'interfaccia completa
  584.         return InterfaceType.equals(this.getTipoInterfaccia(),
  585.                 InterfaceType.AVANZATA,InterfaceType.COMPLETA);
  586.     }
  587.     @Override
  588.     public boolean isModalitaStandard() {
  589.         return InterfaceType.equals(this.getTipoInterfaccia(),
  590.                 InterfaceType.STANDARD);
  591.     }

  592.     /** Soggetto Selezionato */
  593.     public boolean isSoggettoMultitenantSelezionato() {
  594.         return this.core.isMultitenant() && StringUtils.isNotEmpty(this.getSoggettoMultitenantSelezionato());
  595.     }
  596.     @Override
  597.     public String getSoggettoMultitenantSelezionato() {
  598.         return ServletUtils.getUserFromSession(this.request, this.session).getSoggettoSelezionatoPddConsole();
  599.     }
  600.    
  601.     /** Soggetto Selezionato da govwayMonitor */
  602.     public boolean isSoggettoMultitenantSelezionatoConsoleMonitoraggio() {
  603.         return this.core.isMultitenant() && StringUtils.isNotEmpty(this.getSoggettoMultitenantSelezionatoConsoleMonitoraggio());
  604.     }
  605.     public String getSoggettoMultitenantSelezionatoConsoleMonitoraggio() {
  606.         return ServletUtils.getUserFromSession(this.request, this.session).getSoggettoSelezionatoPddMonitor();
  607.     }
  608.    
  609.     private boolean errorInit = false;
  610.     private Exception eErrorInit;
  611.    
  612.     public ConsoleHelper(HttpServletRequest request, PageData pd, HttpSession session) {
  613.         ControlStationCore core = null;
  614.         try {
  615.             core = new ControlStationCore();
  616.         } catch (Exception e) {
  617.             if(this.log!=null) {
  618.                 this.logError("Exception ctrlstatHelper: " + e.getMessage(), e);
  619.             }
  620.             this.errorInit = true;
  621.             this.eErrorInit = e;
  622.         }
  623.         this.init(core, request, pd, session);
  624.         try {
  625.             if(this.isPostBack()) {
  626.                 pd.setPostBackResult(true);
  627.             }
  628.         } catch (Exception e) {
  629.             this.logError("Exception ctrlstatHelper: " + e.getMessage(), e);
  630.         }
  631.     }
  632.     public ConsoleHelper(ControlStationCore core, HttpServletRequest request, PageData pd, HttpSession session) {
  633.         this.init(core, request, pd, session);
  634.     }
  635.     private void init(ControlStationCore core, HttpServletRequest request, PageData pd, HttpSession session) {
  636.         this.request = request;
  637.         this.pd = pd;
  638.         this.session = session;
  639.         this.log = ControlStationLogger.getPddConsoleCoreLogger();
  640.         try {
  641.            
  642.             if (this.request.getCharacterEncoding() == null) {
  643.                 this.request.setCharacterEncoding(Charset.UTF_8.getValue());
  644.             }
  645.                        
  646.             this.core = core;
  647.             this.pddCore = new PddCore(this.core);
  648.             this.utentiCore = new UtentiCore(this.core);
  649.             this.soggettiCore = new SoggettiCore(this.core);
  650.             this.saCore = new ServiziApplicativiCore(this.core);
  651.             this.archiviCore = new ArchiviCore(this.core);
  652.             this.apcCore = new AccordiServizioParteComuneCore(this.core);
  653.             this.apsCore = new AccordiServizioParteSpecificaCore(this.core);
  654.             this.porteDelegateCore = new PorteDelegateCore(this.core);
  655.             this.porteApplicativeCore = new PorteApplicativeCore(this.core);
  656.             this.acCore = new AccordiCooperazioneCore(this.core);
  657.             this.confCore = new ConfigurazioneCore(this.core);
  658.             this.connettoriCore = new ConnettoriCore(this.core);
  659.             this.operazioniCore = new OperazioniCore(this.core);
  660.             this.protocolPropertiesCore = new ProtocolPropertiesCore(this.core);
  661.             this.ruoliCore = new RuoliCore(this.core);
  662.             this.scopeCore = new ScopeCore(this.core);
  663.             this.gruppiCore = new GruppiCore(this.core);
  664.             this.remoteStoresCore = new RemoteStoresCore(this.core);
  665.            
  666.             this.auditHelper = new AuditHelper(request, pd, session);

  667.             this.idBinaryParameterRicevuti = new ArrayList<>();
  668.             // analisi dei parametri della request
  669.             this.contentType = request.getContentType();
  670.             if ((this.contentType != null) && (this.contentType.indexOf(Costanti.MULTIPART) != -1)) {
  671.                 this.multipart = true;
  672.                 this.mimeMultipart = new MimeMultipart(request.getInputStream(), this.contentType);
  673.                 this.mapParametri = new HashMap<>();
  674.                 this.mapParametriReaded = new HashMap<>();
  675.                 this.mapNomiFileParametri = new HashMap<>();

  676.                 for(int i = 0 ; i < this.mimeMultipart.countBodyParts() ;  i ++) {
  677.                     BodyPart bodyPart = this.mimeMultipart.getBodyPart(i);
  678.                     String partName = getBodyPartName(bodyPart);
  679.                    
  680.                     if(partName==null) {
  681.                         throw new DriverControlStationException("Part name non trovato per body part alla posizione '"+i+"'");
  682.                     }
  683.                    
  684.                     List<InputStream> list = null;
  685.                     if(this.mapParametri.containsKey(partName)) {
  686.                         list = this.mapParametri.get(partName);
  687.                     }
  688.                     else {
  689.                         list = new ArrayList<>();
  690.                         this.mapParametri.put(partName, list);
  691.                     }
  692.                    
  693.                     //if(!this.mapParametri.containsKey(partName)) {
  694.                     if(partName.startsWith(Costanti.PARAMETER_FILEID_PREFIX)){
  695.                         this.idBinaryParameterRicevuti.add(partName);
  696.                     }
  697.                     //this.mapParametri.put(partName, bodyPart.getInputStream());
  698.                     list.add(bodyPart.getInputStream());
  699.                     String fileName = getBodyPartFileName(bodyPart);
  700.                     if(fileName != null) {
  701.                         List<String> nomiFiles = null;
  702.                         if(this.mapNomiFileParametri.containsKey(partName)) {
  703.                             nomiFiles = this.mapNomiFileParametri.get(partName);
  704.                         } else {
  705.                             nomiFiles = new ArrayList<>();
  706.                             this.mapNomiFileParametri.put(partName, nomiFiles);
  707.                         }
  708.                        
  709.                         nomiFiles.add(fileName);
  710.                     }
  711.                     //}
  712.                     //else throw new DriverControlStationException("Parametro ["+partName+"] Duplicato.");
  713.                 }
  714.             } else {
  715.                 Enumeration<String> parameterNames = this.request.getParameterNames();
  716.                 while (parameterNames.hasMoreElements()) {
  717.                     String param = (String) parameterNames.nextElement();
  718.                     if(param.startsWith(Costanti.PARAMETER_FILEID_PREFIX)){
  719.                         this.idBinaryParameterRicevuti.add(param);
  720.                     }
  721.                 }
  722.             }
  723.            
  724.             try {
  725.                 if(!ControlStationCore.isAPIMode()) {
  726.                     ConsoleProperties consoleProperties = ConsoleProperties.getInstance();
  727.                     this.size = consoleProperties.getConsoleLunghezzaLabel();
  728.                 }
  729.             }catch(Exception e) {
  730.                 this.size = 50;
  731.             }
  732.            
  733.             // inizializzo l'id tab
  734.             this.getTabId();
  735.         } catch (Exception e) {
  736.             this.logError("Exception ctrlstatHelper: " + e.getMessage(), e);
  737.             this.errorInit = true;
  738.             this.eErrorInit = e;
  739.         }
  740.         this.idAccordoCooperazioneFactory = IDAccordoCooperazioneFactory.getInstance();
  741.         this.idAccordoFactory = IDAccordoFactory.getInstance();
  742.         this.idServizioFactory = IDServizioFactory.getInstance();
  743.     }
  744.    
  745.     public String getTabId() throws DriverControlStationException {
  746.         return getTabId(this.log, this, this.request);
  747.     }
  748.    
  749.     public static String getTabId(Logger log, ConsoleHelper helper, HttpServletRequest request) throws DriverControlStationException {
  750.         Object idTabObj = request.getAttribute(Costanti.PARAMETER_TAB_KEY);
  751.        
  752.         if(idTabObj == null) {
  753.             log.trace("CHECKTABID: non trovato come attributo");
  754.             String idTab = helper != null ? helper.getParameter(Costanti.PARAMETER_TAB_KEY) : request.getParameter(Costanti.PARAMETER_TAB_KEY);
  755.            
  756.             if(idTab == null) { // nuovoTab o nuova finestra o primo accesso
  757.                 log.trace("CHECKTABID: non trovato come parametro");
  758.                 idTab = UUID.randomUUID().toString().replace("-", "");
  759.                 request.setAttribute(Costanti.PARAMETER_TAB_KEY, idTab);
  760.                 log.debug("CHECKTABID: generato nuovo id: ["+idTab+"]");
  761.                 return idTab;
  762.             }
  763.            
  764.             request.setAttribute(Costanti.PARAMETER_TAB_KEY, idTab);
  765.             log.trace("CHECKTABID: trovato come parametro: ["+idTab+"]");
  766.             return idTab;
  767.         }
  768.        
  769.         log.trace("CHECKTABID: trovato come attributo: ["+((String)idTabObj)+"]");
  770.         return (String) idTabObj;
  771.     }
  772.    
  773. //  public boolean isUseIdSogg() {
  774. //      // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  775. //      return ServletUtils.getBooleanAttributeFromSession(CostantiControlStation.PARAMETRO_USAIDSOGG , this.session, false);
  776. //  }
  777.    
  778.     public boolean isShowGestioneWorkflowStatoDocumenti() {
  779.         return this.core.isShowGestioneWorkflowStatoDocumenti(this);
  780.     }
  781.    
  782.     public IDAccordo getIDAccordoFromValues(String nomeAS, String soggettoReferente, String versione) throws DriverControlStationException{
  783.         try {
  784.             Soggetto s = this.soggettiCore.getSoggetto(Integer.parseInt(soggettoReferente));            
  785.             IDSoggetto assr = new IDSoggetto();
  786.             assr.setTipo(s.getTipo());
  787.             assr.setNome(s.getNome());
  788.             int versioneInt = 1;
  789.             if(versione!=null && !"".equals(versione)) {
  790.                 versioneInt = Integer.parseInt(versione);
  791.             }
  792.             return this.idAccordoFactory.getIDAccordoFromValues(nomeAS, assr, versioneInt);
  793.         }catch(Exception e) {
  794.             throw new DriverControlStationException(e.getMessage(),e);
  795.         }
  796.     }
  797.    
  798.     public IDServizio getIDServizioFromValues(String tipo, String nome, String soggettoErogatore, String versione) throws DriverControlStationException{
  799.         try {
  800.             Soggetto s = this.soggettiCore.getSoggetto(Integer.parseInt(soggettoErogatore));            
  801.             IDSoggetto assr = new IDSoggetto();
  802.             assr.setTipo(s.getTipo());
  803.             assr.setNome(s.getNome());
  804.             int versioneInt = 1;
  805.             if(versione!=null && !"".equals(versione)) {
  806.                 versioneInt = Integer.parseInt(versione);
  807.             }
  808.             return this.idServizioFactory.getIDServizioFromValues(tipo, nome, assr, versioneInt);
  809.         }catch(Exception e) {
  810.             throw new DriverControlStationException(e.getMessage(),e);
  811.         }
  812.     }
  813.    
  814.     public IDServizio getIDServizioFromValues(String tipo, String nome, String tipoSoggettoErogatore, String soggettoErogatore, String versione) throws DriverControlStationException{
  815.         try {
  816.             IDSoggetto assr = new IDSoggetto();
  817.             assr.setTipo(tipoSoggettoErogatore);
  818.             assr.setNome(soggettoErogatore);
  819.             int versioneInt = 1;
  820.             if(versione!=null && !"".equals(versione)) {
  821.                 versioneInt = Integer.parseInt(versione);
  822.             }
  823.             return this.idServizioFactory.getIDServizioFromValues(tipo, nome, assr,versioneInt);
  824.         }catch(Exception e) {
  825.             throw new DriverControlStationException(e.getMessage(),e);
  826.         }
  827.     }
  828.    
  829.     public IDAccordo getIDAccordoFromUri(String uriAccordo) throws DriverControlStationException{
  830.         try {
  831.             return this.idAccordoFactory.getIDAccordoFromUri(uriAccordo);
  832.         }catch(Exception e) {
  833.             throw new DriverControlStationException(e.getMessage(),e);
  834.         }
  835.     }
  836.    
  837.     public int getSize() {
  838.         return this.size;
  839.     }

  840.     private String getBodyPartName (BodyPart bodyPart) throws DriverControlStationException{
  841.         String partName =  null;
  842.         String[] headers = null;
  843.         try {
  844.             headers = bodyPart.getHeader(CostantiControlStation.PARAMETRO_CONTENT_DISPOSITION);
  845.         }catch(Exception e) {
  846.             throw new DriverControlStationException(e.getMessage(),e);
  847.         }
  848.         if(headers != null && headers.length > 0){
  849.             String header = headers[0];

  850.             // in due parti perche il suffisso con solo " imbrogliava il controllo
  851.             int prefixIndex = header.indexOf(CostantiControlStation.PREFIX_CONTENT_DISPOSITION) + CostantiControlStation.PREFIX_CONTENT_DISPOSITION.length();
  852.             partName = header.substring(prefixIndex);

  853.             int suffixIndex = partName.indexOf(CostantiControlStation.SUFFIX_CONTENT_DISPOSITION);
  854.             partName = partName.substring(0,suffixIndex);
  855.         }

  856.         return partName;
  857.     }

  858.     private String getBodyPartFileName (BodyPart bodyPart) throws DriverControlStationException{
  859.         String partName =  null;
  860.         String[] headers = null;
  861.         try {
  862.             headers = bodyPart.getHeader(CostantiControlStation.PARAMETRO_CONTENT_DISPOSITION);
  863.         }catch(Exception e) {
  864.             throw new DriverControlStationException(e.getMessage(),e);
  865.         }
  866.         if(headers != null && headers.length > 0){
  867.             String header = headers[0];

  868.             // in due parti perche il suffisso con solo " imbrogliava il controllo
  869.             int prefixIndex = header.indexOf(CostantiControlStation.PREFIX_FILENAME);
  870.             if(prefixIndex > -1){
  871.                 partName = header.substring(prefixIndex + CostantiControlStation.PREFIX_FILENAME.length());

  872.                 int suffixIndex = partName.indexOf(CostantiControlStation.SUFFIX_FILENAME);
  873.                 partName = partName.substring(0,suffixIndex);
  874.                
  875.                 // 20220621 IE invia l'intero path invece che il solo filename, bisogna estrarlo
  876.                 partName = FilenameUtils.getName(partName);
  877.             }
  878.         }

  879.         return partName;
  880.     }

  881.     private void checkErrorInit() throws DriverControlStationException {
  882.         if(this.errorInit) {
  883.             throw new DriverControlStationException("Inizializzazione fallita: "+this.eErrorInit.getMessage(),this.eErrorInit);
  884.         }
  885.     }
  886.    
  887.     @Override
  888.     public Enumeration<?> getParameterNames() throws DriverControlStationException {
  889.         this.checkErrorInit();
  890.         if(this.multipart){
  891.             throw new DriverControlStationException("Not Implemented");
  892.         }
  893.         else {
  894.             return this.request.getParameterNames();
  895.         }
  896.     }
  897.    
  898.     @Override
  899.     public String [] getParameterValues(String parameterName) throws DriverControlStationException {
  900.         this.checkErrorInit();
  901.         if(this.multipart){
  902.            
  903.             String [] array = null;
  904.             if(this.mapParametriReaded.containsKey(parameterName)) {
  905.                 array = (String[]) this.mapParametriReaded.get(parameterName);
  906.             }
  907.             else {
  908.                 List<InputStream> list = this.mapParametri.get(parameterName);
  909.                 if(list != null && !list.isEmpty()){
  910.                     StringBuilder sb = new StringBuilder();
  911.                     for (InputStream inputStream : list) {
  912.                         if(inputStream != null){
  913.                             ByteArrayOutputStream baos = new ByteArrayOutputStream();
  914.                             try {
  915.                                 IOUtils.copy(inputStream, baos);
  916.                                 baos.flush();
  917.                                 baos.close();
  918.                             }catch(Exception e) {
  919.                                 throw new DriverControlStationException(e.getMessage(),e);
  920.                             }
  921.                             if(sb.length()>0) {
  922.                                 sb.append(",");
  923.                             }
  924.                             sb.append(baos.toString());
  925.                         }
  926.                     }
  927.                     if(sb.length()>0) {
  928.                         String v = sb.toString();
  929.                         array = v.split(",");
  930.                         this.mapParametriReaded.put(parameterName, array);
  931.                     }
  932.                 }
  933.             }
  934.             return array;
  935.            
  936.         }
  937.         else {
  938.             return this.request.getParameterValues(parameterName);
  939.         }
  940.     }
  941.    
  942.     @Override
  943.     public String getParameter(String parameterName) throws DriverControlStationException {
  944.         return getParameter(parameterName, String.class, null);
  945.     }

  946.     @Override
  947.     public <T> T getParameter(String parameterName, Class<T> type) throws DriverControlStationException {
  948.         return getParameter(parameterName, type, null);
  949.     }

  950.     @Override
  951.     public <T> T getParameter(String parameterName, Class<T> type, T defaultValue) throws DriverControlStationException {
  952.        
  953.         this.checkErrorInit();
  954.        
  955.        
  956.         T toReturn = null;

  957.         if(type == byte[].class){
  958.             throw new DriverControlStationException("Per leggere un parametro di tipo byte[] utilizzare il metodo getBinaryParameter");
  959.         }

  960.         String paramAsString = null;

  961.         if(this.multipart){
  962.             if(this.mapParametriReaded.containsKey(parameterName)) {
  963.                 paramAsString = (String) this.mapParametriReaded.get(parameterName);
  964.             }
  965.             else {
  966.                 // La lista dovrebbe al massimo avere sempre un solo valore
  967.                 List<InputStream> list = this.mapParametri.get(parameterName);
  968.                 if(list != null && !list.isEmpty()){
  969.                    
  970.                     if(list.size()>1) {
  971.                         throw new DriverControlStationException("Parametro ["+parameterName+"] Duplicato.");
  972.                     }
  973.                     InputStream inputStream = list.get(0);
  974.                     if(inputStream != null){
  975.                         ByteArrayOutputStream baos = new ByteArrayOutputStream();
  976.                         try {
  977.                             IOUtils.copy(inputStream, baos);
  978.                             baos.flush();
  979.                             baos.close();
  980.                         }catch(Exception e) {
  981.                             throw new DriverControlStationException(e.getMessage(),e);
  982.                         }
  983.                         paramAsString = baos.toString();
  984.                         this.mapParametriReaded.put(parameterName, paramAsString);
  985.                     }
  986.                 }
  987.             }
  988.         }else{
  989.             paramAsString = this.request.getParameter(parameterName);
  990.         }

  991.         if(paramAsString != null) {
  992.            
  993.             // Fix: textarea un ritorno a capo viene codificato con \r\n, anche se il valore fornito iniziale possedeva solo lo \n.
  994.             while(paramAsString.contains("\r\n")) {
  995.                 paramAsString = paramAsString.replace("\r\n", "\n");
  996.             }
  997.                        
  998.             try {
  999.                 Constructor<T> constructor = type.getConstructor(String.class);
  1000.                 if(constructor != null)
  1001.                     toReturn = constructor.newInstance(paramAsString);
  1002.                 else
  1003.                     toReturn = type.cast(paramAsString);
  1004.             }catch(Exception e) {
  1005.                 throw new DriverControlStationException(e.getMessage(),e);
  1006.             }
  1007.         }

  1008.         if(toReturn == null && defaultValue != null)
  1009.             return defaultValue;


  1010.         return toReturn;
  1011.     }
  1012.    
  1013.     @Override
  1014.     public byte[] getBinaryParameterContent(String parameterName) throws DriverControlStationException {
  1015.                
  1016.         byte [] b = null;
  1017.        
  1018.         List<byte[]> bpContents = this._getBinaryParameterContent(parameterName);
  1019.        
  1020.         if(bpContents != null && !bpContents.isEmpty())
  1021.             return bpContents.get(0);
  1022.        
  1023.         return b;
  1024.     }
  1025.    
  1026.     @SuppressWarnings("unchecked")
  1027.     public List<byte[]> _getBinaryParameterContent(String parameterName) throws DriverControlStationException {
  1028.        
  1029.         this.checkErrorInit();
  1030.        
  1031.         List<byte[]> bpContents = null;
  1032.         if(this.multipart){
  1033.             if(this.mapParametriReaded.containsKey(parameterName)) {
  1034.                 return (List<byte[]>) this.mapParametriReaded.get(parameterName);
  1035.             }
  1036.             else {
  1037.                 // La lista dovrebbe al massimo avere sempre un solo valore
  1038.                 List<InputStream> list = this.mapParametri.get(parameterName);
  1039.                 if(list != null && !list.isEmpty()){
  1040.                    
  1041.                     bpContents = new ArrayList<byte[]>();
  1042.                     for (InputStream inputStream : list) {
  1043.                         if(inputStream != null){
  1044.                             ByteArrayOutputStream baosInner = new ByteArrayOutputStream();
  1045.                             try {
  1046.                                 IOUtils.copy(inputStream, baosInner);
  1047.                             }catch(Exception e) {
  1048.                                 throw new DriverControlStationException(e.getMessage(),e);
  1049.                             }
  1050.                             byte[] b = baosInner.toByteArray();
  1051.                             bpContents.add(b);
  1052.                         }
  1053.                     }
  1054.                     if(!bpContents.isEmpty()) {
  1055.                         this.mapParametriReaded.put(parameterName, bpContents);
  1056.                         return bpContents;
  1057.                     }
  1058.                 }
  1059.             }
  1060.         }else{
  1061.             // caso che non dovrebbe mai succedere
  1062.             String[] paramAsString = this.request.getParameterValues(parameterName);
  1063.             if(paramAsString != null) {
  1064.                 List<String> tmpStrings = Arrays.asList(paramAsString);
  1065.                 bpContents = tmpStrings.stream().map(e -> e.getBytes()).collect(Collectors.toList());
  1066.             }
  1067.         }

  1068.         return bpContents;
  1069.     }

  1070.     @Override
  1071.     public String getFileNameParameter(String parameterName) throws DriverControlStationException {
  1072.        
  1073.         this.checkErrorInit();
  1074.                
  1075.         if(this.multipart){
  1076.             List<String> tmp = this.mapNomiFileParametri.get(parameterName);
  1077.             return (tmp != null && tmp.size() > 0) ? tmp.get(0) : null;
  1078.         } else
  1079.             return this.request.getParameter(parameterName);

  1080.     }
  1081.    
  1082.     public List<String> getFileNamesParameter(String parameterName) throws DriverControlStationException {
  1083.        
  1084.         this.checkErrorInit();
  1085.                
  1086.         if(this.multipart){
  1087.             List<String> tmp = this.mapNomiFileParametri.get(parameterName);
  1088.             return tmp;
  1089.         } else {
  1090.             String[] tmp = this.request.getParameterValues(parameterName);
  1091.             return (tmp != null && tmp.length > 0) ? Arrays.asList(tmp): null;
  1092.         }

  1093.     }
  1094.    
  1095.     private HashMap<String, byte[]> customBinaryParameters = new HashMap<>();
  1096.     public void registerBinaryParameter(String parameterName, byte[] content) {
  1097.         this.customBinaryParameters.put(parameterName, content);
  1098.     }
  1099.    
  1100.    
  1101.     public BinaryParameter newBinaryParameter(String parameterName) throws DriverControlStationException {
  1102.         BinaryParameter bp = new BinaryParameter();
  1103.         bp.setName(parameterName);
  1104.         return bp;
  1105.     }
  1106.     public BinaryParameter getBinaryParameter(String parameterName) throws DriverControlStationException {
  1107.        
  1108.         this.checkErrorInit();
  1109.                
  1110.         BinaryParameter bp = newBinaryParameter(parameterName);
  1111.         String filename = null;
  1112.         String fileId = null;
  1113.         File file = null;
  1114.         FileOutputStream fos =  null;
  1115.         FileInputStream fis =  null;
  1116.         ByteArrayInputStream bais = null;
  1117.         ByteArrayOutputStream baos = null;
  1118.        
  1119.         byte [] bpContent = null;
  1120.        
  1121.         // 0. provo a prelevarlo dai custom parameters (servizio rs)
  1122.         if(this.customBinaryParameters.containsKey(parameterName)) {
  1123.             bpContent = this.customBinaryParameters.get(parameterName);
  1124.         }
  1125.         else {
  1126.             // 1. provo a prelevare il valore dalla request
  1127.             bpContent = this.getBinaryParameterContent(parameterName);
  1128.         }
  1129.        
  1130.         if(bpContent != null && bpContent.length > 0) {
  1131.             //  cancello eventuale vecchio contenuto
  1132.             filename = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILENAME_PREFIX + parameterName);
  1133.             fileId = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILEID_PREFIX+ parameterName);
  1134.             if(StringUtils.isNotBlank(fileId) && StringUtils.isNotBlank(filename)){
  1135.                 file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX +  fileId + CostantiControlStation.TEMP_FILE_SUFFIX);
  1136.                 if(file.exists()) {
  1137.                     if(!file.delete()) {
  1138.                         // ignore
  1139.                     }
  1140.                 }
  1141.             }

  1142.             //salvataggio nuovo contenuto
  1143.             filename = this.getFileNameParameter(parameterName);
  1144.             try {
  1145.                 file = FileSystemUtilities.createTempFile(CostantiControlStation.TEMP_FILE_PREFIX, CostantiControlStation.TEMP_FILE_SUFFIX);
  1146.             }catch(Exception e) {
  1147.                 throw new DriverControlStationException(e.getMessage(),e);
  1148.             }
  1149.             fileId = file.getName().substring(0, file.getName().indexOf(CostantiControlStation.TEMP_FILE_SUFFIX));
  1150.             fileId = fileId.substring(fileId.indexOf(CostantiControlStation.TEMP_FILE_PREFIX) + CostantiControlStation.TEMP_FILE_PREFIX.length());
  1151.            
  1152.             try{
  1153.                 bais = new ByteArrayInputStream(bpContent);
  1154.                 fos = new FileOutputStream(file);
  1155.                
  1156.                 IOUtils.copy(bais, fos);
  1157.             }catch(Exception e) {
  1158.                 throw new DriverControlStationException(e.getMessage(),e);
  1159.             }
  1160.             finally {
  1161.                 try {
  1162.                     if(bais!=null) {
  1163.                         bais.close();
  1164.                     }
  1165.                 }catch(Exception e) {
  1166.                     // ignore
  1167.                 }
  1168.                 try {
  1169.                     if(fos!=null) {
  1170.                         fos.close();
  1171.                     }
  1172.                 }catch(Exception e) {
  1173.                     // ignore
  1174.                 }
  1175.             }
  1176.            
  1177.            
  1178.         } else {
  1179.             // provo a ricostruire il valore dai campi hidden
  1180.             filename = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILENAME_PREFIX + parameterName);
  1181.             fileId = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILEID_PREFIX+ parameterName);
  1182.            
  1183.             if(StringUtils.isNotBlank(fileId) && StringUtils.isNotBlank(filename)){
  1184.                 file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX + fileId + CostantiControlStation.TEMP_FILE_SUFFIX);
  1185.                
  1186.                 // puo' non esistere allora il valore e' vuoto
  1187.                 if(file.exists()){
  1188.                     try{
  1189.                         fis = new FileInputStream(file);
  1190.                         baos = new ByteArrayOutputStream();
  1191.                        
  1192.                         IOUtils.copy(fis, baos);
  1193.                        
  1194.                         baos.flush();
  1195.                         bpContent = baos.toByteArray();
  1196.                        
  1197.                     }catch(Exception e) {
  1198.                         throw new DriverControlStationException(e.getMessage(),e);
  1199.                     }
  1200.                     finally {
  1201.                         try {
  1202.                             if(fis!=null) {
  1203.                                 fis.close();
  1204.                             }
  1205.                         }catch(Exception e) {
  1206.                             // ignore
  1207.                         }
  1208.                         try {
  1209.                             if(baos!=null) {
  1210.                                 baos.close();
  1211.                             }
  1212.                         }catch(Exception e) {
  1213.                             // ignore
  1214.                         }
  1215.                     }
  1216.                 } else {
  1217.                     bpContent = null;
  1218.                 }
  1219.             } else {
  1220.                 bpContent = null;
  1221.                 filename = null;
  1222.                 fileId = null;
  1223.             }
  1224.         }
  1225.        
  1226.         bp.setValue(bpContent);
  1227.         bp.setFilename(filename);
  1228.         bp.setId(fileId);  
  1229.        
  1230.         // se ho provocato io l'evento di cancellazione via postback allora svuoto il contenuto
  1231.         if(this.isPostBack()) {
  1232.             String postBackElementName = this.getPostBackElementName();
  1233.             if(postBackElementName!=null && postBackElementName.startsWith(parameterName) && postBackElementName.contains(Costanti.PARAMETER_FILENAME_REMOVE_PLACEHOLDER)) {
  1234.                 bp.setValue(null);
  1235.                 bp.setFilename(null);
  1236.                 bp.setId(null);  
  1237.             }
  1238.         }
  1239.        
  1240.         return bp;
  1241.     }
  1242.    
  1243.    
  1244.     public List<BinaryParameter> getBinaryParameters(String parameterName) throws DriverControlStationException {
  1245.        
  1246.         this.checkErrorInit();
  1247.                
  1248. //      BinaryParameter bp = newBinaryParameter(parameterName);
  1249.         String filename = null;
  1250.         String fileId = null;
  1251.         File file = null;
  1252.         FileOutputStream fos =  null;
  1253.         FileInputStream fis =  null;
  1254.         ByteArrayInputStream bais = null;
  1255.         ByteArrayOutputStream baos = null;
  1256.        
  1257.         byte [] bpContent = null;
  1258.        
  1259.         List<byte[]> bpContents = this._getBinaryParameterContent(parameterName);
  1260. //      // 0. provo a prelevarlo dai custom parameters (servizio rs)
  1261. //      if(this.customBinaryParameters.containsKey(parameterName)) {
  1262. //          bpContent = this.customBinaryParameters.get(parameterName);
  1263. //      }
  1264. //      else {
  1265. //          // 1. provo a prelevare il valore dalla request
  1266. //          bpContent = this.getBinaryParameterContent(parameterName);
  1267. //      }
  1268.        
  1269.         List<BinaryParameter> toRet = new ArrayList<BinaryParameter>();
  1270.        
  1271.         // in questa fase dopo la submit successiva alla scelta del file tramite una postback ricevo un array di contenuti vuoti
  1272.         // che devo ignorare per prelevare i valori dai file temporanei
  1273.         boolean ricevutoContenuto = bpContents != null && bpContents.size() >0;
  1274.         if(ricevutoContenuto) {
  1275.             for (int i = 0; i < bpContents.size() ; i++ ) {
  1276.                 bpContent = bpContents.get(i);
  1277.                 // come nel caso singolo, ma questa volta sull'array dei file
  1278.                 if(!(bpContent != null && bpContent.length > 0)) {
  1279.                     ricevutoContenuto = false;
  1280.                     break;
  1281.                 }
  1282.             }
  1283.         }
  1284.        
  1285.         if(ricevutoContenuto) {
  1286.             String fileNames = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILENAME_PREFIX + parameterName);
  1287.             String fileIds = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILEID_PREFIX+ parameterName);
  1288.             if(StringUtils.isNotBlank(fileIds) && StringUtils.isNotBlank(fileNames)){
  1289.                 String[] ids = fileIds.split(",");
  1290.                 for (String id : ids) {
  1291.                     file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX +  id + CostantiControlStation.TEMP_FILE_SUFFIX);
  1292.                     if(file.exists()) {
  1293.                         if(!file.delete()) {
  1294.                             // ignore
  1295.                         }
  1296.                     }
  1297.                 }
  1298.             }
  1299.            
  1300.             List<String> fileNamesParameter = this.getFileNamesParameter(parameterName);
  1301.             //salvataggio nuovo contenuto
  1302.             for (int i = 0; i < bpContents.size() ; i++ ) {
  1303.                 bpContent = bpContents.get(i);
  1304.                 filename = fileNamesParameter.get(i);
  1305.                 try {
  1306.                     file = FileSystemUtilities.createTempFile(CostantiControlStation.TEMP_FILE_PREFIX, CostantiControlStation.TEMP_FILE_SUFFIX);
  1307.                 }catch(Exception e) {
  1308.                     throw new DriverControlStationException(e.getMessage(),e);
  1309.                 }
  1310.                 fileId = file.getName().substring(0, file.getName().indexOf(CostantiControlStation.TEMP_FILE_SUFFIX));
  1311.                 fileId = fileId.substring(fileId.indexOf(CostantiControlStation.TEMP_FILE_PREFIX) + CostantiControlStation.TEMP_FILE_PREFIX.length());
  1312.                
  1313.                 try{
  1314.                     bais = new ByteArrayInputStream(bpContent);
  1315.                     fos = new FileOutputStream(file);
  1316.                    
  1317.                     IOUtils.copy(bais, fos);
  1318.                 }catch(Exception e) {
  1319.                     throw new DriverControlStationException(e.getMessage(),e);
  1320.                 }
  1321.                 finally {
  1322.                     try {
  1323.                         if(bais!=null) {
  1324.                             bais.close();
  1325.                         }
  1326.                     }catch(Exception e) {
  1327.                         // ignore
  1328.                     }
  1329.                     try {
  1330.                         if(fos!=null) {
  1331.                             fos.close();
  1332.                         }
  1333.                     }catch(Exception e) {
  1334.                         // ignore
  1335.                     }
  1336.                 }
  1337.                
  1338.                 BinaryParameter bp = newBinaryParameter(parameterName);
  1339.                 bp.setValue(bpContent);
  1340.                 bp.setFilename(filename);
  1341.                 bp.setId(fileId);  
  1342.                
  1343.                 toRet.add(bp);
  1344.             }
  1345.         } else {
  1346.             // provo a ricostruire il valore dai campi hidden
  1347.             String fileNames = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILENAME_PREFIX + parameterName);
  1348.             String fileIds = this.getParameter(ProtocolPropertiesCostanti.PARAMETER_FILEID_PREFIX+ parameterName);
  1349.            
  1350.             if(StringUtils.isNotBlank(fileIds) && StringUtils.isNotBlank(fileNames)){
  1351.                 List<String> ids = Arrays.asList(fileIds.split(","));
  1352.                 List<String> fileNamesParameter = Arrays.asList(fileNames.split(","));
  1353.                
  1354.                 for (int i = 0; i < ids.size() ; i++ ) {
  1355.                     fileId = ids.get(i);
  1356.                     filename = fileNamesParameter.get(i);
  1357.                     file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX + fileId + CostantiControlStation.TEMP_FILE_SUFFIX);
  1358.                    
  1359.                     // puo' non esistere allora il valore e' vuoto
  1360.                     if(file.exists()){
  1361.                         try{
  1362.                             fis = new FileInputStream(file);
  1363.                             baos = new ByteArrayOutputStream();
  1364.                            
  1365.                             IOUtils.copy(fis, baos);
  1366.                            
  1367.                             baos.flush();
  1368.                             bpContent = baos.toByteArray();
  1369.                            
  1370.                         }catch(Exception e) {
  1371.                             throw new DriverControlStationException(e.getMessage(),e);
  1372.                         }
  1373.                         finally {
  1374.                             try {
  1375.                                 if(fis!=null) {
  1376.                                     fis.close();
  1377.                                 }
  1378.                             }catch(Exception e) {
  1379.                                 // ignore
  1380.                             }
  1381.                             try {
  1382.                                 if(baos!=null) {
  1383.                                     baos.close();
  1384.                                 }
  1385.                             }catch(Exception e) {
  1386.                                 // ignore
  1387.                             }
  1388.                         }
  1389.                     } else {
  1390.                         bpContent = null;
  1391.                     }
  1392.                    
  1393.                     BinaryParameter bp = newBinaryParameter(parameterName);
  1394.                     bp.setValue(bpContent);
  1395.                     bp.setFilename(filename);
  1396.                     bp.setId(fileId);  
  1397.                    
  1398.                     toRet.add(bp);
  1399.                 }
  1400.                
  1401.             }else {
  1402.                 // serve per creare il caso del primo accesso
  1403.                 bpContent = null;
  1404.                 filename = null;
  1405.                 fileId = null;
  1406.                
  1407.                 BinaryParameter bp = newBinaryParameter(parameterName);
  1408.                 bp.setValue(bpContent);
  1409.                 bp.setFilename(filename);
  1410.                 bp.setId(fileId);  
  1411.                
  1412.                 toRet.add(bp);
  1413.             }
  1414.            
  1415.         }
  1416.        
  1417.         // se ho provocato io l'evento di cancellazione via postback allora svuoto il contenuto
  1418.         if(this.isPostBack()) {
  1419.             String postBackElementName = this.getPostBackElementName();
  1420.             if(postBackElementName!=null && postBackElementName.startsWith(parameterName) && postBackElementName.contains(Costanti.PARAMETER_FILENAME_REMOVE_PLACEHOLDER)) {
  1421.                 String[] split = postBackElementName.split(Costanti.PARAMETER_FILENAME_REMOVE_PLACEHOLDER);
  1422.                 try {
  1423.                     int pos = Integer.parseInt(split[1]);
  1424.                     toRet.get(pos).setValue(null);
  1425.                     toRet.get(pos).setFilename(null);
  1426.                     toRet.get(pos).setId(null);  
  1427.                 }catch(Exception e) {
  1428.                    
  1429.                 }
  1430.             }
  1431.         }
  1432.        
  1433.         return toRet;
  1434.     }
  1435.    
  1436.     public String getLockedParameter(String parameterName) throws UtilsException, DriverControlStationException {
  1437.         return getLockedParameter(parameterName, true) ;
  1438.     }
  1439.     public String getLockedParameter(String parameterName, boolean unwrap) throws UtilsException, DriverControlStationException {
  1440.         // 1. leggo il valore del parametro associato all'elemento di tipo password
  1441.         String inputValue = this.getParameter(parameterName);
  1442.        
  1443.         // 2. pwd puo' essere null se non c'e' oppure se e' postback, se viene fatta la submit e' impostata e se corrisponde alla costante allora provo a leggere il valore del parametro hidden associato
  1444.         if( inputValue == null || Costanti.PARAMETER_LOCK_DEFAULT_VALUE.equals(inputValue)) {
  1445.             String lockHiddenValue = this.getParameter(Costanti.PARAMETER_LOCK_PREFIX + parameterName);
  1446.            
  1447.             // 3. unwrap
  1448.             if(this.core.getDriverBYOKUtilities().isEnabledBYOK() && unwrap) {
  1449.                 return this.core.getDriverBYOKUtilities().unwrap(lockHiddenValue);
  1450.             }
  1451.             else {
  1452.                 return lockHiddenValue;
  1453.             }
  1454.         }
  1455.                
  1456.         return inputValue;              
  1457.     }
  1458.    
  1459.     /***
  1460.      * cancella i file temporanei dei parametri binari del protocollo, da usare dopo il salvataggio dell'oggetto.
  1461.      *
  1462.      * @param protocolProperties
  1463.      * @throws DriverControlStationException
  1464.      */
  1465.     public void deleteBinaryProtocolPropertiesTmpFiles(ProtocolProperties protocolProperties) throws DriverControlStationException{
  1466.        
  1467.         this.checkErrorInit();
  1468.                
  1469.         if(protocolProperties!= null)
  1470.             for (int i = 0; i < protocolProperties.sizeProperties(); i++) {
  1471.                 AbstractProperty<?> property = protocolProperties.getProperty(i);
  1472.                 if(property instanceof BinaryProperty){
  1473.                     BinaryProperty bProp = (BinaryProperty) property;
  1474.                     BinaryParameter bp = new BinaryParameter();
  1475.                     bp.setName(bProp.getId());
  1476.                     bp.setFilename(bProp.getFileName());
  1477.                     bp.setId(bProp.getFileId());
  1478.                     bp.setValue(bProp.getValue());
  1479.                    
  1480.                     this.deleteBinaryParameter(bp);
  1481.                 }
  1482.             }
  1483.     }
  1484.    
  1485.     /***
  1486.      *
  1487.      * cancella il file temporaneo del parametro binari del protocollo con id passato come parametro, da usare dopo il salvataggio dell'oggetto.
  1488.      *
  1489.      * @param protocolProperties
  1490.      * @param propertyId
  1491.      * @throws DriverControlStationException
  1492.      */
  1493.     public void deleteBinaryProtocolPropertyTmpFiles(ProtocolProperties protocolProperties, String propertyId) throws DriverControlStationException{
  1494.        
  1495.         this.checkErrorInit();
  1496.                
  1497.         if(protocolProperties!= null)
  1498.             for (int i = 0; i < protocolProperties.sizeProperties(); i++) {
  1499.                 AbstractProperty<?> property = protocolProperties.getProperty(i);
  1500.                 if(property instanceof BinaryProperty && property.getId().equals(propertyId)){
  1501.                     BinaryProperty bProp = (BinaryProperty) property;
  1502.                     BinaryParameter bp = new BinaryParameter();
  1503.                     bp.setName(bProp.getId());
  1504.                     bp.setFilename(bProp.getFileName());
  1505.                     bp.setId(bProp.getFileId());
  1506.                     bp.setValue(bProp.getValue());
  1507.                    
  1508.                     this.deleteBinaryParameter(bp);
  1509.                     break;
  1510.                 }
  1511.             }
  1512.     }
  1513.    
  1514.     /****
  1515.      *
  1516.      * cancella il file temporaneo del parametro binari del protocollo con id e alias passato come parametro, da usare dopo il salvataggio dell'oggetto nella schermata di modifica.
  1517.      *
  1518.      * @param protocolProperties
  1519.      * @param propertyId
  1520.      * @param aliasId
  1521.      * @throws DriverControlStationException
  1522.      */
  1523.     public void deleteBinaryProtocolPropertyTmpFiles(ProtocolProperties protocolProperties, String propertyId, String aliasId) throws DriverControlStationException{
  1524.        
  1525.         this.checkErrorInit();
  1526.                
  1527.         if(protocolProperties!= null)
  1528.             for (int i = 0; i < protocolProperties.sizeProperties(); i++) {
  1529.                 AbstractProperty<?> property = protocolProperties.getProperty(i);
  1530.                 if(property instanceof BinaryProperty && property.getId().equals(propertyId)){
  1531.                     BinaryProperty bProp = (BinaryProperty) property;
  1532.                     BinaryParameter bp = new BinaryParameter();
  1533.                     bp.setName(aliasId);
  1534.                     bp.setFilename(bProp.getFileName());
  1535.                     bp.setId(bProp.getFileId());
  1536.                     bp.setValue(bProp.getValue());
  1537.                    
  1538.                     this.deleteBinaryParameter(bp);
  1539.                     break;
  1540.                 }
  1541.             }
  1542.     }
  1543.    
  1544.     /****
  1545.      *
  1546.      * Cancella tutti i file temporanei dei protocol properties ricevuti, da usare durante la fase di edit e postback.
  1547.      *
  1548.      *
  1549.      * @param parameters
  1550.      * @throws DriverControlStationException
  1551.      */
  1552.     public void deleteProtocolPropertiesBinaryParameters(BinaryParameter ... parameters) throws DriverControlStationException{
  1553.        
  1554.         this.checkErrorInit();
  1555.                
  1556.         File file = null;
  1557.         if(this.idBinaryParameterRicevuti != null && this.idBinaryParameterRicevuti.size() >0){
  1558.             for (String bp : this.idBinaryParameterRicevuti) {
  1559.                 boolean delete = true;
  1560.                 if(parameters != null && parameters.length >0){
  1561.                     for (BinaryParameter binaryParameter : parameters) {
  1562.                         if(binaryParameter.getId() != null && binaryParameter.getId().equals(bp)){
  1563.                             delete = false;
  1564.                             break;
  1565.                         }
  1566.                     }
  1567.                 }
  1568.                
  1569.                 if(delete){
  1570.                     String val = this.getParameter(bp);
  1571.                     file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX +  val + CostantiControlStation.TEMP_FILE_SUFFIX);
  1572.                    
  1573.                     if(file.exists()) {
  1574.                         if(!file.delete()) {
  1575.                             // ignore
  1576.                         }
  1577.                     }
  1578.                 }
  1579.             }
  1580.         }
  1581.     }
  1582.    
  1583.     /***
  1584.      *
  1585.      * Cancella i file temporanei per i parametri passati.
  1586.      *
  1587.      * @param parameters
  1588.      * @throws DriverControlStationException
  1589.      */
  1590.     public void deleteBinaryParameters(BinaryParameter ... parameters) throws DriverControlStationException{
  1591.        
  1592.         this.checkErrorInit();
  1593.                
  1594.         if(parameters != null && parameters.length >0){
  1595.             for (BinaryParameter binaryParameter : parameters) {
  1596.                 this.deleteBinaryParameter(binaryParameter);
  1597.             }
  1598.         }
  1599.     }
  1600.    
  1601.     private void deleteBinaryParameter(BinaryParameter bp) throws DriverControlStationException{
  1602.        
  1603.         this.checkErrorInit();
  1604.                
  1605.         File file = null;
  1606.         if(StringUtils.isNotBlank(bp.getId())){
  1607.             file = new File(getTmpDir() + File.separator + CostantiControlStation.TEMP_FILE_PREFIX +  bp.getId() + CostantiControlStation.TEMP_FILE_SUFFIX);
  1608.            
  1609.             if(file.exists()) {
  1610.                 if(!file.delete()) {
  1611.                     // ignore
  1612.                 }
  1613.             }
  1614.         }
  1615.        
  1616.         bp.setValue(null);
  1617.         bp.setFilename(null);
  1618.         bp.setId(null);
  1619.     }


  1620.     public ProtocolProperties estraiProtocolPropertiesDaRequest(ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  1621.             String propertyId, BinaryParameter contenutoDocumentoParameter) throws DriverControlStationException, UtilsException {
  1622.        
  1623.         this.checkErrorInit();
  1624.        
  1625.         String editMode = this.getParameter(Costanti.DATA_ELEMENT_EDIT_MODE_NAME);
  1626.         String postBackElementName = this.getParameter(Costanti.POSTBACK_ELEMENT_NAME);
  1627.         boolean primoAccessoAdd = (ConsoleOperationType.ADD.equals(consoleOperationType) &&
  1628.                 (editMode==null ||
  1629.                 CostantiControlStation.PARAMETRO_PROTOCOLLO.equals(postBackElementName) ||  // per default in accordo parte comune
  1630.                 AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ACCORDO.equals(postBackElementName))  // per default in accordo parte aspecifica
  1631.                 );
  1632.        
  1633.         ProtocolProperties properties = new ProtocolProperties();

  1634.         List<BaseConsoleItem> consoleItems = consoleConfiguration.getConsoleItem();

  1635.         for (BaseConsoleItem item : consoleItems) {
  1636.             // per ora prelevo solo i parametri che possono avere un valore non considero titoli e note
  1637.             if(item instanceof AbstractConsoleItem<?>){
  1638.                 ConsoleItemValueType consoleItemValueType = ProtocolPropertiesUtils.getConsoleItemValueType(item);
  1639.                 if(consoleItemValueType != null){
  1640.                     switch (consoleItemValueType) {
  1641.                     case BINARY:
  1642.                         BinaryParameter bp = contenutoDocumentoParameter;
  1643.                         if(propertyId == null || !propertyId.equals(item.getId())){
  1644.                             bp = this.getBinaryParameter(item.getId());
  1645.                         } else {
  1646.                             bp.setName(item.getId());
  1647.                         }
  1648.                         byte [] binValue = item.isLockedType() ? this.core.getDriverBYOKUtilities().unwrap(bp.getValue()) : bp.getValue();
  1649.                         BinaryProperty binaryProperty = ProtocolPropertiesFactory.newProperty(bp.getName(), binValue, bp.getFilename(), bp.getId());
  1650.                         properties.addProperty(binaryProperty);
  1651.                         break;
  1652.                     case NUMBER:
  1653.                         String lvS = item.isLockedType() ? this.getLockedParameter(item.getId()) : this.getParameter(item.getId());
  1654.                         Long longValue = null;
  1655.                         try{
  1656.                             // soluzione necessaria perche' il tipo di dato number puo' essere utilizzato anche negli input di tipo text che possono non controllare il tipo di dato inserito
  1657.                             longValue = StringUtils.isNotEmpty(lvS) ? Long.parseLong(lvS) : null;
  1658.                         }catch(NumberFormatException e) {
  1659.                             longValue = null;
  1660.                         }
  1661.                         NumberProperty numberProperty = ProtocolPropertiesFactory.newProperty(item.getId(), longValue);
  1662.                         if(primoAccessoAdd) {
  1663.                             numberProperty.setValue(((NumberConsoleItem) item).getDefaultValue());
  1664.                         }
  1665.                         properties.addProperty(numberProperty);
  1666.                         break;
  1667.                     case BOOLEAN:
  1668.                         String bvS = item.isLockedType() ? this.getLockedParameter(item.getId()) : this.getParameter(item.getId());
  1669.                         Boolean booleanValue = ServletUtils.isCheckBoxEnabled(bvS);
  1670.                         Boolean falseValue = null;
  1671.                         if(item instanceof BooleanConsoleItem) {
  1672.                             BooleanConsoleItem b = (BooleanConsoleItem) item;
  1673.                             if(!b.isConvertFalseAsNull()) {
  1674.                                 falseValue = false;
  1675.                             }
  1676.                         }
  1677.                         BooleanProperty booleanProperty = ProtocolPropertiesFactory.newProperty(item.getId(), booleanValue ? booleanValue : falseValue);
  1678.                         if(primoAccessoAdd) {
  1679.                             booleanProperty.setValue(((BooleanConsoleItem) item).getDefaultValue());
  1680.                         }
  1681.                         properties.addProperty(booleanProperty);
  1682.                         break;
  1683.                     case STRING:
  1684.                     default:
  1685.                         StringProperty stringProperty = null;
  1686.                         if(ConsoleItemType.MULTI_SELECT.equals(item.getType())) {
  1687.                             String [] parameterValues = this.getParameterValues(item.getId());
  1688.                             String value = parameterValues!=null && parameterValues.length>0 ? ProtocolPropertiesUtils.getValueMultiSelect(parameterValues) : null;
  1689.                             stringProperty = ProtocolPropertiesFactory.newProperty(item.getId(), value);
  1690.                         }
  1691.                         else {
  1692.                             String parameterValue = item.isLockedType() ? this.getLockedParameter(item.getId()) : this.getParameter(item.getId());
  1693.                             stringProperty = ProtocolPropertiesFactory.newProperty(item.getId(), parameterValue);
  1694.                         }
  1695.                         if(primoAccessoAdd) {
  1696.                             stringProperty.setValue(((StringConsoleItem) item).getDefaultValue());
  1697.                         }
  1698.                         properties.addProperty(stringProperty);
  1699.                         break;
  1700.                     }
  1701.                 }
  1702.             }
  1703.         }

  1704.         return properties;
  1705.     }
  1706.     public ProtocolProperties estraiProtocolPropertiesDaRequest(ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType) throws DriverControlStationException, UtilsException {
  1707.        
  1708.         this.checkErrorInit();
  1709.                
  1710.         return estraiProtocolPropertiesDaRequest(consoleConfiguration, consoleOperationType, null , null);
  1711.     }

  1712.     // Prepara il menu'
  1713.     public void makeMenu() throws DriverControlStationException {
  1714.         try {
  1715.             String userLogin = ServletUtils.getUserLoginFromSession(this.session);

  1716.             ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);

  1717.             PermessiUtente pu = null;
  1718.             User u = this.utentiCore.getUser(userLogin);
  1719.             pu = u.getPermessi();

  1720.             Boolean singlePdD = ServletUtils.getObjectFromSession(this.request, this.session, Boolean.class, CostantiControlStation.SESSION_PARAMETRO_SINGLE_PDD);
  1721.             if(singlePdD==null) {
  1722.                 singlePdD = this.core!=null ? this.core.isSinglePdD() : true;
  1723.             }

  1724.             boolean isModalitaAvanzata = this.isModalitaAvanzata();
  1725.             boolean isModalitaCompleta = this.isModalitaCompleta();
  1726.            
  1727.             List<IExtendedMenu> extendedMenu = this.core.getExtendedMenu();

  1728.             List<MenuEntry> menu = new ArrayList<>();

  1729.             boolean showAccordiCooperazione = pu.isAccordiCooperazione() && this.core.isAccordiCooperazioneEnabled();
  1730.            
  1731.             if(pu.isServizi() || showAccordiCooperazione){
  1732.                 Boolean serviziVisualizzaModalitaElenco = ConsoleProperties.getInstance().isEnableServiziVisualizzaModalitaElenco();
  1733.                 // Oggetti del registro compatti
  1734.                 MenuEntry me = new MenuEntry();
  1735.                 String[][] entries = null;
  1736.                 me.setTitle(Costanti.PAGE_DATA_TITLE_LABEL_REGISTRO);

  1737.                 //Calcolo del numero di entries
  1738.                 int totEntries = 0;
  1739.                 // PdD, Soggetti, SA, ASPC e ASPS con permessi S
  1740.                 if(pu.isServizi()){
  1741.                     // Link PdD
  1742.                     if(this.core.isRegistroServiziLocale()){
  1743.                         if(this.core.isGestionePddAbilitata(this)) {
  1744.                             totEntries ++;
  1745.                         }
  1746.                     }

  1747.                     // Soggetti ed SA
  1748.                     totEntries += 2;

  1749.                     // ASPC e ASPS
  1750.                     if(this.core.isRegistroServiziLocale()){
  1751.                         // ASPC
  1752.                         totEntries ++;
  1753.                        
  1754.                         if(isModalitaCompleta) {
  1755.                             totEntries +=1;
  1756.                         } else {
  1757.                             // ASPS vecchia visualizzazione
  1758.                             if(serviziVisualizzaModalitaElenco) {
  1759.                                 totEntries +=2;
  1760.                             }
  1761.                             // ASPS nuova visualizzazione
  1762.                             totEntries +=2;
  1763.                         }
  1764.                     }
  1765.                 }

  1766.                 // Cooperazione e Accordi Composti con permessi P
  1767.                 if(showAccordiCooperazione){
  1768.                     if(this.core.isRegistroServiziLocale()){
  1769.                         totEntries +=2;
  1770.                     }
  1771.                 }

  1772.                 // Ruoli, Token Policy e Scope
  1773.                 if(pu.isServizi()){
  1774.                     if(this.core.isRegistroServiziLocale()){
  1775.                         // ruoli
  1776.                         totEntries +=1;
  1777.                         // scope
  1778.                         totEntries +=1;
  1779.                     }
  1780.                 }
  1781.                
  1782.                 // PA e PD con permessi S e interfaccia avanzata
  1783.                 if(pu.isServizi() && this.isModalitaCompleta()){
  1784.                     totEntries +=2;
  1785.                 }

  1786.                 // Extended Menu
  1787.                 if(extendedMenu!=null){
  1788.                     for (IExtendedMenu extMenu : extendedMenu) {
  1789.                         List<ExtendedMenuItem> list =
  1790.                                 extMenu.getExtendedItemsMenuRegistro(isModalitaAvanzata,
  1791.                                         this.core.isRegistroServiziLocale(), singlePdD, pu);
  1792.                         if(list!=null && list.size()>0){
  1793.                             totEntries +=list.size();
  1794.                         }
  1795.                     }
  1796.                 }

  1797.                 // Creo le entries e le valorizzo
  1798.                 entries = new String[totEntries][2];

  1799.                 int index = 0;
  1800.                 boolean pddVisualizzate = false;
  1801.                 // PdD, Soggetti, SA, ASPC e ASPS con permessi S
  1802.                 if(pu.isServizi()){
  1803.                    
  1804.                     //Link PdD
  1805.                     if(this.core.isRegistroServiziLocale()){
  1806.                         if(this.core.isGestionePddAbilitata(this)) {
  1807.                             pddVisualizzate = true;
  1808.                             entries[index][0] = PddCostanti.LABEL_PDD_MENU_VISUALE_AGGREGATA;
  1809.                             if (singlePdD == false) {
  1810.                                 entries[index][1] = PddCostanti.SERVLET_NAME_PDD_LIST;
  1811.                             }else {
  1812.                                 entries[index][1] = PddCostanti.SERVLET_NAME_PDD_SINGLEPDD_LIST;
  1813.                             }
  1814.                             index++;
  1815.                         }
  1816.                     }

  1817.                     if(pddVisualizzate) {
  1818.                    
  1819.                         // Soggetti
  1820.                         entries[index][0] = SoggettiCostanti.LABEL_SOGGETTI_MENU_VISUALE_AGGREGATA;
  1821.                         entries[index][1] = SoggettiCostanti.SERVLET_NAME_SOGGETTI_LIST;
  1822.                         index++;
  1823.    
  1824.                         //SA
  1825.                         entries[index][0] = ServiziApplicativiCostanti.LABEL_SA_MENU_VISUALE_AGGREGATA;
  1826.                         entries[index][1] = ServiziApplicativiCostanti.SERVLET_NAME_SERVIZI_APPLICATIVI_LIST;
  1827.                         index++;
  1828.                        
  1829.                     }

  1830.                     // ASPC e ASPS
  1831.                     if(this.core.isRegistroServiziLocale()){
  1832.                         //ASPC
  1833.                         if(isModalitaCompleta) {
  1834.                             entries[index][0] = AccordiServizioParteComuneCostanti.LABEL_APC_MENU_VISUALE_AGGREGATA;
  1835.                             entries[index][1] = AccordiServizioParteComuneCostanti.SERVLET_NAME_APC_LIST+"?"+
  1836.                                     AccordiServizioParteComuneCostanti.PARAMETRO_APC_TIPO_ACCORDO+"="+
  1837.                                     AccordiServizioParteComuneCostanti.PARAMETRO_VALORE_APC_TIPO_ACCORDO_PARTE_COMUNE;
  1838.                             index++;
  1839.                         } else {
  1840.                             entries[index][0] = AccordiServizioParteComuneCostanti.LABEL_APC_MENU_VISUALE_AGGREGATA;
  1841.                             entries[index][1] = ApiCostanti.SERVLET_NAME_APC_API_LIST +"?"+
  1842.                                     AccordiServizioParteComuneCostanti.PARAMETRO_APC_TIPO_ACCORDO+"="+
  1843.                                     AccordiServizioParteComuneCostanti.PARAMETRO_VALORE_APC_TIPO_ACCORDO_PARTE_COMUNE;
  1844.                             index++;
  1845.                         }

  1846.                         //ASPS
  1847.                         if(isModalitaCompleta) {
  1848.                             entries[index][0] = AccordiServizioParteSpecificaCostanti.LABEL_APS_MENU_VISUALE_AGGREGATA;
  1849.                             entries[index][1] = AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_LIST+"?"+
  1850.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE+"="+
  1851.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE_VALUE_COMPLETA;
  1852.                             index++;
  1853.                         }
  1854.                         else {
  1855.                             // ASPS vecchia visualizzazione
  1856.                             if(serviziVisualizzaModalitaElenco) {
  1857.                                 entries[index][0] = AccordiServizioParteSpecificaCostanti.LABEL_APS_MENU_VISUALE_AGGREGATA;
  1858.                                 entries[index][1] = AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_LIST+"?"+
  1859.                                         AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE+"="+
  1860.                                         AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE_VALUE_EROGAZIONE;
  1861.                                 index++;
  1862.                                
  1863.                                 entries[index][0] = AccordiServizioParteSpecificaCostanti.LABEL_APS_FRUIZIONI_MENU_VISUALE_AGGREGATA;
  1864.                                 entries[index][1] = AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_LIST+"?"+
  1865.                                         AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE+"="+
  1866.                                         AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE_VALUE_FRUIZIONE;
  1867.                                 index++;
  1868.                             }
  1869.                            
  1870.                             // ASPS nuova visualizzazione
  1871.                             entries[index][0] = ErogazioniCostanti.LABEL_ASPS_EROGAZIONI;
  1872.                             entries[index][1] = ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_LIST+"?"+
  1873.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE+"="+
  1874.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE_VALUE_EROGAZIONE;
  1875.                             index++;
  1876.                            
  1877.                             entries[index][0] = ErogazioniCostanti.LABEL_ASPS_FRUIZIONI;
  1878.                             entries[index][1] = ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_LIST+"?"+
  1879.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE+"="+
  1880.                                     AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_EROGAZIONE_VALUE_FRUIZIONE;
  1881.                             index++;
  1882.                         }
  1883.                     }
  1884.                 }

  1885.                 // Cooperazione e Accordi Composti con permessi P
  1886.                 if(showAccordiCooperazione){
  1887.                     if(this.core.isRegistroServiziLocale()){
  1888.                         //COOPERAZIONE
  1889.                         entries[index][0] = AccordiCooperazioneCostanti.LABEL_AC_MENU_VISUALE_AGGREGATA;
  1890.                         entries[index][1] = AccordiCooperazioneCostanti.SERVLET_NAME_ACCORDI_COOPERAZIONE_LIST;
  1891.                         index++;

  1892.                         // COMPOSTO
  1893.                         entries[index][0] = AccordiServizioParteComuneCostanti.LABEL_ASC_MENU_VISUALE_AGGREGATA;
  1894.                         entries[index][1] = AccordiServizioParteComuneCostanti.SERVLET_NAME_APC_LIST+"?"+
  1895.                                 AccordiServizioParteComuneCostanti.PARAMETRO_APC_TIPO_ACCORDO+"="+
  1896.                                 AccordiServizioParteComuneCostanti.PARAMETRO_VALORE_APC_TIPO_ACCORDO_SERVIZIO_COMPOSTO;
  1897.                         index++;
  1898.                     }
  1899.                 }
  1900.                
  1901.                 if(!pddVisualizzate) {
  1902.                    
  1903.                     // Soggetti
  1904.                     entries[index][0] = SoggettiCostanti.LABEL_SOGGETTI_MENU_VISUALE_AGGREGATA;
  1905.                     entries[index][1] = SoggettiCostanti.SERVLET_NAME_SOGGETTI_LIST;
  1906.                     index++;

  1907.                     // SA
  1908.                     if(this.isModalitaCompleta()) {
  1909.                         entries[index][0] = ServiziApplicativiCostanti.LABEL_SA_MENU_VISUALE_AGGREGATA;
  1910.                     }
  1911.                     else {
  1912.                         entries[index][0] = ServiziApplicativiCostanti.LABEL_APPLICATIVI_MENU_VISUALE_AGGREGATA;
  1913.                     }
  1914.                     entries[index][1] = ServiziApplicativiCostanti.SERVLET_NAME_SERVIZI_APPLICATIVI_LIST;
  1915.                     index++;
  1916.                    
  1917.                 }
  1918.                
  1919.                 // Ruoli, PolicyToken e Scopes
  1920.                 if(pu.isServizi()){
  1921.                     if(this.core.isRegistroServiziLocale()){
  1922.                         entries[index][0] = RuoliCostanti.LABEL_RUOLI;
  1923.                         entries[index][1] = RuoliCostanti.SERVLET_NAME_RUOLI_LIST;
  1924.                         index++;
  1925.                                                
  1926.                         entries[index][0] = ScopeCostanti.LABEL_SCOPES;
  1927.                         entries[index][1] = ScopeCostanti.SERVLET_NAME_SCOPE_LIST;
  1928.                         index++;
  1929.                     }
  1930.                 }

  1931.                 // PA e PD con permessi S e interfaccia avanzata
  1932.                 if(pu.isServizi() && this.isModalitaCompleta()){
  1933.                     //PD
  1934.                     entries[index][0] = PorteDelegateCostanti.LABEL_PD_MENU_VISUALE_AGGREGATA;
  1935.                     entries[index][1] = PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_LIST;
  1936.                     index++;

  1937.                     //PA
  1938.                     entries[index][0] = PorteApplicativeCostanti.LABEL_PA_MENU_VISUALE_AGGREGATA;
  1939.                     entries[index][1] = PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_LIST;
  1940.                     index++;
  1941.                 }

  1942.                 // Extended Menu
  1943.                 if(extendedMenu!=null){
  1944.                     for (IExtendedMenu extMenu : extendedMenu) {
  1945.                         List<ExtendedMenuItem> list =
  1946.                                 extMenu.getExtendedItemsMenuRegistro(isModalitaAvanzata,
  1947.                                         this.core.isRegistroServiziLocale(), singlePdD, pu);
  1948.                         if(list!=null){
  1949.                             for (ExtendedMenuItem extendedMenuItem : list) {
  1950.                                 entries[index][0] = extendedMenuItem.getLabel();
  1951.                                 entries[index][1] = extendedMenuItem.getUrl();
  1952.                                 index++;
  1953.                             }
  1954.                         }
  1955.                     }
  1956.                 }

  1957.                 me.setEntries(entries);
  1958.                 menu.add(me);
  1959.             }




  1960.             if (singlePdD) {

  1961.                 List<ExtendedMenuItem> listStrumenti = null;
  1962.                 if(extendedMenu!=null){
  1963.                     for (IExtendedMenu extMenu : extendedMenu) {
  1964.                         listStrumenti =
  1965.                                 extMenu.getExtendedItemsMenuStrumenti(isModalitaAvanzata,
  1966.                                         this.core.isRegistroServiziLocale(), singlePdD, pu);
  1967.                     }
  1968.                 }
  1969.                
  1970.                 List<String> aliases = this.confCore.getJmxPdDAliases();
  1971.                
  1972.                 boolean showCodaMessaggi = pu.isCodeMessaggi() && this.core.showCodaMessage();
  1973.                
  1974.                 if ( showCodaMessaggi || pu.isAuditing() ||
  1975.                         (pu.isSistema() && aliases!=null && aliases.size()>0) ||
  1976.                         (listStrumenti!=null && listStrumenti.size()>0) ) {
  1977.                     // Se l'utente non ha i permessi "diagnostica", devo
  1978.                     // gestire la reportistica
  1979.                     MenuEntry me = new MenuEntry();
  1980.                     me.setTitle(CostantiControlStation.LABEL_STRUMENTI);

  1981.                     int totEntries = 0;
  1982.                     if(pu.isSistema() && aliases!=null && aliases.size()>0){
  1983.                         totEntries++; // runtime
  1984.                     }
  1985.                     if(this.isModalitaAvanzata() && showCodaMessaggi) {
  1986.                         totEntries++;
  1987.                     }
  1988.                     if(pu.isAuditing()) {
  1989.                         totEntries++;
  1990.                     }

  1991.                     // Extended Menu
  1992.                     if(extendedMenu!=null){
  1993.                         for (IExtendedMenu extMenu : extendedMenu) {
  1994.                             List<ExtendedMenuItem> list =
  1995.                                     extMenu.getExtendedItemsMenuStrumenti(isModalitaAvanzata,
  1996.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  1997.                             if(list!=null && list.size()>0){
  1998.                                 totEntries +=list.size();
  1999.                             }
  2000.                         }
  2001.                     }

  2002.                     String[][] entries = new String[totEntries][2];

  2003.                     int i = 0;

  2004.                     if(pu.isSistema() && aliases!=null && aliases.size()>0){
  2005.                         entries[i][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUNTIME;
  2006.                         entries[i][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD;
  2007.                         i++;
  2008.                     }
  2009.                    
  2010.                     if (pu.isAuditing()) {
  2011.                         entries[i][0] = AuditCostanti.LABEL_AUDIT;
  2012.                         entries[i][1] = AuditCostanti.SERVLET_NAME_AUDITING;
  2013.                         i++;
  2014.                     }
  2015.                     if (this.isModalitaAvanzata() && showCodaMessaggi) {
  2016.                         entries[i][0] = MonitorCostanti.LABEL_MONITOR;
  2017.                         entries[i][1] = MonitorCostanti.SERVLET_NAME_MONITOR;
  2018.                         i++;
  2019.                     }
  2020.                    
  2021.                     // Extended Menu
  2022.                     if(extendedMenu!=null){
  2023.                         for (IExtendedMenu extMenu : extendedMenu) {
  2024.                             List<ExtendedMenuItem> list =
  2025.                                     extMenu.getExtendedItemsMenuStrumenti(isModalitaAvanzata,
  2026.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2027.                             if(list!=null){
  2028.                                 for (ExtendedMenuItem extendedMenuItem : list) {
  2029.                                     entries[i][0] = extendedMenuItem.getLabel();
  2030.                                     entries[i][1] = extendedMenuItem.getUrl();
  2031.                                     i++;
  2032.                                 }
  2033.                             }
  2034.                         }
  2035.                     }

  2036.                     me.setEntries(entries);
  2037.                     menu.add(me);
  2038.                 }
  2039.                
  2040.                

  2041.                 // Label Configurazione
  2042.                 if(pu.isSistema()){

  2043.                     MenuEntry me = new MenuEntry();
  2044.                     me.setTitle(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE);
  2045.                     // Se l'utente ha anche i permessi "utenti", la
  2046.                     // configurazione utente la gestisco dopo
  2047.                     String[][] entries = null;
  2048.                     String[][] entriesUtenti = null;
  2049.                     int dimensioneEntries = 0;


  2050.                     dimensioneEntries = 7; // configurazione, controllo del traffico, tracciamento, registrazioneMessaggi, policy, aa e audit
  2051.                    
  2052.                     if(this.core.isVisualizzaConfigurazioneAllarmiEnabled()) { // configurazione allarmi (solo se sono stati caricati dei plugin di tipo allarme)
  2053.                         dimensioneEntries++; // configurazione allarmi
  2054.                     }
  2055.                    
  2056.                     dimensioneEntries++; // gruppi

  2057.                     if(!isModalitaStandard()) {
  2058.                         dimensioneEntries++; // caches
  2059.                         dimensioneEntries++; // remote stores
  2060.                     }
  2061.                    
  2062.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2063.                         dimensioneEntries++; // importa
  2064.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2065.                             dimensioneEntries++; // esporta
  2066.                             if(isModalitaAvanzata){
  2067.                                 dimensioneEntries++; // elimina
  2068.                             }
  2069.                         }
  2070.                     }
  2071.                     if (!pu.isUtenti()){
  2072.                         //dimensioneEntries++; // change password
  2073.                     }else {
  2074.                         entriesUtenti = getVoceMenuUtenti();
  2075.                         dimensioneEntries += entriesUtenti.length;
  2076.                     }

  2077.                     // Extended Menu
  2078.                     if(extendedMenu!=null){
  2079.                         for (IExtendedMenu extMenu : extendedMenu) {
  2080.                             List<ExtendedMenuItem> list =
  2081.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2082.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2083.                             if(list!=null && list.size()>0){
  2084.                                 dimensioneEntries +=list.size();
  2085.                             }
  2086.                         }
  2087.                     }

  2088.                     entries = new String[dimensioneEntries][2];

  2089.                     int index = 0;
  2090.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE_MENU;
  2091.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE;
  2092.                     index++;
  2093.                     if(!isModalitaStandard()) {
  2094.                         entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHES;
  2095.                         entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE+"?"+
  2096.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES+"="+Costanti.CHECK_BOX_ENABLED;
  2097.                         index++;
  2098.                     }
  2099.                     // remote stores
  2100.                     if(!isModalitaStandard()) {
  2101.                         entries[index][0] = RemoteStoresCostanti.LABEL_CACHE_PDND;
  2102.                         entries[index][1] = RemoteStoresCostanti.SERVLET_NAME_REMOTE_STORES_KEYS_LIST;
  2103.                         index++;
  2104.                     }
  2105.                    
  2106.                    
  2107.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO;
  2108.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO;
  2109.                     index++;
  2110.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO_MENU;
  2111.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI+"?"+
  2112.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE+"="+ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO;
  2113.                     index++;
  2114.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_MESSAGGI_MENU;
  2115.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI+"?"+
  2116.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE+"="+ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_REGISTRAZIONE_MESSAGGI;
  2117.                     index++;
  2118.                     if(this.core.isVisualizzaConfigurazioneAllarmiEnabled()) { // configurazione allarmi (solo se sono stati caricati dei plugin di tipo allarme)
  2119.                         entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI;
  2120.                         entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST;
  2121.                         index++;    
  2122.                     }
  2123.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN;
  2124.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_LIST+"?"+
  2125.                             ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE+"="+ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE_VALORE_TOKEN;
  2126.                     index++;
  2127.                     entries[index][0] = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ATTRIBUTE_AUTHORITY;
  2128.                     entries[index][1] = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_LIST+"?"+
  2129.                             ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE+"="+ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE_VALORE_ATTRIBUTE_AUTHORITY;
  2130.                     index++;
  2131.                    
  2132.                     entries[index][0] = GruppiCostanti.LABEL_GRUPPI;
  2133.                     entries[index][1] = GruppiCostanti.SERVLET_NAME_GRUPPI_LIST;
  2134.                     index++;
  2135.                     // link utenti sotto quello di configurazione  generale
  2136.                     if (pu.isUtenti()) {
  2137.                         for (int j = 0; j < entriesUtenti.length; j++) {
  2138.                             entries[index][0] = entriesUtenti[j][0];
  2139.                             entries[index][1] = entriesUtenti[j][1];
  2140.                             index++;        
  2141.                         }
  2142.                     }
  2143.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2144.                         entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_IMPORT;
  2145.                         entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2146.                                 ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_IMPORT;
  2147.                         index++;
  2148.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2149.                             entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_EXPORT;
  2150.                             entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_EXPORT+"?"+ArchiviCostanti.PARAMETRO_ARCHIVI_EXPORT_TIPO+"="+ArchiveType.CONFIGURAZIONE.name();
  2151.                             index++;

  2152.                             if(isModalitaAvanzata){
  2153.                                 entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_ELIMINA;
  2154.                                 entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2155.                                         ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_ELIMINA;
  2156.                                 index++;
  2157.                             }
  2158.                         }
  2159.                     }
  2160.                     entries[index][0] = AuditCostanti.LABEL_AUDIT;
  2161.                     entries[index][1] = AuditCostanti.SERVLET_NAME_AUDIT;
  2162.                     index++;
  2163.                    
  2164.                     //link cambio password
  2165.                     if (!pu.isUtenti()) {
  2166. //                      entries[index][0] = UtentiCostanti.LABEL_UTENTE;
  2167. //                      entries[index][1] = UtentiCostanti.SERVLET_NAME_UTENTE_CHANGE;
  2168. //                      index++;
  2169.                     }

  2170.                     // Extended Menu
  2171.                     if(extendedMenu!=null){
  2172.                         for (IExtendedMenu extMenu : extendedMenu) {
  2173.                             List<ExtendedMenuItem> list =
  2174.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2175.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2176.                             if(list!=null){
  2177.                                 for (ExtendedMenuItem extendedMenuItem : list) {
  2178.                                     entries[index][0] = extendedMenuItem.getLabel();
  2179.                                     entries[index][1] = extendedMenuItem.getUrl();
  2180.                                     index++;
  2181.                                 }
  2182.                             }
  2183.                         }
  2184.                     }

  2185.                     me.setEntries(entries);
  2186.                     menu.add(me);

  2187.                 }else {

  2188.                     // se non esiste la configurazione, devo cmq gestire il caso se non ho i diritti utente e se posso comunque importare servizi
  2189.                     int dimensioneEntries = 0;
  2190.                     String[][] entriesUtenti = null;
  2191.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2192.                         dimensioneEntries++; // importa
  2193.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2194.                             dimensioneEntries++; // esporta
  2195.                             if(isModalitaAvanzata){
  2196.                                 dimensioneEntries++; // elimina
  2197.                             }
  2198.                         }
  2199.                     }
  2200.                     if(!pu.isUtenti()){
  2201.                         //dimensioneEntries++;  // change password
  2202.                     }else {
  2203.                         entriesUtenti = getVoceMenuUtenti();
  2204.                         dimensioneEntries += entriesUtenti.length;
  2205.                     }

  2206.                     // Extended Menu
  2207.                     if(extendedMenu!=null){
  2208.                         for (IExtendedMenu extMenu : extendedMenu) {
  2209.                             List<ExtendedMenuItem> list =
  2210.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2211.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2212.                             if(list!=null && list.size()>0){
  2213.                                 dimensioneEntries +=list.size();
  2214.                             }
  2215.                         }
  2216.                     }

  2217.                     if(dimensioneEntries>0){
  2218.                         // Comunque devo permettere di cambiare la password ad ogni utente, se l'utente stesso non puo' gestire gli utenti
  2219.                         MenuEntry me = new MenuEntry();
  2220.                         me.setTitle(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE);
  2221.                         String[][] entries = new String[dimensioneEntries][2];
  2222.                         int index = 0;
  2223.                         // link utenti sotto quello di configurazione  generale
  2224.                         if (pu.isUtenti()) {
  2225.                             for (int j = 0; j < entriesUtenti.length; j++) {
  2226.                                 entries[index][0] = entriesUtenti[j][0];
  2227.                                 entries[index][1] = entriesUtenti[j][1];
  2228.                                 index++;        
  2229.                             }
  2230.                         }
  2231.                         if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2232.                             entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_IMPORT;
  2233.                             entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2234.                                     ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_IMPORT;
  2235.                             index++;
  2236.                             if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2237.                                 entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_EXPORT;
  2238.                                 entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_EXPORT+"?"+ArchiviCostanti.PARAMETRO_ARCHIVI_EXPORT_TIPO+"="+ArchiveType.CONFIGURAZIONE.name();
  2239.                                 index++;

  2240.                                 if(isModalitaAvanzata){
  2241.                                     entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_ELIMINA;
  2242.                                     entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2243.                                             ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_ELIMINA;
  2244.                                     index++;        
  2245.                                 }
  2246.                             }
  2247.                         }
  2248.                         if (!pu.isUtenti()) {
  2249. //                          entries[index][0] = UtentiCostanti.LABEL_UTENTE;
  2250. //                          entries[index][1] = UtentiCostanti.SERVLET_NAME_UTENTE_CHANGE;
  2251. //                          index++;
  2252.                         }

  2253.                         // Extended Menu
  2254.                         if(extendedMenu!=null){
  2255.                             for (IExtendedMenu extMenu : extendedMenu) {
  2256.                                 List<ExtendedMenuItem> list =
  2257.                                         extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2258.                                                 this.core.isRegistroServiziLocale(), singlePdD, pu);
  2259.                                 if(list!=null){
  2260.                                     for (ExtendedMenuItem extendedMenuItem : list) {
  2261.                                         entries[index][0] = extendedMenuItem.getLabel();
  2262.                                         entries[index][1] = extendedMenuItem.getUrl();
  2263.                                         index++;
  2264.                                     }
  2265.                                 }
  2266.                             }
  2267.                         }

  2268.                         me.setEntries(entries);
  2269.                         menu.add(me);
  2270.                     }
  2271.                 }

  2272.                
  2273.             } else {

  2274.                 // SinglePdD=false
  2275.                 if(pu.isSistema()){

  2276.                     MenuEntry me = new MenuEntry();
  2277.                     me.setTitle(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE);

  2278.                     // Se l'utente ha anche i permessi "utenti", la
  2279.                     // configurazione utente la gestisco dopo
  2280.                     String[][] entries = null;
  2281.                     String[][] entriesUtenti = null;
  2282.                     int dimensioneEntries = 1; //  audit
  2283.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2284.                         dimensioneEntries++; // importa
  2285.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2286.                             dimensioneEntries++; // esporta
  2287.                             if(isModalitaAvanzata){
  2288.                                 dimensioneEntries++; // elimina
  2289.                             }
  2290.                         }
  2291.                     }
  2292.                     if (!pu.isUtenti()){
  2293.                         dimensioneEntries++; // change password
  2294.                     }else {
  2295.                         entriesUtenti = getVoceMenuUtenti();
  2296.                         dimensioneEntries += entriesUtenti.length;
  2297.                     }

  2298.                     // Extended Menu
  2299.                     if(extendedMenu!=null){
  2300.                         for (IExtendedMenu extMenu : extendedMenu) {
  2301.                             List<ExtendedMenuItem> list =
  2302.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2303.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2304.                             if(list!=null && list.size()>0){
  2305.                                 dimensioneEntries +=list.size();
  2306.                             }
  2307.                         }
  2308.                     }

  2309.                     entries = new String[dimensioneEntries][2];

  2310.                     int index = 0;
  2311.                     // link utenti sotto quello di configurazione  generale
  2312.                     if (pu.isUtenti()) {
  2313.                         if(entriesUtenti!=null) {
  2314.                             for (int j = 0; j < entriesUtenti.length; j++) {
  2315.                                 entries[index][0] = entriesUtenti[j][0];
  2316.                                 entries[index][1] = entriesUtenti[j][1];
  2317.                                 index++;        
  2318.                             }
  2319.                         }
  2320.                     }
  2321.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2322.                         entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_IMPORT;
  2323.                         entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2324.                                 ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_IMPORT;
  2325.                         index++;
  2326.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2327.                             entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_EXPORT;
  2328.                             entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_EXPORT+"?"+ArchiviCostanti.PARAMETRO_ARCHIVI_EXPORT_TIPO+"="+ArchiveType.CONFIGURAZIONE.name();
  2329.                             index++;

  2330.                             if(isModalitaAvanzata){
  2331.                                 entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_ELIMINA;
  2332.                                 entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2333.                                         ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_ELIMINA;
  2334.                                 index++;
  2335.                             }
  2336.                         }
  2337.                     }
  2338.                     entries[index][0] = AuditCostanti.LABEL_AUDIT;
  2339.                     entries[index][1] = AuditCostanti.SERVLET_NAME_AUDIT;
  2340.                     index++;
  2341.                    
  2342.                     if (!pu.isUtenti()) {
  2343.                         entries[index][0] = UtentiCostanti.LABEL_UTENTE;
  2344.                         entries[index][1] = UtentiCostanti.SERVLET_NAME_UTENTE_CHANGE;
  2345.                         index++;
  2346.                     }

  2347.                     // Extended Menu
  2348.                     if(extendedMenu!=null){
  2349.                         for (IExtendedMenu extMenu : extendedMenu) {
  2350.                             List<ExtendedMenuItem> list =
  2351.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2352.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2353.                             if(list!=null){
  2354.                                 for (ExtendedMenuItem extendedMenuItem : list) {
  2355.                                     entries[index][0] = extendedMenuItem.getLabel();
  2356.                                     entries[index][1] = extendedMenuItem.getUrl();
  2357.                                     index++;
  2358.                                 }
  2359.                             }
  2360.                         }
  2361.                     }

  2362.                     me.setEntries(entries);
  2363.                     menu.add(me);

  2364.                 }else {

  2365.                     // se non esiste la configurazione, devo cmq gestire il caso se non ho i diritti utente e se posso comunque importare servizi
  2366.                     int dimensioneEntries = 0;
  2367.                     String[][] entriesUtenti = null;
  2368.                     if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2369.                         dimensioneEntries++; // importa
  2370.                         if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2371.                             dimensioneEntries++; // esporta
  2372.                             if(isModalitaAvanzata){
  2373.                                 dimensioneEntries++; // elimina
  2374.                             }
  2375.                         }
  2376.                     }
  2377.                     if(!pu.isUtenti()){
  2378.                         dimensioneEntries++;  // change password
  2379.                     }else {
  2380.                         entriesUtenti = getVoceMenuUtenti();
  2381.                         dimensioneEntries += entriesUtenti.length;
  2382.                     }

  2383.                     // Extended Menu
  2384.                     if(extendedMenu!=null){
  2385.                         for (IExtendedMenu extMenu : extendedMenu) {
  2386.                             List<ExtendedMenuItem> list =
  2387.                                     extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2388.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2389.                             if(list!=null && list.size()>0){
  2390.                                 dimensioneEntries +=list.size();
  2391.                             }
  2392.                         }
  2393.                     }

  2394.                     if(dimensioneEntries>0){
  2395.                         // Comunque devo permettere di cambiare la password ad ogni utente, se l'utente stesso non puo' gestire gli utenti
  2396.                         MenuEntry me = new MenuEntry();
  2397.                         me.setTitle(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE);
  2398.                         String[][] entries = new String[dimensioneEntries][2];
  2399.                         int index = 0;
  2400.                         // link utenti sotto quello di configurazione  generale
  2401.                         if (pu.isUtenti()) {
  2402.                             if(entriesUtenti!=null) {
  2403.                                 for (int j = 0; j < entriesUtenti.length; j++) {
  2404.                                     entries[index][0] = entriesUtenti[j][0];
  2405.                                     entries[index][1] = entriesUtenti[j][1];
  2406.                                     index++;        
  2407.                                 }
  2408.                             }
  2409.                         }
  2410.                         if(this.core.isShowPulsantiImportExport() && pu.isServizi()){
  2411.                             entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_IMPORT;
  2412.                             entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2413.                                     ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_IMPORT;
  2414.                             index++;
  2415.                             if(exporterUtils.existsAtLeastOneExportMode(ArchiveType.CONFIGURAZIONE, this.request, this.session)){
  2416.                                 entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_EXPORT;
  2417.                                 entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_EXPORT+"?"+ArchiviCostanti.PARAMETRO_ARCHIVI_EXPORT_TIPO+"="+ArchiveType.CONFIGURAZIONE.name();
  2418.                                 index++;

  2419.                                 if(isModalitaAvanzata){
  2420.                                     entries[index][0] = ArchiviCostanti.LABEL_ARCHIVI_ELIMINA;
  2421.                                     entries[index][1] = ArchiviCostanti.SERVLET_NAME_ARCHIVI_IMPORT+"?"+
  2422.                                             ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA+"="+ArchiviCostanti.PARAMETRO_ARCHIVI_IMPORTER_MODALITA_ELIMINA;
  2423.                                     index++;        
  2424.                                 }
  2425.                             }
  2426.                         }
  2427.                         if (!pu.isUtenti()) {
  2428.                             entries[index][0] = UtentiCostanti.LABEL_UTENTE;
  2429.                             entries[index][1] = UtentiCostanti.SERVLET_NAME_UTENTE_CHANGE;
  2430.                             index++;
  2431.                         }

  2432.                         // Extended Menu
  2433.                         if(extendedMenu!=null){
  2434.                             for (IExtendedMenu extMenu : extendedMenu) {
  2435.                                 List<ExtendedMenuItem> list =
  2436.                                         extMenu.getExtendedItemsMenuConfigurazione(isModalitaAvanzata,
  2437.                                                 this.core.isRegistroServiziLocale(), singlePdD, pu);
  2438.                                 if(list!=null){
  2439.                                     for (ExtendedMenuItem extendedMenuItem : list) {
  2440.                                         entries[index][0] = extendedMenuItem.getLabel();
  2441.                                         entries[index][1] = extendedMenuItem.getUrl();
  2442.                                         index++;
  2443.                                     }
  2444.                                 }
  2445.                             }
  2446.                         }

  2447.                         me.setEntries(entries);
  2448.                         menu.add(me);
  2449.                     }

  2450.                 }

  2451.                 boolean showCodaMessaggi = pu.isCodeMessaggi() && this.core.showCodaMessage();
  2452.                
  2453.                 if (pu.isAuditing() || pu.isSistema() || showCodaMessaggi) {
  2454.                     MenuEntry me = new MenuEntry();
  2455.                     me.setTitle(CostantiControlStation.LABEL_STRUMENTI);

  2456.                     String[][] entries = null;
  2457.                     int size = 0;
  2458.                     if (pu.isAuditing()) {
  2459.                         size++;
  2460.                     }
  2461.                     if (pu.isSistema()) {
  2462.                         size++;
  2463.                     }
  2464.                     if (pu.isAuditing()) {
  2465.                         size++;
  2466.                     }

  2467.                     // Extended Menu
  2468.                     if(extendedMenu!=null){
  2469.                         for (IExtendedMenu extMenu : extendedMenu) {
  2470.                             List<ExtendedMenuItem> list =
  2471.                                     extMenu.getExtendedItemsMenuStrumenti(isModalitaAvanzata,
  2472.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2473.                             if(list!=null && list.size()>0){
  2474.                                 size +=list.size();
  2475.                             }
  2476.                         }
  2477.                     }

  2478.                     entries = new String[size][2];

  2479.                     int i = 0;

  2480.                     if (pu.isAuditing()) {
  2481.                         entries[i][0] = AuditCostanti.LABEL_AUDIT;
  2482.                         entries[i][1] = AuditCostanti.SERVLET_NAME_AUDITING;
  2483.                         i++;
  2484.                     }
  2485.                    
  2486.                     if (pu.isSistema()) {
  2487.                         entries[i][0] = OperazioniCostanti.LABEL_OPERAZIONI;
  2488.                         entries[i][1] = OperazioniCostanti.SERVLET_NAME_OPERAZIONI;
  2489.                         i++;
  2490.                     }
  2491.                     if (this.isModalitaAvanzata() && showCodaMessaggi) {
  2492.                         entries[i][0] = MonitorCostanti.LABEL_MONITOR;
  2493.                         entries[i][1] = MonitorCostanti.SERVLET_NAME_MONITOR;
  2494.                         i++;
  2495.                     }

  2496.                     // Extended Menu
  2497.                     if(extendedMenu!=null){
  2498.                         for (IExtendedMenu extMenu : extendedMenu) {
  2499.                             List<ExtendedMenuItem> list =
  2500.                                     extMenu.getExtendedItemsMenuStrumenti(isModalitaAvanzata,
  2501.                                             this.core.isRegistroServiziLocale(), singlePdD, pu);
  2502.                             if(list!=null){
  2503.                                 for (ExtendedMenuItem extendedMenuItem : list) {
  2504.                                     entries[i][0] = extendedMenuItem.getLabel();
  2505.                                     entries[i][1] = extendedMenuItem.getUrl();
  2506.                                     i++;
  2507.                                 }
  2508.                             }
  2509.                         }
  2510.                     }

  2511.                     me.setEntries(entries);
  2512.                     menu.add(me);
  2513.                 }
  2514.             }

  2515.             for (MenuEntry menuEntry : menu) {
  2516.                 String [][] entries = menuEntry.getEntries();
  2517.                 if(entries!=null && entries.length>0) {
  2518.                     for (int i = 0; i < entries.length; i++) {
  2519.                         String [] voce = entries[i];
  2520.                         if(voce[1]!=null && !"".equals(voce[1])) {
  2521.                             String newUrl = voce[1];
  2522.                             if(newUrl.contains("?")) {
  2523.                                 newUrl = newUrl + "&";
  2524.                             }
  2525.                             else {
  2526.                                 newUrl = newUrl + "?";
  2527.                             }
  2528.                             newUrl = newUrl + CostantiControlStation.PARAMETRO_RESET_SEARCH;
  2529.                             newUrl = newUrl + "=";
  2530.                             newUrl = newUrl + Costanti.CHECK_BOX_ENABLED;
  2531.                            
  2532.                            
  2533.                            
  2534.                             // aggiungo l'identificativo del tab
  2535.                             if(this.getTabId() != null) {
  2536.                                 newUrl = newUrl + "&";
  2537.                                 newUrl = newUrl + Costanti.PARAMETER_PREV_TAB_KEY;
  2538.                                 newUrl = newUrl + "=";
  2539.                                 newUrl = newUrl + this.getTabId();
  2540.                             }
  2541.                            
  2542.                             voce[1] = newUrl;
  2543.                         }
  2544.                     }
  2545.                 }
  2546.             }
  2547.            
  2548.            
  2549.             this.pd.setMenu(menu);
  2550.         } catch (Exception e) {
  2551.             this.logError("Exception: " + e.getMessage(), e);
  2552.             throw new DriverControlStationException(e);
  2553.         }
  2554.     }

  2555.     private String[][] getVoceMenuUtenti() {
  2556.         String[][] entries = new String[1][2];
  2557.         entries[0][0] = UtentiCostanti.LABEL_UTENTI;
  2558.         entries[0][1] = UtentiCostanti.SERVLET_NAME_UTENTI_LIST;
  2559.         return entries;
  2560.     }





  2561.     // *** Utilities generiche ***

  2562.     public void initializeFilter(ConsoleSearch ricerca) throws DriverControlStationException {
  2563.         initializeFilter(ricerca, Liste.SOGGETTI);
  2564.         initializeFilter(ricerca, Liste.SERVIZIO_APPLICATIVO);
  2565.         initializeFilter(ricerca, Liste.ACCORDI);
  2566.         initializeFilter(ricerca, Liste.ACCORDI_COOPERAZIONE);
  2567.         initializeFilter(ricerca, Liste.SERVIZI);
  2568.         initializeFilter(ricerca, Liste.PORTE_DELEGATE);
  2569.         initializeFilter(ricerca, Liste.PORTE_APPLICATIVE);
  2570.     }
  2571.     public void initializeFilter(ConsoleSearch ricerca, int idLista) throws DriverControlStationException {
  2572.         // Non devo inizializzare la lista degli utenti
  2573.         if(Liste.UTENTI_SERVIZI != idLista && Liste.UTENTI_SOGGETTI != idLista) {
  2574.             this.setFilterSelectedProtocol(ricerca, idLista);
  2575.         }
  2576.         this.setFilterRuoloServizioApplicativo(ricerca, idLista);
  2577.     }
  2578.    
  2579.     public ConsoleSearch checkSearchParameters(int idLista, ConsoleSearch ricerca)
  2580.             throws DriverControlStationException {
  2581.         try {
  2582.             int limit = ricerca.getPageSize(idLista);
  2583.             int offset = ricerca.getIndexIniziale(idLista);

  2584.             String search = ricerca.getSearchString(idLista);

  2585.             if (this.getParameter(Costanti.SEARCH_INDEX) != null) {
  2586.                 offset = Integer.parseInt(this.getParameter(Costanti.SEARCH_INDEX));
  2587.             }else {
  2588.                 offset = Costanti.INDEX_DEFAULT;
  2589.             }
  2590.             ricerca.setIndexIniziale(idLista, offset);
  2591.            
  2592.             if (this.getParameter(Costanti.SEARCH_PAGE_SIZE) != null) {
  2593.                 limit = Integer.parseInt(this.getParameter(Costanti.SEARCH_PAGE_SIZE));
  2594.             }else {
  2595.                 limit = Costanti.PAGE_SIZE_DEFAULT;
  2596.             }
  2597.             ricerca.setPageSize(idLista, limit);
  2598.            
  2599.             if (this.getParameter(Costanti.SEARCH) != null) {
  2600.                 search = this.getParameter(Costanti.SEARCH);
  2601.                 search = search.trim();
  2602.                 if (search.equals("")) {
  2603.                     ricerca.setSearchString(idLista, org.openspcoop2.core.constants.Costanti.SESSION_ATTRIBUTE_VALUE_RICERCA_UNDEFINED);
  2604.                 } else {
  2605.                     ricerca.setSearchString(idLista, search);
  2606.                 }
  2607.             }
  2608.             else {
  2609.                 if(this.core.isConservaRisultatiRicerca()==false) {
  2610.                     ricerca.setSearchString(idLista, org.openspcoop2.core.constants.Costanti.SESSION_ATTRIBUTE_VALUE_RICERCA_UNDEFINED);
  2611.                 }
  2612.             }
  2613.            
  2614.             int index=0;
  2615.             String nameFilter = PageData.GET_PARAMETRO_FILTER_NAME(index);
  2616.             if(this.core.isConservaRisultatiRicerca()==false) {
  2617.                 ricerca.clearFilters(idLista);
  2618.                 this.initializeFilter(ricerca,idLista);
  2619.             }
  2620.             while (this.getParameter(nameFilter) != null) {
  2621.                 String paramFilterName = this.getParameter(nameFilter);
  2622.                 paramFilterName = paramFilterName.trim();
  2623.                
  2624.                 String paramFilterValue = this.getParameter( PageData.GET_PARAMETRO_FILTER_VALUE(index));
  2625.                 if(paramFilterValue==null) {
  2626.                     paramFilterValue = "";
  2627.                 }
  2628.                 paramFilterValue = paramFilterValue.trim();
  2629.                 if (paramFilterValue.equals("")) {
  2630.                     paramFilterValue = org.openspcoop2.core.constants.Costanti.SESSION_ATTRIBUTE_VALUE_FILTER_UNDEFINED;
  2631.                 }
  2632.                
  2633.                 ricerca.addFilter(idLista, paramFilterName, paramFilterValue);
  2634.                
  2635.                 index++;
  2636.                 nameFilter = PageData.GET_PARAMETRO_FILTER_NAME(index);
  2637.             }

  2638.             return ricerca;
  2639.         } catch (Exception e) {
  2640.             this.logError("Exception: " + e.getMessage(), e);
  2641.             throw new DriverControlStationException(e);
  2642.         }
  2643.     }

  2644.     /**
  2645.      * Indica se si vogliono inviare le operazioni allo smistatore
  2646.      *
  2647.      * @return boolean
  2648.      */
  2649.     public boolean smista() throws DriverControlStationException {
  2650.         try {
  2651.             if(this.core.isUsedByApi()) {
  2652.                 return false;
  2653.             }
  2654.            
  2655.             boolean usaSmistatore = true;
  2656.             Boolean singlePdD = this.core.isSinglePdD();
  2657.             if (singlePdD)
  2658.                 usaSmistatore = false;
  2659.             return usaSmistatore;
  2660.         } catch (Exception e) {
  2661.             this.logError("Exception: " + e.getMessage(), e);
  2662.             throw new DriverControlStationException(e);
  2663.         }
  2664.     }

  2665.     public List<DataElement> addNomeValoreToDati( TipoOperazione tipoOp,List<DataElement> dati, String nome, String valore, boolean enableUpdate) {
  2666.         DataElement de = new DataElement();
  2667.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  2668.         de.setValue(nome);
  2669.         if (tipoOp.equals(TipoOperazione.ADD) || enableUpdate) {
  2670.             de.setType(DataElementType.TEXT_EDIT);
  2671.             de.setRequired(true);
  2672.         } else {
  2673.             de.setType(DataElementType.TEXT);
  2674.         }
  2675.         de.setName(CostantiControlStation.PARAMETRO_NOME);
  2676.         de.setSize(this.getSize());
  2677.         dati.add(de);

  2678.         de = new DataElement();
  2679.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  2680.         de.setValue(valore);
  2681.         de.setType(DataElementType.TEXT_EDIT);
  2682.         de.setName(CostantiControlStation.PARAMETRO_VALORE);
  2683.         de.setSize(this.getSize());
  2684.         de.setRequired(true);
  2685.         dati.add(de);

  2686.         return dati;
  2687.     }
  2688.    
  2689.     public List<DataElement> addNomeValoreProprietaCifrataToDati( TipoOperazione tipoOp,List<DataElement> dati, String nome, String valore, boolean enableUpdate) throws UtilsException {
  2690.         DataElement de = new DataElement();
  2691.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  2692.         de.setValue(nome);
  2693.         if (tipoOp.equals(TipoOperazione.ADD) || enableUpdate) {
  2694.             de.setType(DataElementType.TEXT_EDIT);
  2695.             de.setRequired(true);
  2696.         } else {
  2697.             de.setType(DataElementType.TEXT);
  2698.         }
  2699.         de.setName(CostantiControlStation.PARAMETRO_NOME);
  2700.         de.setSize(this.getSize());
  2701.         dati.add(de);
  2702.        
  2703.         de = new DataElement();
  2704.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  2705.         de.setName(CostantiControlStation.PARAMETRO_VALORE);
  2706.         de.setSize(this.getSize());
  2707.         this.core.getLockUtilities().lockProperty(de, valore);
  2708.         de.setRequired(true);
  2709.         dati.add(de);

  2710.         return dati;
  2711.     }
  2712.    
  2713.     public String wrapValoreProprieta(String valore) throws DriverControlStationException, UtilsException {
  2714.         return wrapValoreProprieta(CostantiControlStation.PARAMETRO_VALORE, valore);
  2715.     }
  2716.     public String wrapValoreProprieta(String nomeParametro, String valore) throws DriverControlStationException, UtilsException {
  2717.         if(valore!=null && StringUtils.isNotEmpty(valore) &&
  2718.             BYOKManager.isEnabledBYOK() &&
  2719.             nomeParametro.equals(this.getPostBackElementName())) {
  2720.             // è stata richiesta la cifratura
  2721.             return this.core.getDriverBYOKUtilities().wrap(valore);
  2722.         }
  2723.         return valore;
  2724.     }
  2725.        
  2726.     public List<DataElement> addHiddenFieldsToDati(TipoOperazione tipoOp, String id, String idsogg, String idPorta,
  2727.             List<DataElement> dati) {
  2728.         return addHiddenFieldsToDati(tipoOp, id, idsogg, idPorta, null, dati);
  2729.     }
  2730.    
  2731.     public List<DataElement> addHiddenFieldsToDati(TipoOperazione tipoOp, String id, String idsogg, String idPorta, String idAsps,
  2732.             List<DataElement> dati) {
  2733.         return addHiddenFieldsToDati(tipoOp, id, idsogg, idPorta, idAsps, null, null, null, dati);
  2734.     }

  2735.     public List<DataElement> addHiddenFieldsToDati(TipoOperazione tipoOp, String id, String idsogg, String idPorta, String idAsps,
  2736.             String idFruizione, String tipoSoggettoFruitore, String nomeSoggettoFruitore,
  2737.             List<DataElement> dati) {

  2738.         DataElement de = new DataElement();
  2739.         if(id!= null){
  2740.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID);
  2741.             de.setValue(id);
  2742.             de.setType(DataElementType.HIDDEN);
  2743.             de.setName(CostantiControlStation.PARAMETRO_ID);
  2744.             dati.add(de);
  2745.         }
  2746.         if(idsogg != null){
  2747.             de = new DataElement();
  2748.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_SOGGETTO);
  2749.             de.setValue(idsogg);
  2750.             de.setType(DataElementType.HIDDEN);
  2751.             de.setName(CostantiControlStation.PARAMETRO_ID_SOGGETTO);
  2752.             dati.add(de);
  2753.         }
  2754.         if(idPorta != null){
  2755.             de = new DataElement();
  2756.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_PORTA);
  2757.             de.setValue(idPorta);
  2758.             de.setType(DataElementType.HIDDEN);
  2759.             de.setName(CostantiControlStation.PARAMETRO_ID_PORTA);
  2760.             dati.add(de);
  2761.         }
  2762.        
  2763.         if(idAsps != null){
  2764.             de = new DataElement();
  2765.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_ASPS);
  2766.             de.setValue(idAsps);
  2767.             de.setType(DataElementType.HIDDEN);
  2768.             de.setName(CostantiControlStation.PARAMETRO_ID_ASPS);
  2769.             dati.add(de);
  2770.         }
  2771.        
  2772.         if(idFruizione != null){
  2773.             de = new DataElement();
  2774.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_FRUIZIONE);
  2775.             de.setValue(idFruizione);
  2776.             de.setType(DataElementType.HIDDEN);
  2777.             de.setName(CostantiControlStation.PARAMETRO_ID_FRUIZIONE);
  2778.             dati.add(de);
  2779.         }
  2780.        
  2781.         if(tipoSoggettoFruitore != null){
  2782.             de = new DataElement();
  2783.             de.setValue(tipoSoggettoFruitore);
  2784.             de.setType(DataElementType.HIDDEN);
  2785.             de.setName(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SOGGETTO_FRUITORE);
  2786.             dati.add(de);
  2787.         }
  2788.        
  2789.         if(nomeSoggettoFruitore != null){
  2790.             de = new DataElement();
  2791.             de.setValue(nomeSoggettoFruitore);
  2792.             de.setType(DataElementType.HIDDEN);
  2793.             de.setName(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SOGGETTO_FRUITORE);
  2794.             dati.add(de);
  2795.         }

  2796.         return dati;
  2797.     }

  2798.     // *** Utilities per i nomi ***
  2799.    
  2800.     // In effetti iniziare con un '.' o un '-' e' brutto, per adesso si elimina questa possibilita
  2801. //  public boolean checkName(String name, String object) throws DriverControlStationException{
  2802. //      // Il nome deve contenere solo lettere e numeri e '_' '-' '.'
  2803. //      if (!RegularExpressionEngine.isMatch(name,"^[0-9A-Za-z_\\-\\.]+$")) {
  2804. //          this.pd.setMessage("Il campo '"+object+"' deve essere formato solo da caratteri, cifre, '_' , '-' e '.'");
  2805. //          return false;
  2806. //      }
  2807. //      return true;
  2808. //  }  

  2809.     public boolean checkNCName(String name, String object) throws DriverControlStationException{
  2810.         // Il nome deve contenere solo lettere e numeri e '_' '-' '.'
  2811.         try {
  2812.             if (!RegularExpressionEngine.isMatch(name,"^[_A-Za-z][\\-\\._A-Za-z0-9]*$")) {
  2813.                 this.pd.setMessage("Il campo '"+object+"' può iniziare solo con un carattere [A-Za-z] o il simbolo '_' e dev'essere formato solo da caratteri, cifre, '_' , '-' e '.'");
  2814.                 return false;
  2815.             }
  2816.         }catch(Exception e) {
  2817.             throw new DriverControlStationException(e.getMessage(),e);
  2818.         }
  2819.         return true;
  2820.     }
  2821.    
  2822.     public boolean checkNCNameAndSerial(String name, String object) throws DriverControlStationException{
  2823.         // Il nome deve contenere solo lettere e numeri e '_' '-' '.'
  2824.         try {
  2825.             if (!RegularExpressionEngine.isMatch(name,"^[_A-Za-z][\\-\\._A-Za-z0-9]*@[0-9]*$")) {
  2826.                 this.pd.setMessage("Il campo '"+object+"' può iniziare solo con un carattere [A-Za-z] o il simbolo '_' e dev'essere formato solo da caratteri, cifre, '_' , '-' e '.', infine deve terminare con @ e numeri interi");
  2827.                 return false;
  2828.             }
  2829.         }catch(Exception e) {
  2830.             throw new DriverControlStationException(e.getMessage(),e);
  2831.         }
  2832.         return true;
  2833.     }
  2834.    
  2835.     public boolean checkSimpleNamePath(String name, String object) throws DriverControlStationException{
  2836.         // Il nome può iniziare solo con un carattere o cifra [0-9A-Za-z] e dev'essere formato solo da caratteri, cifre e '-'
  2837.         try {
  2838.             if (!RegularExpressionEngine.isMatch(name,"^[0-9A-Za-z][\\-A-Za-z0-9]*$")) {
  2839.                 this.pd.setMessage("Il campo '"+object+"' può iniziare solo con un carattere o cifra [0-9A-Za-z] e dev'essere formato solo da caratteri, cifre e '-'");
  2840.                 return false;
  2841.             }
  2842.         }catch(Exception e) {
  2843.             throw new DriverControlStationException(e.getMessage(),e);
  2844.         }
  2845.         return true;
  2846.     }
  2847.    
  2848.     public boolean checkSimpleName(String name, String object) throws DriverControlStationException{
  2849.         try {
  2850.             if (!RegularExpressionEngine.isMatch(name,"^[0-9A-Za-z]+$")) {
  2851.                 this.pd.setMessage("Il campo '"+object+"' deve essere formato solo da caratteri e cifre");
  2852.                 return false;
  2853.             }  
  2854.         }catch(Exception e) {
  2855.             throw new DriverControlStationException(e.getMessage(),e);
  2856.         }
  2857.         return true;
  2858.     }
  2859.    
  2860.     public boolean checkIntegrationEntityName(String name, String object) throws DriverControlStationException{
  2861.         // Il nome deve contenere solo lettere e numeri e '_' '-' '.' '/'
  2862.         try {
  2863.             if (!RegularExpressionEngine.isMatch(name,"^[_A-Za-z][\\-\\._/A-Za-z0-9]*$")) {
  2864.                 this.pd.setMessage("Il campo '"+object+"' può iniziare solo con un carattere [A-Za-z] o il simbolo '_' e dev'essere formato solo da caratteri, cifre, '_' , '-', '.' e '/'");
  2865.                 return false;
  2866.             }
  2867.         }catch(Exception e) {
  2868.             throw new DriverControlStationException(e.getMessage(),e);
  2869.         }
  2870.         return true;
  2871.     }
  2872.    
  2873.    
  2874.     public boolean checkNumber(String value, String object, boolean permitZeroAsValue) throws DriverControlStationException{
  2875.         if(permitZeroAsValue){
  2876.             try {
  2877.                 if (!RegularExpressionEngine.isMatch(value,"^[0-9]+$")) {
  2878.                     this.pd.setMessage("Il campo '"+object+"' deve essere formato solo da cifre");
  2879.                     return false;
  2880.                 }  
  2881.             }catch(Exception e) {
  2882.                 throw new DriverControlStationException(e.getMessage(),e);
  2883.             }
  2884.         }
  2885.         else{
  2886.             try {
  2887.                 if (!RegularExpressionEngine.isMatch(value,"^[1-9]+[0-9]*$")) {
  2888.                     if(value.charAt(0) == '0' && value.length()>1){
  2889.                         this.pd.setMessage("Il campo '"+object+"' deve contenere un numero intero maggiore di zero e non deve iniziare con la cifra '0'");
  2890.                     }else{
  2891.                         this.pd.setMessage("Il campo '"+object+"' deve contenere un numero intero maggiore di zero");
  2892.                     }
  2893.                     return false;
  2894.                 }
  2895.             }catch(Exception e) {
  2896.                 throw new DriverControlStationException(e.getMessage(),e);
  2897.             }
  2898.         }
  2899.         return true;
  2900.     }
  2901.    
  2902.     public boolean checkLength4000(String value, String object) throws DriverControlStationException{
  2903.         return this.checkLength(value, object, -1, 4000);
  2904.     }
  2905.     public boolean checkLength255(String value, String object) throws DriverControlStationException{
  2906.         return this.checkLength(value, object, -1, 255);
  2907.     }
  2908.     public boolean checkLengthSubject_SSL_Principal(String value, String object) throws DriverControlStationException{
  2909.         return this.checkLength(value, object, -1, 2800);
  2910.     }
  2911.     public boolean checkLength(String value, String object, int minLength, int maxLength) throws DriverControlStationException{
  2912.         if(minLength>0) {
  2913.             if(value==null || value.length()<minLength) {
  2914.                 this.pd.setMessage("L'informazione fornita nel campo '"+object+"' deve possedere una lunghezza maggiore di "+(minLength-1));
  2915.                 return false;
  2916.             }
  2917.         }
  2918.         if(maxLength>0) {
  2919.             if(value!=null && value.length()>maxLength) {
  2920.                 this.pd.setMessage("L'informazione fornita nel campo '"+object+"' deve possedere una lunghezza minore di "+maxLength);
  2921.                 return false;
  2922.             }
  2923.         }
  2924.         return true;
  2925.     }
  2926.    
  2927.     public boolean checkSpazi(String value, String object) throws DriverControlStationException{
  2928.         if(value.contains(" ")) {
  2929.             this.pd.setMessage("L'informazione fornita nel campo '"+object+"' non deve contenere spazi");
  2930.             return false;
  2931.         }
  2932.         return true;
  2933.     }

  2934.     public boolean checkEmail(String email, String object) throws DriverControlStationException{
  2935.         // Email deve rispettare il pattern
  2936.         try {
  2937.             if (!RegularExpressionEngine.isMatch(email,CostantiControlStation.EMAIL_PATTERN)) {
  2938.                 this.pd.setMessage("Il campo '"+object+"' non contiene un indirizzo e-mail valido");
  2939.                 return false;
  2940.             }
  2941.         }catch(Exception e) {
  2942.             throw new DriverControlStationException(e.getMessage(),e);
  2943.         }
  2944.         return true;
  2945.     }
  2946.    
  2947.     public boolean checkRegexp(String pattern, String object) throws DriverControlStationException{
  2948.         try {
  2949.             RegularExpressionEngine.validate(pattern);
  2950.         }catch(Exception e) {
  2951.             this.pd.setMessage("Il campo '"+object+"' non contiene un'espressione regolare valida: "+e.getMessage());
  2952.             return false;
  2953.         }
  2954.         return true;
  2955.     }
  2956.    
  2957.     public boolean checkXPath(String pattern, String object) throws DriverControlStationException{
  2958.         try {
  2959.             AbstractXPathExpressionEngine engine = new XPathExpressionEngine();
  2960.             engine.validate(pattern);
  2961.         }catch(Exception e) {
  2962.             this.pd.setMessage("Il campo '"+object+"' non contiene un'espressione xpath valida: "+e.getMessage());
  2963.             return false;
  2964.         }
  2965.         return true;
  2966.     }
  2967.     public boolean checkJsonPath(String pattern, String object) throws DriverControlStationException{
  2968.         try {
  2969.             JsonXmlPathExpressionEngine.validate(pattern, this.log); // per poter validare anche la funzionalità 'Espressioni XPath su messaggi JSON'
  2970.         }catch(Exception e) {
  2971.             this.pd.setMessage("Il campo '"+object+"' non contiene un'espressione json-path valida: "+e.getMessage());
  2972.             return false;
  2973.         }
  2974.         return true;
  2975.     }
  2976.     public boolean checkXPathOrJsonPath(String pattern, String object) throws DriverControlStationException{
  2977.         StringBuilder sb = new StringBuilder();
  2978.         try {
  2979.             AbstractXPathExpressionEngine engine = new XPathExpressionEngine();
  2980.             engine.validate(pattern);
  2981.             return true;
  2982.         }catch(Exception e) {
  2983.             if(sb.length()>0) {
  2984.                 sb.append("<BR/>");
  2985.                 sb.append("<BR/>");
  2986.             }
  2987.             sb.append("XPath: "+e.getMessage());
  2988.         }
  2989.         try {
  2990.             JsonXmlPathExpressionEngine.validate(pattern, this.log); // per poter validare anche la funzionalità 'Espressioni XPath su messaggi JSON'
  2991.             return true;
  2992.         }catch(Exception e) {
  2993.             if(sb.length()>0) {
  2994.                 sb.append("<BR/>");
  2995.                 sb.append("<BR/>");
  2996.             }
  2997.             sb.append("JsonPath: "+e.getMessage());
  2998.         }
  2999.         if(sb.length()>0) {
  3000.             this.pd.setMessage("Il campo '"+object+"' contiene un'espressione non validabile né come XPath né come JsonPath:"+"<BR/><BR/>"+sb.toString());
  3001.             return false;
  3002.         }
  3003.         return true;
  3004.     }
  3005.    
  3006.    
  3007.     // *** Utilities condivise tra Porte Delegate e Porte Applicative ***
  3008.    
  3009.     public List<DataElement> addPorteServizioApplicativoToDati(TipoOperazione tipoOp, List<DataElement> dati,
  3010.             String servizioApplicativo, String[] servizioApplicativoList, int sizeAttuale,
  3011.             boolean addMsgServiziApplicativoNonDisponibili, boolean addTitle,
  3012.             boolean isToken) {
  3013.        
  3014.         if(isToken) {
  3015.             DataElement de = new DataElement();
  3016.             de.setType(DataElementType.HIDDEN);
  3017.             de.setName(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION);
  3018.             de.setValue("true");
  3019.             dati.add(de);
  3020.         }
  3021.        
  3022.         if(servizioApplicativoList!=null && servizioApplicativoList.length>0){
  3023.        
  3024.             String labelApplicativo = CostantiControlStation.LABEL_PARAMETRO_SERVIZIO_APPLICATIVO;
  3025.             if(!this.isModalitaCompleta()) {
  3026.                 labelApplicativo = CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO;
  3027.             }
  3028.            
  3029.             if(addTitle) {
  3030.                 DataElement de = new DataElement();
  3031.                 de.setType(DataElementType.TITLE);
  3032.                 de.setLabel(labelApplicativo);
  3033.                 dati.add(de);
  3034.             }
  3035.            
  3036.             DataElement de = new DataElement();
  3037.             de.setLabel( CostantiControlStation.LABEL_PARAMETRO_NOME );
  3038.             de.setType(DataElementType.SELECT);
  3039.             de.setName(CostantiControlStation.PARAMETRO_SERVIZIO_APPLICATIVO);
  3040.             de.setValues(servizioApplicativoList);
  3041.             de.setSelected(servizioApplicativo);
  3042.             dati.add(de);
  3043.            
  3044.         }else{
  3045.             if(addMsgServiziApplicativoNonDisponibili){
  3046.                 if(sizeAttuale>0){
  3047.                     this.pd.setMessage("Non esistono ulteriori servizi applicativi associabili alla porta",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3048.                 }
  3049.                 else{
  3050.                     this.pd.setMessage("Non esistono servizi applicativi associabili alla porta",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3051.                 }
  3052.                 this.pd.disableEditMode();
  3053.             }
  3054.         }

  3055.         return dati;
  3056.     }
  3057.    
  3058.     public List<DataElement> addPorteSoggettoToDati(TipoOperazione tipoOp, List<DataElement> dati,
  3059.             String[] soggettiLabelList, String[] soggettiList, String soggetto, int sizeAttuale,
  3060.                 boolean addMsgSoggettiNonDisponibili, boolean addTitle) {
  3061.            
  3062.             if(soggettiList!=null && soggettiList.length>0){
  3063.            
  3064.                 if(addTitle) {
  3065.                     DataElement de = new DataElement();
  3066.                     de.setType(DataElementType.TITLE);
  3067.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SOGGETTO);
  3068.                     dati.add(de);
  3069.                 }
  3070.                
  3071.                 DataElement de = new DataElement();
  3072.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  3073.                 de.setType(DataElementType.SELECT);
  3074.                 de.setName(CostantiControlStation.PARAMETRO_SOGGETTO);
  3075.                 de.setLabels(soggettiLabelList);
  3076.                 de.setValues(soggettiList);
  3077.                 de.setSelected(soggetto);
  3078.                 dati.add(de);
  3079.                
  3080.             }else{
  3081.                 if(addMsgSoggettiNonDisponibili){
  3082.                     if(sizeAttuale>0){
  3083.                         this.pd.setMessage("Non esistono ulteriori soggetti associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3084.                     }
  3085.                     else{
  3086.                         this.pd.setMessage("Non esistono soggetti associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3087.                     }
  3088.                     this.pd.disableEditMode();
  3089.                 }
  3090.             }

  3091.             return dati;
  3092.         }

  3093.     public List<DataElement> addPorteServizioApplicativoAutorizzatiToDati(TipoOperazione tipoOp, List<DataElement> dati,
  3094.             String[] soggettiLabelList, String[] soggettiList, String soggetto, int sizeAttuale,
  3095.             Map<String,List<IDServizioApplicativoDB>> listServiziApplicativi, String sa,
  3096.             boolean addMsgApplicativiNonDisponibili, boolean showTitle, boolean isAutorizzazioneModi,
  3097.             boolean isSupportatoAutenticazioneApplicativiEsterni,
  3098.             boolean isToken) {
  3099.            
  3100.         if(isAutorizzazioneModi) {
  3101.             DataElement de = new DataElement();
  3102.             de.setType(DataElementType.HIDDEN);
  3103.             de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA);
  3104.             de.setValue("true");
  3105.             dati.add(de);
  3106.         }
  3107.        
  3108.         if(isToken) {
  3109.             DataElement de = new DataElement();
  3110.             de.setType(DataElementType.HIDDEN);
  3111.             de.setName(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION);
  3112.             de.setValue("true");
  3113.             dati.add(de);
  3114.         }
  3115.        
  3116.         if(soggettiList!=null && soggettiList.length>0 && listServiziApplicativi!=null && listServiziApplicativi.size()>0){
  3117.        
  3118.             if(showTitle) {
  3119.                 DataElement de = new DataElement();
  3120.                 de.setType(DataElementType.TITLE);
  3121.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO);
  3122.                 dati.add(de);
  3123.             }
  3124.            
  3125.             DataElement de = new DataElement();
  3126.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SOGGETTO);
  3127.             de.setName(CostantiControlStation.PARAMETRO_SOGGETTO);
  3128.             de.setValue(soggetto);
  3129.             if(this.core.isMultitenant() || isSupportatoAutenticazioneApplicativiEsterni) {
  3130.                 de.setType(DataElementType.SELECT);
  3131.                 de.setLabels(soggettiLabelList);
  3132.                 de.setValues(soggettiList);
  3133.                 de.setSelected(soggetto);
  3134.                 de.setPostBack(true);
  3135.             }
  3136.             else {
  3137.                 de.setType(DataElementType.HIDDEN);
  3138.             }
  3139.             dati.add(de);
  3140.            
  3141.             List<IDServizioApplicativoDB> listSA = null;
  3142.             if(soggetto!=null && !"".equals(soggetto)) {
  3143.                 listSA = listServiziApplicativi.get(soggetto);
  3144.             }
  3145.            
  3146.             if(listSA!=null && !listSA.isEmpty()) {
  3147.                
  3148.                 String [] saValues = new String[listSA.size()];
  3149.                 String [] saLabels = new String[listSA.size()];
  3150.                 int index =0;
  3151.                 for (IDServizioApplicativoDB saObject : listSA) {
  3152.                     saValues[index] = saObject.getId().longValue()+"";
  3153.                     saLabels[index] = saObject.getNome();
  3154.                     index++;
  3155.                 }
  3156.                
  3157.                 de = new DataElement();
  3158.                 if(showTitle) {
  3159.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  3160.                 }
  3161.                 else {
  3162.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO);
  3163.                 }
  3164.                 de.setType(DataElementType.SELECT);
  3165.                 de.setName(CostantiControlStation.PARAMETRO_SERVIZIO_APPLICATIVO_AUTORIZZATO);
  3166.                 de.setLabels(saLabels);
  3167.                 de.setValues(saValues);
  3168.                 de.setSelected(sa);
  3169.                 dati.add(de);
  3170.                
  3171.             }
  3172.             else {
  3173.                 this.pd.setMessage("Non esistono applicativi associabili per il soggetto selezionato",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3174.                 this.pd.disableEditMode();
  3175.             }
  3176.            
  3177.         }else{
  3178.             if(addMsgApplicativiNonDisponibili){
  3179.                 if(sizeAttuale>0){
  3180.                     this.pd.setMessage("Non esistono ulteriori applicativi associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3181.                 }
  3182.                 else{
  3183.                     this.pd.setMessage("Non esistono applicativi associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  3184.                 }
  3185.                 this.pd.disableEditMode();
  3186.             }
  3187.         }

  3188.         return dati;
  3189.     }

  3190.    
  3191.     // Controlla i dati del Message-Security
  3192.     public boolean WSCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
  3193.         try{
  3194.             String messageSecurity = this.getParameter(CostantiControlStation.PARAMETRO_MESSAGE_SECURITY);

  3195.             // Controllo che i campi "select" abbiano uno dei valori ammessi
  3196.             if (!messageSecurity.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_ABILITATO) &&
  3197.                     !messageSecurity.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_DISABILITATO)) {
  3198.                 this.pd.setMessage("Stato dev'essere abilitato o disabilitato");
  3199.                 return false;
  3200.             }
  3201.            
  3202.             if (messageSecurity.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_ABILITATO)){
  3203.                 String req = this.getParameter(CostantiControlStation.PARAMETRO_REQUEST_FLOW_PROPERTIES_CONFIG_NAME);
  3204.                 String res = this.getParameter(CostantiControlStation.PARAMETRO_RESPONSE_FLOW_PROPERTIES_CONFIG_NAME);
  3205.                 if(
  3206.                         (req==null || "".equals(req) || CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO.equals(req))
  3207.                         &&
  3208.                         (res==null || "".equals(res) || CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO.equals(res))
  3209.                         ) {
  3210.                     this.pd.setMessage("Almeno uno schema di sicurezza per la richiesta o per la risposta dev'essere abilitato");
  3211.                     return false;
  3212.                 }
  3213.             }
  3214.            
  3215.             return true;
  3216.         } catch (Exception e) {
  3217.             this.logError("Exception: " + e.getMessage(), e);
  3218.             throw new DriverControlStationException(e);
  3219.         }
  3220.     }

  3221.     public List<DataElement> addMessageSecurityToDati(List<DataElement> dati,boolean delegata,long idPorta,
  3222.                 String messageSecurity, String url1, String url2, Boolean contaListe, int numWSreq, int numWSres, boolean showApplicaMTOMReq, String applicaMTOMReq,
  3223.                 boolean showApplicaMTOMRes, String applicaMTOMRes,String idPropConfigReq, String idPropConfigRes,
  3224.                 String[] propConfigReqLabelList, String[] propConfigReqList, String[] propConfigResLabelList, String[] propConfigResList,String oldIdPropConfigReq, String oldIdPropConfigRes) {


  3225.         DataElement de = new DataElement();
  3226.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_MESSAGE_SECURITY);
  3227.         de.setType(DataElementType.TITLE);
  3228.         dati.add(de);
  3229.        
  3230.        
  3231.         de = new DataElement();
  3232.         String[] tipoWS = {
  3233.                 CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_ABILITATO,
  3234.                 CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_DISABILITATO
  3235.         };

  3236.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_STATO);
  3237.         de.setType(DataElementType.SELECT);
  3238.         de.setName(CostantiControlStation.PARAMETRO_MESSAGE_SECURITY);
  3239.         de.setValues(tipoWS);
  3240.         de.setSelected(messageSecurity);
  3241.         de.setPostBack(true);
  3242.         dati.add(de);

  3243.         if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_SECURITY_ABILITATO.equals(messageSecurity)){
  3244.             //          de = new DataElement();
  3245.             //          de.setLabel(CostantiControlStation.LABEL_PARAMETRO_MESSAGE_SECURITY);
  3246.             //          de.setType(DataElementType.TITLE);
  3247.             //          dati.add(de);

  3248.             // Sezione Richiesta
  3249.             de = new DataElement();
  3250.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RICHIESTA);
  3251.             de.setType(DataElementType.TITLE);
  3252.             dati.add(de);

  3253.             // Applica MTOM Richiesta
  3254.             de = new DataElement();
  3255.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_APPLICA_MTOM);
  3256.             if(showApplicaMTOMReq){
  3257.                 de.setType(DataElementType.CHECKBOX);
  3258.                 if( ServletUtils.isCheckBoxEnabled(applicaMTOMReq) || CostantiRegistroServizi.ABILITATO.equals(applicaMTOMReq) ){
  3259.                     de.setSelected(true);
  3260.                 }
  3261.             } else {
  3262.                 de.setType(DataElementType.HIDDEN);
  3263.                 de.setValue(applicaMTOMReq);
  3264.             }
  3265.             de.setName(CostantiControlStation.PARAMETRO_APPLICA_MTOM_RICHIESTA);
  3266.             dati.add(de);
  3267.            
  3268.             de = new DataElement();
  3269.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_REQUEST_FLOW_PROPERTIES_CONFIG_NAME);
  3270.             de.setName(CostantiControlStation.PARAMETRO_REQUEST_FLOW_PROPERTIES_CONFIG_NAME);
  3271.             if(propConfigReqList.length > 1){
  3272.                 de.setType(DataElementType.SELECT);
  3273.                 de.setLabels(propConfigReqLabelList);
  3274.                 de.setValues(propConfigReqList);
  3275.                 de.setSelected(idPropConfigReq);
  3276.                 de.setPostBack(true);
  3277.             }else{
  3278.                 de.setType(DataElementType.HIDDEN);
  3279.                 de.setValue(idPropConfigReq);
  3280.             }
  3281.             dati.add(de);

  3282.             if(idPropConfigReq.equals(oldIdPropConfigReq) && !idPropConfigReq.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) { // finche' non applico la modifica questi due valori saranno diversi
  3283.                 de = new DataElement();
  3284.                 de.setType(DataElementType.LINK);
  3285.                 de.setUrl(url1);
  3286.                 if(idPropConfigReq.equals(CostantiControlStation.VALUE_PARAMETRO_PROPERTIES_MODE_DEFAULT)) {
  3287.                     if (contaListe)
  3288.                         de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI+"(" + numWSreq + ")");
  3289.                     else
  3290.                         de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI);
  3291.                 } else {
  3292.                     if(numWSreq<=0) {
  3293.                         boolean editModeInProgress = true;
  3294.                         try {
  3295.                             editModeInProgress = this.isEditModeInProgress();
  3296.                         }catch(Exception e) {
  3297.                             // ignore
  3298.                         }
  3299.                         if(!editModeInProgress) {
  3300.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_PROCEDI);
  3301.                         }
  3302.                         else {
  3303.                            
  3304.                             DataElement note = new DataElement();
  3305.                             note.setBold(true);
  3306.                             note.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA_LABEL);
  3307.                             note.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA);
  3308.                             note.setType(DataElementType.NOTE);
  3309.                             dati.add(note);
  3310.                            
  3311.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_COMPLETA);
  3312.                         }
  3313.                     }
  3314.                     else {
  3315.                         // Se cambia l'xml potrebbe succedere
  3316.                         boolean valida = false;
  3317.                         try {
  3318.                             PropertiesSourceConfiguration propertiesSourceConfiguration = this.core.getMessageSecurityPropertiesSourceConfiguration();
  3319.                             ConfigManager configManager = ConfigManager.getinstance(ControlStationCore.getLog());
  3320.                             Config configurazione = configManager.getConfigurazione(propertiesSourceConfiguration, idPropConfigReq);
  3321.                             Map<String, Properties> mappaDB = null;
  3322.                             if(delegata) {
  3323.                                 mappaDB = this.porteDelegateCore.readMessageSecurityRequestPropertiesConfiguration(idPorta);
  3324.                             }
  3325.                             else {
  3326.                                 mappaDB = this.porteApplicativeCore.readMessageSecurityRequestPropertiesConfiguration(idPorta);
  3327.                             }
  3328.                             ConfigBean configurazioneBean = this.porteApplicativeCore.leggiConfigurazione(configurazione, mappaDB);
  3329.                             valida = this.checkPropertiesConfigurationData(TipoOperazione.OTHER, configurazioneBean, null, null, configurazione);
  3330.                         }catch(Exception e) {
  3331.                             this.logError(e.getMessage(),e);
  3332.                         }
  3333.                         if(valida) {
  3334.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES);
  3335.                         }
  3336.                         else {
  3337.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_COMPLETA);
  3338.                         }
  3339.                     }
  3340.                 }
  3341.                 dati.add(de);
  3342.             }

  3343.             // Sezione Risposta
  3344.             de = new DataElement();
  3345.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RISPOSTA);
  3346.             de.setType(DataElementType.TITLE);
  3347.             dati.add(de);

  3348.             // Applica MTOM Risposta
  3349.             de = new DataElement();
  3350.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_APPLICA_MTOM);
  3351.             if(showApplicaMTOMRes){
  3352.                 de.setType(DataElementType.CHECKBOX);
  3353.                 if( ServletUtils.isCheckBoxEnabled(applicaMTOMRes) || CostantiRegistroServizi.ABILITATO.equals(applicaMTOMRes) ){
  3354.                     de.setSelected(true);
  3355.                 }
  3356.             } else {
  3357.                 de.setType(DataElementType.HIDDEN);
  3358.                 de.setValue(applicaMTOMRes);
  3359.             }
  3360.             de.setName(CostantiControlStation.PARAMETRO_APPLICA_MTOM_RISPOSTA);
  3361.             dati.add(de);
  3362.            
  3363.             de = new DataElement();
  3364.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RESPONSE_FLOW_PROPERTIES_CONFIG_NAME);
  3365.             de.setName(CostantiControlStation.PARAMETRO_RESPONSE_FLOW_PROPERTIES_CONFIG_NAME);
  3366.             if(propConfigResList.length > 1){
  3367.                 de.setType(DataElementType.SELECT);
  3368.                 de.setLabels(propConfigResLabelList);
  3369.                 de.setValues(propConfigResList);
  3370.                 de.setSelected(idPropConfigRes);
  3371.                 de.setPostBack(true);
  3372.             }else{
  3373.                 de.setType(DataElementType.HIDDEN);
  3374.                 de.setValue(idPropConfigReq);
  3375.             }
  3376.             dati.add(de);

  3377.             if(idPropConfigRes.equals(oldIdPropConfigRes) && !idPropConfigRes.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) { // finche' non applico la modifica questi due valori saranno diversi
  3378.                 de = new DataElement();
  3379.                 de.setType(DataElementType.LINK);
  3380.                 de.setUrl(url2);
  3381.                 if(idPropConfigRes.equals(CostantiControlStation.VALUE_PARAMETRO_PROPERTIES_MODE_DEFAULT)) {
  3382.                     if (contaListe)
  3383.                         de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI+"(" + numWSres + ")");
  3384.                     else
  3385.                         de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI);
  3386.                 } else {
  3387.                     if(numWSres<=0) {
  3388.                         boolean editModeInProgress = true;
  3389.                         try {
  3390.                             editModeInProgress = this.isEditModeInProgress();
  3391.                         }catch(Exception e) {
  3392.                             // ignore
  3393.                         }
  3394.                         if(!editModeInProgress) {
  3395.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_PROCEDI);
  3396.                         }
  3397.                         else {
  3398.                            
  3399.                             DataElement note = new DataElement();
  3400.                             note.setBold(true);
  3401.                             note.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA_LABEL);
  3402.                             note.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA);
  3403.                             note.setType(DataElementType.NOTE);
  3404.                             dati.add(note);
  3405.                            
  3406.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_COMPLETA);
  3407.                         }
  3408.                     }
  3409.                     else {
  3410.                         // Se cambia l'xml potrebbe succedere
  3411.                         boolean valida = false;
  3412.                         try {
  3413.                             PropertiesSourceConfiguration propertiesSourceConfiguration = this.core.getMessageSecurityPropertiesSourceConfiguration();
  3414.                             ConfigManager configManager = ConfigManager.getinstance(ControlStationCore.getLog());
  3415.                             Config configurazione = configManager.getConfigurazione(propertiesSourceConfiguration, idPropConfigRes);
  3416.                             Map<String, Properties> mappaDB = null;
  3417.                             if(delegata) {
  3418.                                 mappaDB = this.porteDelegateCore.readMessageSecurityResponsePropertiesConfiguration(idPorta);
  3419.                             }
  3420.                             else {
  3421.                                 mappaDB = this.porteApplicativeCore.readMessageSecurityResponsePropertiesConfiguration(idPorta);
  3422.                             }
  3423.                             ConfigBean configurazioneBean = this.porteApplicativeCore.leggiConfigurazione(configurazione, mappaDB);
  3424.                             valida = this.checkPropertiesConfigurationData(TipoOperazione.OTHER, configurazioneBean, null, null, configurazione);
  3425.                         }catch(Exception e) {
  3426.                             this.logError(e.getMessage(),e);
  3427.                         }
  3428.                         if(valida) {
  3429.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES);
  3430.                         }
  3431.                         else {
  3432.                             de.setValue(CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_COMPLETA);
  3433.                         }
  3434.                     }
  3435.                 }
  3436.                 dati.add(de);
  3437.             }
  3438.         }

  3439.         dati = addParameterApplicaModifica(dati);
  3440.        
  3441.         return dati;
  3442.     }

  3443.     public List<DataElement> addMTOMToDati(List<DataElement> dati, String[] modeMtomListReq,String[] modeMtomListRes,
  3444.             String mtomRichiesta,String mtomRisposta, String url1, String url2, Boolean contaListe, int numMTOMreq, int numMTOMres) {

  3445.         DataElement de = new DataElement();

  3446.         // Sezione Richiesta
  3447.         de = new DataElement();
  3448.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RICHIESTA);
  3449.         de.setType(DataElementType.TITLE);
  3450.         dati.add(de);

  3451.         // Stato
  3452.         de = new DataElement();
  3453.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_STATO);
  3454.         de.setType(DataElementType.SELECT);
  3455.         de.setName(CostantiControlStation.PARAMETRO_MTOM_RICHIESTA);
  3456.         de.setValues(modeMtomListReq);
  3457.         de.setSelected(mtomRichiesta);
  3458.         de.setSize(this.getSize());
  3459.         dati.add(de);

  3460.         // Link
  3461.         if(url1 != null){
  3462.             de = new DataElement();
  3463.             de.setType(DataElementType.LINK);
  3464.             de.setUrl(url1);
  3465.             if (contaListe)
  3466.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI +"(" + numMTOMreq + ")");
  3467.             else
  3468.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI);
  3469.             dati.add(de);
  3470.         }


  3471.         // Sezione Richiesta
  3472.         de = new DataElement();
  3473.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RISPOSTA);
  3474.         de.setType(DataElementType.TITLE);
  3475.         dati.add(de);

  3476.         // Stato
  3477.         de = new DataElement();
  3478.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_STATO);
  3479.         de.setType(DataElementType.SELECT);
  3480.         de.setName(CostantiControlStation.PARAMETRO_MTOM_RISPOSTA);
  3481.         de.setValues(modeMtomListRes);
  3482.         de.setSelected(mtomRisposta);
  3483.         de.setSize(this.getSize());
  3484.         dati.add(de);

  3485.         // Link
  3486.         if(url2 != null){
  3487.             de = new DataElement();
  3488.             de.setType(DataElementType.LINK);
  3489.             de.setUrl(url2);
  3490.             if (contaListe)
  3491.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI +"(" + numMTOMres + ")");
  3492.             else
  3493.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_PARAMETRI);
  3494.             dati.add(de);
  3495.         }
  3496.        
  3497.         dati = addParameterApplicaModifica(dati);

  3498.         return dati;
  3499.     }
  3500.    
  3501.     private static boolean riusoIdCorrelazioneApplicativaPA = false; // riuso non abilitato nella porta applicativa
  3502.     public static boolean isRiusoIdCorrelazioneApplicativaPA() {
  3503.         return riusoIdCorrelazioneApplicativaPA;
  3504.     }
  3505.     public static void setRiusoIdCorrelazioneApplicativaPA(boolean riusoIdCorrelazioneApplicativaPA) {
  3506.         ConsoleHelper.riusoIdCorrelazioneApplicativaPA = riusoIdCorrelazioneApplicativaPA;
  3507.     }

  3508.     // Dati schermata correlazione applicativa
  3509.     public List<DataElement> addCorrelazioneApplicativaToDati(List<DataElement> dati,boolean portaDelegata,
  3510.             boolean riusoID,String scadcorr, String urlRichiesta, String urlRisposta, Boolean contaListe, int numCorrelazioneReq, int numCorrelazioneRes) {

  3511.         DataElement de = new DataElement();
  3512.         de = new DataElement();
  3513.         de.setType(DataElementType.TITLE);
  3514.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA);
  3515.         dati.add(de);
  3516.        
  3517.         de = new DataElement();
  3518.         de.setType(DataElementType.SUBTITLE);
  3519.         //de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA);
  3520.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RICHIESTA);
  3521.         dati.add(de);
  3522.        
  3523.         if(portaDelegata){      
  3524.             if (riusoID && numCorrelazioneReq > 0 && this.isModalitaAvanzata()) {
  3525.                 de = new DataElement();
  3526.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_LABEL);
  3527.                 de.setNote(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_NOTE);
  3528.                 de.setValue(scadcorr);
  3529.                 de.setType(DataElementType.TEXT_EDIT);
  3530.                 de.setName(CostantiControlStation.PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA);
  3531.                 dati.add(de);
  3532.             }
  3533.         } else {
  3534.             if (riusoIdCorrelazioneApplicativaPA && numCorrelazioneReq > 0 && this.isModalitaAvanzata()) {
  3535.                 de = new DataElement();
  3536.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_LABEL);
  3537.                 de.setNote(CostantiControlStation.LABEL_PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA_NOTE);
  3538.                 de.setValue(scadcorr);
  3539.                 de.setType(DataElementType.TEXT_EDIT);
  3540.                 de.setName(CostantiControlStation.PARAMETRO_SCADENZA_CORRELAZIONE_APPLICATIVA);
  3541.                 dati.add(de);
  3542.             }
  3543.         }
  3544.        
  3545.         de = new DataElement();
  3546.         de.setType(DataElementType.LINK);
  3547.         de.setUrl(urlRichiesta);

  3548.         if (contaListe) {
  3549.             ServletUtils.setDataElementCustomLabel(de,CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA_RICHIESTA,Long.valueOf(numCorrelazioneReq));
  3550.         } else
  3551.             ServletUtils.setDataElementCustomLabel(de,CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA_RICHIESTA);

  3552.         dati.add(de);

  3553.        
  3554.         de = new DataElement();
  3555.         de.setType(DataElementType.SUBTITLE);
  3556.         //de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA);
  3557.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RISPOSTA);
  3558.         dati.add(de);
  3559.        
  3560.         de = new DataElement();
  3561.         de.setType(DataElementType.LINK);
  3562.         de.setUrl(urlRisposta);

  3563.         if (contaListe) {
  3564.             ServletUtils.setDataElementCustomLabel(de,CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA_RISPOSTA,Long.valueOf(numCorrelazioneRes));
  3565.         } else
  3566.             ServletUtils.setDataElementCustomLabel(de,CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA_RISPOSTA);

  3567.         dati.add(de);
  3568.        
  3569.         dati = addParameterApplicaModifica(dati);

  3570.         return dati;
  3571.     }

  3572.     public List<DataElement> addParameterApplicaModifica(List<DataElement> dati) {
  3573.         DataElement de;
  3574.         de = new DataElement();
  3575.         de.setType(DataElementType.HIDDEN);
  3576.         de.setName(CostantiControlStation.PARAMETRO_APPLICA_MODIFICA);
  3577.         de.setValue(Costanti.CHECK_BOX_ENABLED);
  3578.         dati.add(de);
  3579.         return dati;
  3580.     }
  3581.    
  3582.     // Controlla i dati della correlazione applicativa
  3583.     public boolean correlazioneApplicativaCheckData(TipoOperazione tipoOp,boolean portaDelegata,String scadcorr) throws DriverControlStationException {
  3584.         try{
  3585.             // scadenza correlazione intero > 0 opzionale
  3586.             if(scadcorr != null && !scadcorr.equals("")){
  3587.                 int scadCorrInt = -1;
  3588.                 try{
  3589.                     scadCorrInt = Integer.parseInt(scadcorr);
  3590.                 }catch(Exception e){
  3591.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCADENZA_CORRELAZIONE_APPLICATIVA_NON_VALIDA_INSERIRE_UN_NUMERO_INTERO_MAGGIORE_DI_ZERO);
  3592.                     return false;
  3593.                 }
  3594.                
  3595.                 if(scadCorrInt <= 0){
  3596.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCADENZA_CORRELAZIONE_APPLICATIVA_NON_VALIDA_INSERIRE_UN_NUMERO_INTERO_MAGGIORE_DI_ZERO);
  3597.                     return false;
  3598.                 }
  3599.             }
  3600.            
  3601.             return true;
  3602.         } catch (Exception e) {
  3603.             this.logError("Exception: " + e.getMessage(), e);
  3604.             throw new DriverControlStationException(e);
  3605.         }
  3606.     }

  3607.     // Controlla i dati della correlazione applicativa richiesta della porta delegata
  3608.     public boolean correlazioneApplicativaRichiestaCheckData(TipoOperazione tipoOp,boolean portaDelegata,
  3609.             ServiceBinding serviceBinding) throws DriverControlStationException {
  3610.         try {
  3611.             String id = this.getParameter(CostantiControlStation.PARAMETRO_ID);
  3612.             int idInt = Integer.parseInt(id);
  3613.             // String idsogg = this.getParameter("idsogg");
  3614.             String elemxml = this.getParameter(CostantiControlStation.PARAMETRO_ELEMENTO_XML);
  3615.             String mode = this.getParameter(CostantiControlStation.PARAMETRO_MODE_CORRELAZIONE_APPLICATIVA);
  3616.             String pattern = this.getParameter(CostantiControlStation.PARAMETRO_PATTERN);
  3617.             String idcorr = this.getParameter(CostantiControlStation.PARAMETRO_ID_CORRELAZIONE);
  3618.             int idcorrInt = 0;
  3619.             if (idcorr != null) {
  3620.                 idcorrInt = Integer.parseInt(idcorr);
  3621.             }

  3622.             if(elemxml!=null && !"".equals(elemxml)) {
  3623.                 if(this.checkLength255(elemxml, CostantiControlStation.LABEL_PARAMETRO_PORTE_ELEMENTO_XML)==false) {
  3624.                     return false;
  3625.                 }
  3626.             }
  3627.            
  3628.             // Campi obbligatori
  3629.             // if ( elemxml.equals("")||
  3630.             if (
  3631.                     (
  3632.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED) ||
  3633.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED) ||
  3634.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED) ||
  3635.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE) ||
  3636.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE) ||
  3637.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)
  3638.                     )
  3639.                     &&
  3640.                     pattern.equals("")
  3641.                 ) {
  3642.                 String label = "";
  3643.                 if(mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED)) {
  3644.                     label = CostantiControlStation.LABEL_PARAMETRO_NOME;
  3645.                 }
  3646.                 else if(mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE) ||
  3647.                         mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE) ||
  3648.                         mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)) {
  3649.                     label = CostantiControlStation.LABEL_PARAMETRO_TEMPLATE;
  3650.                 }
  3651.                 else {
  3652.                     label = CostantiControlStation.LABEL_PATTERN;
  3653.                 }
  3654.                
  3655.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, label));
  3656.                 return false;
  3657.             }

  3658.             // Controllo che i campi "select" abbiano uno dei valori ammessi
  3659.             if (!mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED)
  3660.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED)
  3661.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED)
  3662.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_INPUT_BASED)
  3663.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE)
  3664.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE)
  3665.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)
  3666.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO)) {
  3667.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_MODALITA_IDENTIFICAZIONE_CON_TIPI_POSSIBILI);
  3668.                 return false;
  3669.             }

  3670.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED)) {
  3671.                 if(this.checkRegexp(pattern,ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  3672.                     return false;
  3673.                 }
  3674.             }
  3675.            
  3676.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE)) {
  3677.                 try{
  3678.                     DynamicUtils.validate(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro(), pattern, false);
  3679.                 }catch(Exception e){
  3680.                     this.pd.setMessage("Il valore indicato nel parametro '"+ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro()+"' non risulta corretto: "+e.getMessage());
  3681.                     return false;
  3682.                 }
  3683.             }
  3684.            
  3685.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED)) {
  3686.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  3687.                     if(this.checkXPath(pattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  3688.                         return false;
  3689.                     }
  3690.                 }
  3691.                 else {
  3692.                     if(this.checkXPathOrJsonPath(pattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  3693.                         return false;
  3694.                     }
  3695.                 }
  3696.             }
  3697.            
  3698.             // Controllo che non esistano altre correlazioni applicative con gli
  3699.             // stessi dati
  3700.             boolean giaRegistrato = false;
  3701.             StringBuilder existsMessage = new StringBuilder();
  3702.             if(portaDelegata) {
  3703.                 giaRegistrato = ConsoleUtilities.alreadyExistsCorrelazioneApplicativaRichiesta(this.porteDelegateCore, idInt, elemxml, idcorrInt, existsMessage);
  3704.             }
  3705.             else {
  3706.                 giaRegistrato = ConsoleUtilities.alreadyExistsCorrelazioneApplicativaRichiesta(this.porteApplicativeCore, idInt, elemxml, idcorrInt, existsMessage);
  3707.             }
  3708.            
  3709.             if (giaRegistrato) {
  3710.                 this.pd.setMessage(existsMessage.toString());
  3711.                 return false;
  3712.             }          

  3713.             return true;
  3714.         } catch (Exception e) {
  3715.             this.logError("Exception: " + e.getMessage(), e);
  3716.             throw new DriverControlStationException(e);
  3717.         }
  3718.     }
  3719.    



  3720.     // Controlla i dati della correlazione applicativa della porta delegata
  3721.     public boolean correlazioneApplicativaRispostaCheckData(TipoOperazione tipoOp,boolean portaDelegata,
  3722.             ServiceBinding serviceBinding) throws DriverControlStationException {
  3723.         try {
  3724.             String id = this.getParameter(CostantiControlStation.PARAMETRO_ID);
  3725.             int idInt = Integer.parseInt(id);
  3726.             // String idsogg = this.getParameter("idsogg");
  3727.             String elemxml = this.getParameter(CostantiControlStation.PARAMETRO_ELEMENTO_XML);
  3728.             String mode = this.getParameter(CostantiControlStation.PARAMETRO_MODE_CORRELAZIONE_APPLICATIVA);
  3729.             String pattern = this.getParameter(CostantiControlStation.PARAMETRO_PATTERN);
  3730.             String idcorr = this.getParameter(CostantiControlStation.PARAMETRO_ID_CORRELAZIONE);
  3731.             int idcorrInt = 0;
  3732.             if (idcorr != null) {
  3733.                 idcorrInt = Integer.parseInt(idcorr);
  3734.             }

  3735.             if(elemxml!=null && !"".equals(elemxml)) {
  3736.                 if(this.checkLength255(elemxml, CostantiControlStation.LABEL_PARAMETRO_PORTE_ELEMENTO_XML)==false) {
  3737.                     return false;
  3738.                 }
  3739.             }
  3740.            
  3741.             // Campi obbligatori
  3742.             // if ( elemxml.equals("")||
  3743.             if (
  3744.                     (
  3745.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED) ||
  3746.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED) ||
  3747.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED) ||
  3748.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE) ||
  3749.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE) ||
  3750.                             mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)
  3751.                     )
  3752.                     &&
  3753.                     pattern.equals("")
  3754.                 ) {
  3755.                 String label = "";
  3756.                 if(mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED)) {
  3757.                     label = CostantiControlStation.LABEL_PARAMETRO_NOME;
  3758.                 }
  3759.                 else if(mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE) ||
  3760.                         mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE) ||
  3761.                         mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)) {
  3762.                     label = CostantiControlStation.LABEL_PARAMETRO_TEMPLATE;
  3763.                 }
  3764.                 else {
  3765.                     label = CostantiControlStation.LABEL_PATTERN;
  3766.                 }
  3767.                
  3768.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, label));
  3769.                 return false;
  3770.             }

  3771.             // Controllo che i campi "select" abbiano uno dei valori ammessi
  3772.             if (!mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED)
  3773.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_HEADER_BASED)
  3774.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED)
  3775.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_INPUT_BASED)  
  3776.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE)
  3777.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_FREEMARKER_TEMPLATE)
  3778.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_VELOCITY_TEMPLATE)
  3779.                     && !mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_DISABILITATO)) {
  3780.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_MODALITA_IDENTIFICAZIONE_CON_TIPI_POSSIBILI);
  3781.                 return false;
  3782.             }

  3783.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_URL_BASED)) {
  3784.                 if(this.checkRegexp(pattern,ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  3785.                     return false;
  3786.                 }
  3787.             }
  3788.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_TEMPLATE)) {
  3789.                 try{
  3790.                     DynamicUtils.validate(ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro(), pattern, false);
  3791.                 }catch(Exception e){
  3792.                     this.pd.setMessage("Il valore indicato nel parametro '"+ModalitaIdentificazione.GOVWAY_TEMPLATE.getLabelParametro()+"' non risulta corretto: "+e.getMessage());
  3793.                     return false;
  3794.                 }
  3795.             }
  3796.             if (mode.equals(CostantiControlStation.VALUE_PARAMETRO_MODE_CORRELAZIONE_CONTENT_BASED)) {
  3797.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  3798.                     if(this.checkXPath(pattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  3799.                         return false;
  3800.                     }
  3801.                 }
  3802.                 else {
  3803.                     if(this.checkXPathOrJsonPath(pattern,ModalitaIdentificazione.CONTENT_BASED.getLabelParametro())==false){
  3804.                         return false;
  3805.                     }
  3806.                 }
  3807.             }
  3808.            
  3809.             // Controllo che non esistano altre correlazioni applicative con gli
  3810.             // stessi dati
  3811.             boolean giaRegistrato = false;
  3812.             StringBuilder existsMessage = new StringBuilder();
  3813.             if(portaDelegata) {
  3814.                 giaRegistrato = ConsoleUtilities.alreadyExistsCorrelazioneApplicativaRisposta(this.porteDelegateCore, idInt, elemxml, idcorrInt, existsMessage);
  3815.             }
  3816.             else {
  3817.                 giaRegistrato = ConsoleUtilities.alreadyExistsCorrelazioneApplicativaRisposta(this.porteApplicativeCore, idInt, elemxml, idcorrInt, existsMessage);
  3818.             }
  3819.            
  3820.             if (giaRegistrato) {
  3821.                 this.pd.setMessage(existsMessage.toString());
  3822.                 return false;
  3823.             }  
  3824.            
  3825.             return true;
  3826.         } catch (Exception e) {
  3827.             this.logError("Exception: " + e.getMessage(), e);
  3828.             throw new DriverControlStationException(e);
  3829.         }
  3830.     }





  3831.     // Controlla i dati del Message-Security
  3832.     public boolean MTOMCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
  3833.         try{
  3834.             String mtomRichiesta = this.getParameter(CostantiControlStation.PARAMETRO_MTOM_RICHIESTA);
  3835.             String mtomRisposta = this.getParameter(CostantiControlStation.PARAMETRO_MTOM_RISPOSTA);

  3836.             // Controllo che i campi "select" abbiano uno dei valori ammessi
  3837.             if (!mtomRichiesta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_DISABLE) &&
  3838.                     !mtomRichiesta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_PACKAGING) &&
  3839.                     !mtomRichiesta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_VERIFY) &&
  3840.                     !mtomRichiesta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_UNPACKAGING)) {
  3841.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_STATO_DELLA_RICHIESTA_DEVE_ESSERE_DISABLED_PACKAGING_UNPACKAGING_O_VERIFY);
  3842.                 return false;
  3843.             }

  3844.             if (!mtomRisposta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_DISABLE) &&
  3845.                     !mtomRisposta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_PACKAGING) &&
  3846.                     !mtomRisposta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_VERIFY) &&
  3847.                     !mtomRisposta.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MTOM_UNPACKAGING)) {
  3848.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_STATO_DELLA_RISPOSTA_DEVE_ESSERE_DISABLED_PACKAGING_UNPACKAGING_O_VERIFY);
  3849.                 return false;
  3850.             }

  3851.             return true;
  3852.         } catch (Exception e) {
  3853.             this.logError("Exception: " + e.getMessage(), e);
  3854.             throw new DriverControlStationException(e);
  3855.         }
  3856.     }

  3857.     // Controlla i dati dei parametri MTOM
  3858.     public boolean MTOMParameterCheckData(TipoOperazione tipoOp, boolean isRisposta, boolean isPortaDelegata) throws DriverControlStationException {
  3859.         try {
  3860.             String id = this.getParameter(CostantiControlStation.PARAMETRO_ID);
  3861.             int idInt = Integer.parseInt(id);
  3862.             String nome = this.getParameter(CostantiControlStation.PARAMETRO_NOME);
  3863.             String contentType =this.getParameter(CostantiControlStation.PARAMETRO_CONTENT_TYPE);
  3864.             //  String obbligatorio = this.getParameter(CostantiControlStation.PARAMETRO_OBBLIGATORIO);
  3865.             String pattern = this.getParameter(CostantiControlStation.PARAMETRO_PATTERN);


  3866.             // Campi obbligatori
  3867.             if (nome.equals("") || pattern.equals("")) {
  3868.                 String tmpElenco = "";
  3869.                 if (nome.equals("")) {
  3870.                     tmpElenco = CostantiControlStation.LABEL_PARAMETRO_NOME;
  3871.                 }
  3872.                 if (pattern.equals("")) {
  3873.                     if (tmpElenco.equals("")) {
  3874.                         tmpElenco = CostantiControlStation.LABEL_PATTERN;
  3875.                     } else {
  3876.                         tmpElenco = tmpElenco + ", " + CostantiControlStation.LABEL_PATTERN;
  3877.                     }
  3878.                 }
  3879.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, tmpElenco));
  3880.                 return false;
  3881.             }

  3882.             // Controllo che non ci siano spazi nei campi di testo
  3883.             //if ((nome.indexOf(" ") != -1) || (valore.indexOf(" ") != -1)) {
  3884.             if ((nome.indexOf(" ") != -1) ) {
  3885.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEL_CAMPO_NOME);
  3886.                 return false;
  3887.             }
  3888.             if(pattern.indexOf(" ") != -1){
  3889.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRROE_NON_INSERIRE_SPAZI_NEL_CAMPO_PATTERN);
  3890.                 return false;
  3891.             }



  3892.             if(contentType!=null && contentType.indexOf(" ") != -1){
  3893.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEL_CAMPO_CONTENT_TYPE);
  3894.                 return false;
  3895.             }

  3896.             // length
  3897.             if(this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_NOME)==false) {
  3898.                 return false;
  3899.             }
  3900.             if(contentType!=null && !"".equals(contentType)){
  3901.                 if(this.checkLength255(contentType, CostantiControlStation.LABEL_PARAMETRO_CONTENT_TYPE)==false) {
  3902.                     return false;
  3903.                 }
  3904.             }
  3905.            
  3906.             // Se tipoOp = add, controllo che il message-security non sia gia' stato
  3907.             // registrato per la porta delegata
  3908.             if (tipoOp.equals(TipoOperazione.ADD)) {
  3909.                 MtomProcessor mtomProcessor = null;
  3910.                 boolean giaRegistrato = false;
  3911.                 String nomeporta =  null;

  3912.                 if(isPortaDelegata){
  3913.                     PortaDelegata pde = this.porteDelegateCore.getPortaDelegata(idInt);
  3914.                     nomeporta = pde.getNome();
  3915.                     mtomProcessor = pde.getMtomProcessor();
  3916.                 } else {
  3917.                     PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idInt);
  3918.                     nomeporta = pa.getNome();
  3919.                     mtomProcessor = pa.getMtomProcessor();
  3920.                 }

  3921.                 if(mtomProcessor!=null){
  3922.                     if(!isRisposta){
  3923.                         if(mtomProcessor.getRequestFlow()!=null){
  3924.                             for (int i = 0; i < mtomProcessor.getRequestFlow().sizeParameterList(); i++) {
  3925.                                 MtomProcessorFlowParameter tmpMTOM =mtomProcessor.getRequestFlow().getParameter(i);
  3926.                                 if (nome.equals(tmpMTOM.getNome())) {
  3927.                                     giaRegistrato = true;
  3928.                                     break;
  3929.                                 }
  3930.                             }
  3931.                         }
  3932.                     } else {
  3933.                         if(mtomProcessor.getResponseFlow()!=null){
  3934.                             for (int i = 0; i < mtomProcessor.getResponseFlow().sizeParameterList(); i++) {
  3935.                                 MtomProcessorFlowParameter tmpMTOM =mtomProcessor.getResponseFlow().getParameter(i);
  3936.                                 if (nome.equals(tmpMTOM.getNome())) {
  3937.                                     giaRegistrato = true;
  3938.                                     break;
  3939.                                 }
  3940.                             }
  3941.                         }
  3942.                     }
  3943.                 }

  3944.                 if (giaRegistrato) {
  3945.                     if(isPortaDelegata)
  3946.                         this.pd.setMessage(MessageFormat.format(
  3947.                                 CostantiControlStation.MESSAGGIO_ERRORE_PROPRIETA_DI_MTOM_GIA_ASSOCIATA_ALLA_PORTA_DELEGATA_XX, nome, nomeporta));
  3948.                     else
  3949.                         this.pd.setMessage(MessageFormat.format(
  3950.                                 CostantiControlStation.MESSAGGIO_ERRORE_PROPRIETA_DI_MTOM_GIA_ASSOCIATA_ALLA_PORTA_APPLICATIVA_XX, nome, nomeporta));
  3951.                     return false;
  3952.                 }
  3953.             }

  3954.             return true;

  3955.         } catch (Exception e) {
  3956.             this.logError("Exception: " + e.getMessage(), e);
  3957.             throw new DriverControlStationException(e);
  3958.         }
  3959.     }

  3960.     public List<DataElement> addMTOMParameterToDati(TipoOperazione tipoOp,List<DataElement> dati,boolean enableUpdate, String nome, String pattern,
  3961.             String contentType, String obbligatorio, MTOMProcessorType type) {

  3962.         // Nome
  3963.         DataElement de = new DataElement();
  3964.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  3965.         de.setValue(nome);
  3966.         if (tipoOp.equals(TipoOperazione.ADD) || enableUpdate) {
  3967.             de.setType(DataElementType.TEXT_EDIT);
  3968.             de.setRequired(true);
  3969.         } else {
  3970.             de.setType(DataElementType.TEXT);
  3971.         }
  3972.         de.setName(CostantiControlStation.PARAMETRO_NOME);
  3973.         de.setSize(this.getSize());
  3974.         de.setRequired(true);
  3975.         DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_NOME);
  3976.         switch (type) {
  3977.         case PACKAGING:
  3978.         case VERIFY:
  3979.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INFO_NOME_SOAP_PACKAGE);
  3980.             break;
  3981.         default:
  3982.             dInfoPattern = null;
  3983.             break;
  3984.         }
  3985.         de.setInfo(dInfoPattern);
  3986.         dati.add(de);

  3987.         // Pattern
  3988.         de = new DataElement();
  3989.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PATTERN);
  3990.         de.setValue(pattern);
  3991.         de.setType(DataElementType.TEXT_AREA);
  3992.         de.setName(CostantiControlStation.PARAMETRO_PATTERN);
  3993.         de.setSize(this.getSize());
  3994.         de.setRequired(true);
  3995.         dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_PATTERN);
  3996.         switch (type) {
  3997.         case PACKAGING:
  3998.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INFO_PATTERN_SOAP_PACKAGE);
  3999.             break;
  4000.         case VERIFY:
  4001.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INFO_PATTERN_SOAP_VERIFY);
  4002.             break;
  4003.         default:
  4004.             dInfoPattern = null;
  4005.             break;
  4006.         }
  4007.         de.setInfo(dInfoPattern);
  4008.         dati.add(de);

  4009.         // Content-type
  4010.         de = new DataElement();
  4011.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONTENT_TYPE);
  4012.         de.setValue(contentType);
  4013.         de.setType(DataElementType.TEXT_EDIT);
  4014.         de.setName(CostantiControlStation.PARAMETRO_CONTENT_TYPE);
  4015.         de.setSize(this.getSize());
  4016.         dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONTENT_TYPE);
  4017.         switch (type) {
  4018.         case PACKAGING:
  4019.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INFO_CONTENT_TYPE_SOAP_PACKAGE);
  4020.             break;
  4021.         case VERIFY:
  4022.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INFO_CONTENT_TYPE_SOAP_VERIFY);
  4023.             break;
  4024.         default:
  4025.             dInfoPattern = null;
  4026.             break;
  4027.         }
  4028.         de.setInfo(dInfoPattern);
  4029.         dati.add(de);

  4030.         // Obbligatorio
  4031.         de = new DataElement();
  4032.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_OBBLIGATORIO);
  4033.         de.setType(DataElementType.CHECKBOX);
  4034.         if( ServletUtils.isCheckBoxEnabled(obbligatorio) || CostantiRegistroServizi.ABILITATO.equals(obbligatorio) ){
  4035.             de.setSelected(true);
  4036.         }
  4037.         de.setName(CostantiControlStation.PARAMETRO_OBBLIGATORIO);
  4038.         dati.add(de);

  4039.         return dati;
  4040.     }

  4041.     public List<DataElement> addProtocolPropertiesToDatiRegistry(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4042.             ProtocolProperties protocolProperties) throws DriverControlStationException{
  4043.         return addProtocolPropertiesToDatiRegistry(dati, consoleConfiguration, consoleOperationType, protocolProperties, null, null);
  4044.     }
  4045.     public List<DataElement> addProtocolPropertiesToDatiRegistry(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4046.             ProtocolProperties protocolProperties, List<ProtocolProperty> listaProtocolPropertiesDaDB ,Properties binaryPropertyChangeInfoProprietario) throws DriverControlStationException{
  4047.        
  4048.         String titleId = null;
  4049.         String endTitleId = null;
  4050.        
  4051.         String subtitleId = null;
  4052.         String endSubtitleId = null;
  4053.        
  4054.         for (BaseConsoleItem item : consoleConfiguration.getConsoleItem()) {
  4055.             AbstractProperty<?> property = ProtocolPropertiesUtils.getAbstractPropertyById(protocolProperties, item.getId());
  4056.             // imposto nel default value il valore attuale.
  4057.             // Mi tengo cmq il default value attuale per le opzioni di selected
  4058.             Object defaultItemValue = null;
  4059.             if(item instanceof AbstractConsoleItem<?> ) {
  4060.                 AbstractConsoleItem<?> itemConsole = (AbstractConsoleItem<?>) item;
  4061.                 defaultItemValue = itemConsole.getDefaultValue();
  4062.             }
  4063.             try {
  4064.                 ProtocolPropertiesUtils.setDefaultValue(item, property);
  4065.    
  4066.                 ProtocolProperty protocolProperty = ProtocolPropertiesUtils.getProtocolPropertyRegistry(item.getId(), listaProtocolPropertiesDaDB);
  4067.                 dati = ProtocolPropertiesUtilities.itemToDataElement(dati,this,item, defaultItemValue,
  4068.                         consoleOperationType, binaryPropertyChangeInfoProprietario, protocolProperty, this.getSize());
  4069.             }catch(Exception e) {
  4070.                 throw new DriverControlStationException(e.getMessage(),e);
  4071.             }
  4072.            
  4073.             if(ConsoleItemType.TITLE.equals(item.getType()) && item instanceof TitleConsoleItem) {
  4074.                 TitleConsoleItem titleItem = (TitleConsoleItem) item;
  4075.                 if(titleItem.isCloseable()) {
  4076.                     titleId = titleItem.getId();
  4077.                     endTitleId = titleItem.getLastItemId();
  4078.                 }
  4079.             }
  4080.             else if(ConsoleItemType.SUBTITLE.equals(item.getType()) && item instanceof SubtitleConsoleItem) {
  4081.                 SubtitleConsoleItem subItem = (SubtitleConsoleItem) item;
  4082.                 if(subItem.isCloseable()) {
  4083.                     subtitleId = subItem.getId();
  4084.                     endSubtitleId = subItem.getLastItemId();
  4085.                 }
  4086.             }
  4087.             else {
  4088.                 if(endTitleId!=null && endTitleId.equals(item.getId())) {
  4089.                     this.impostaAperturaTitle(dati, titleId);
  4090.                 }
  4091.                 else if(endSubtitleId!=null && endSubtitleId.equals(item.getId())) {
  4092.                     this.impostaAperturaSubTitle(dati, subtitleId);
  4093.                 }
  4094.             }
  4095.         }

  4096.         // Imposto il flag per indicare che ho caricato la configurazione
  4097.         DataElement de = new DataElement();
  4098.         de.setName(ProtocolPropertiesCostanti.PARAMETRO_PP_SET);
  4099.         de.setType(DataElementType.HIDDEN);
  4100.         de.setValue("ok");
  4101.         dati.add(de);

  4102.         return dati;
  4103.     }
  4104.    
  4105.     public List<DataElement> addProtocolPropertiesToDatiConfig(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4106.             ProtocolProperties protocolProperties) throws DriverControlStationException{
  4107.         return addProtocolPropertiesToDatiRegistry(dati, consoleConfiguration, consoleOperationType, protocolProperties, null, null);
  4108.     }
  4109.     public List<DataElement> addProtocolPropertiesToDatiConfig(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4110.             ProtocolProperties protocolProperties, List<org.openspcoop2.core.config.ProtocolProperty> listaProtocolPropertiesDaDB ,Properties binaryPropertyChangeInfoProprietario) throws DriverControlStationException{
  4111.    
  4112.         String titleId = null;
  4113.         String endTitleId = null;
  4114.        
  4115.         String subtitleId = null;
  4116.         String endSubtitleId = null;
  4117.        
  4118.         for (BaseConsoleItem item : consoleConfiguration.getConsoleItem()) {
  4119.             AbstractProperty<?> property = ProtocolPropertiesUtils.getAbstractPropertyById(protocolProperties, item.getId());
  4120.             // imposto nel default value il valore attuale.
  4121.             // Mi tengo cmq il default value attuale per le opzioni di selected
  4122.             Object defaultItemValue = null;
  4123.             if(item instanceof AbstractConsoleItem<?> ) {
  4124.                 AbstractConsoleItem<?> itemConsole = (AbstractConsoleItem<?>) item;
  4125.                 defaultItemValue = itemConsole.getDefaultValue();
  4126.             }
  4127.             try {
  4128.                 ProtocolPropertiesUtils.setDefaultValue(item, property);
  4129.                
  4130.                 org.openspcoop2.core.config.ProtocolProperty protocolProperty = ProtocolPropertiesUtils.getProtocolPropertyConfig(item.getId(), listaProtocolPropertiesDaDB);
  4131.                 dati = ProtocolPropertiesUtilities.itemToDataElement(dati,this,item, defaultItemValue,
  4132.                         consoleOperationType, binaryPropertyChangeInfoProprietario, protocolProperty, this.getSize());
  4133.             }catch(Exception e) {
  4134.                 throw new DriverControlStationException(e.getMessage(),e);
  4135.             }
  4136.            
  4137.             if(ConsoleItemType.TITLE.equals(item.getType()) && item instanceof TitleConsoleItem) {
  4138.                 TitleConsoleItem titleItem = (TitleConsoleItem) item;
  4139.                 if(titleItem.isCloseable()) {
  4140.                     titleId = titleItem.getId();
  4141.                     endTitleId = titleItem.getLastItemId();
  4142.                 }
  4143.             }
  4144.             else if(ConsoleItemType.SUBTITLE.equals(item.getType()) && item instanceof SubtitleConsoleItem) {
  4145.                 SubtitleConsoleItem subItem = (SubtitleConsoleItem) item;
  4146.                 if(subItem.isCloseable()) {
  4147.                     subtitleId = subItem.getId();
  4148.                     endSubtitleId = subItem.getLastItemId();
  4149.                 }
  4150.             }
  4151.             else {
  4152.                 if(endTitleId!=null && endTitleId.equals(item.getId())) {
  4153.                     this.impostaAperturaTitle(dati, titleId);
  4154.                 }
  4155.                 else if(endSubtitleId!=null && endSubtitleId.equals(item.getId())) {
  4156.                     this.impostaAperturaSubTitle(dati, subtitleId);
  4157.                 }
  4158.             }
  4159.         }

  4160.         // Imposto il flag per indicare che ho caricato la configurazione
  4161.         DataElement de = new DataElement();
  4162.         de.setName(ProtocolPropertiesCostanti.PARAMETRO_PP_SET);
  4163.         de.setType(DataElementType.HIDDEN);
  4164.         de.setValue("ok");
  4165.         dati.add(de);

  4166.         return dati;
  4167.     }
  4168.    
  4169.    
  4170.     public List<DataElement> addProtocolPropertiesToDatiAsHidden(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4171.             ProtocolProperties protocolProperties) throws DriverControlStationException{
  4172.         return addProtocolPropertiesToDatiAsHidden(dati, consoleConfiguration, consoleOperationType, protocolProperties, null, null);
  4173.     }

  4174.     public List<DataElement> addProtocolPropertiesToDatiAsHidden(List<DataElement> dati, ConsoleConfiguration consoleConfiguration,ConsoleOperationType consoleOperationType,
  4175.             ProtocolProperties protocolProperties, List<ProtocolProperty> listaProtocolPropertiesDaDB ,Properties binaryPropertyChangeInfoProprietario) throws DriverControlStationException{
  4176.         for (BaseConsoleItem item : consoleConfiguration.getConsoleItem()) {
  4177.             AbstractProperty<?> property = ProtocolPropertiesUtils.getAbstractPropertyById(protocolProperties, item.getId());
  4178.             // imposto nel default value il valore attuale.
  4179.             // Mi tengo cmq il default value attuale per le opzioni di selected
  4180.             Object defaultItemValue = null;
  4181.             if(item instanceof AbstractConsoleItem<?> ) {
  4182.                 AbstractConsoleItem<?> itemConsole = (AbstractConsoleItem<?>) item;
  4183.                 defaultItemValue = itemConsole.getDefaultValue();
  4184.             }
  4185.             try {
  4186.                 ProtocolPropertiesUtils.setDefaultValue(item, property);
  4187.    
  4188.                 ProtocolProperty protocolProperty = ProtocolPropertiesUtils.getProtocolPropertyRegistry(item.getId(), listaProtocolPropertiesDaDB);
  4189.                 dati = ProtocolPropertiesUtilities.itemToDataElementAsHidden(dati, this, item, defaultItemValue,
  4190.                         consoleOperationType, binaryPropertyChangeInfoProprietario, protocolProperty, this.getSize());
  4191.             }catch(Exception e) {
  4192.                 throw new DriverControlStationException(e.getMessage(),e);
  4193.             }
  4194.         }

  4195.         // Imposto il flag per indicare che ho caricato la configurazione
  4196.         DataElement de = new DataElement();
  4197.         de.setName(ProtocolPropertiesCostanti.PARAMETRO_PP_SET);
  4198.         de.setType(DataElementType.HIDDEN);
  4199.         de.setValue("ok");
  4200.         dati.add(de);

  4201.         return dati;
  4202.     }

  4203.     public void validaProtocolProperties(ConsoleConfiguration consoleConfiguration, ConsoleOperationType consoleOperationType, ProtocolProperties properties) throws ProtocolException{
  4204.         try {
  4205.             List<BaseConsoleItem> consoleItems = consoleConfiguration.getConsoleItem();
  4206.             for (int i = 0; i < properties.sizeProperties(); i++) {
  4207.                 AbstractProperty<?> property = properties.getProperty(i);
  4208.                 AbstractConsoleItem<?> consoleItem = ProtocolPropertiesUtils.getAbstractConsoleItem(consoleItems, property);

  4209.                 if(consoleItem != null &&
  4210.                     !consoleItem.isHidden()) {
  4211.                     if(consoleItem instanceof StringConsoleItem){
  4212.                         StringProperty sp = (StringProperty) property;
  4213.                         if (consoleItem.isRequired() && StringUtils.isEmpty(sp.getValue())) {
  4214.                             if(consoleItem.getLabel()==null || "".equals(consoleItem.getLabel())) {
  4215.                                 throw new ProtocolException(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI);
  4216.                             }
  4217.                             else {
  4218.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, consoleItem.getLabel()));
  4219.                             }
  4220.                         }

  4221.                         if(StringUtils.isNotEmpty(consoleItem.getRegexpr()) &&
  4222.                             !RegularExpressionEngine.isMatch(sp.getValue(),consoleItem.getRegexpr())){
  4223.                             throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_IL_CAMPO_XX_DEVE_RISPETTARE_IL_PATTERN_YY, consoleItem.getLabel(), consoleItem.getRegexpr()));
  4224.                         }
  4225.                        
  4226.                         if(StringUtils.isNotEmpty(sp.getValue())) {
  4227.                             try {
  4228.                                 if(!this.checkLength4000(sp.getValue(), consoleItem.getLabel())) {
  4229.                                     throw new ProtocolException(this.pd.getMessage());
  4230.                                 }
  4231.                             }catch(Exception e) {
  4232.                                 throw new ProtocolException(e.getMessage(),e);
  4233.                             }
  4234.                         }
  4235.                     }
  4236.                     else if(consoleItem instanceof NumberConsoleItem){
  4237.                         NumberProperty np = (NumberProperty) property;
  4238.                         if (consoleItem.isRequired() && np.getValue() == null) {
  4239.                             if(consoleItem.getLabel()==null || "".equals(consoleItem.getLabel())) {
  4240.                                 throw new ProtocolException(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI);
  4241.                             }
  4242.                             else {
  4243.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, consoleItem.getLabel()));
  4244.                             }
  4245.                         }
  4246.                         if(np.getValue()!=null &&
  4247.                             ConsoleItemType.NUMBER.equals(consoleItem.getType()) && (consoleItem instanceof NumberConsoleItem)) {
  4248.                             long v = np.getValue();
  4249.                             NumberConsoleItem nci = (NumberConsoleItem) consoleItem;
  4250.                             if(v<nci.getMin()) {
  4251.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_VALORE_MINORE_DEL_MINIMO, consoleItem.getLabel(), nci.getMin()));
  4252.                             }
  4253.                             if(v>nci.getMax()) {
  4254.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_VALORE_MINORE_DEL_MASSIMO, consoleItem.getLabel(), nci.getMax()));
  4255.                             }
  4256.                         }
  4257.                     }
  4258.                     else if(consoleItem instanceof BinaryConsoleItem){
  4259.                         BinaryProperty bp = (BinaryProperty) property;
  4260.                         if (consoleOperationType.equals(ConsoleOperationType.ADD) && consoleItem.isRequired() && (bp.getValue() == null || bp.getValue().length == 0)) {
  4261.                             if(consoleItem.getLabel()==null || "".equals(consoleItem.getLabel())) {
  4262.                                 throw new ProtocolException(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI);
  4263.                             }
  4264.                             else {
  4265.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, consoleItem.getLabel()));
  4266.                             }
  4267.                         }
  4268.                     }
  4269.                     else if(consoleItem instanceof BooleanConsoleItem){
  4270.                         BooleanProperty bp = (BooleanProperty) property;
  4271.                         // le checkbox obbligatorie non dovrebbero esserci...
  4272.                         if (consoleItem.isRequired() && bp.getValue() == null) {
  4273.                             if(consoleItem.getLabel()==null || "".equals(consoleItem.getLabel())) {
  4274.                                 throw new ProtocolException(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI);
  4275.                             }
  4276.                             else {
  4277.                                 throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, consoleItem.getLabel()));
  4278.                             }
  4279.                         }
  4280.                     }
  4281.                 }
  4282.             }

  4283.         } catch (RegExpException | RegExpNotValidException | RegExpNotFoundException e) {
  4284.             throw new ProtocolException(e);
  4285.         } catch (ProtocolException e) {
  4286.             throw e;
  4287.         }

  4288.     }

  4289.     public void validaProtocolPropertyBinaria(String nome, ConsoleConfiguration consoleConfiguration, ConsoleOperationType consoleOperationType, ProtocolProperties properties) throws ProtocolException{
  4290.         try {
  4291.             List<BaseConsoleItem> consoleItems = consoleConfiguration.getConsoleItem();
  4292.             for (int i = 0; i < properties.sizeProperties(); i++) {
  4293.                 AbstractProperty<?> property = properties.getProperty(i);
  4294.                 AbstractConsoleItem<?> consoleItem = ProtocolPropertiesUtils.getAbstractConsoleItem(consoleItems, property);

  4295.                 if(consoleItem != null) {
  4296.                     if(consoleItem instanceof BinaryConsoleItem && consoleItem.getId().equals(nome)){
  4297.                         BinaryProperty bp = (BinaryProperty) property;
  4298.                         if (consoleItem.isRequired() && (bp.getValue() == null || bp.getValue().length == 0)) {
  4299.                             throw new ProtocolException(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, consoleItem.getLabel()));
  4300.                         }

  4301.                     }
  4302.                 }
  4303.             }

  4304.         } catch (ProtocolException e) {
  4305.             throw e;
  4306.         }

  4307.     }

  4308.    
  4309.     public List<DataElement> addRuoliToDati(TipoOperazione tipoOp,List<DataElement> dati,boolean enableUpdate, FiltroRicercaRuoli filtroRuoli, String nome,
  4310.             List<String> ruoliGiaConfigurati, boolean addSelezioneVuota, boolean addMsgServiziApplicativoNonDisponibili,
  4311.             boolean addTitoloSezione,
  4312.             String accessDaChangeTmp,
  4313.             boolean isToken) throws DriverRegistroServiziException {
  4314.         return this.addRuoliToDati(tipoOp, dati, enableUpdate, filtroRuoli, nome, ruoliGiaConfigurati,
  4315.                 addSelezioneVuota, addMsgServiziApplicativoNonDisponibili, CostantiControlStation.LABEL_PARAMETRO_RUOLO,
  4316.                 addTitoloSezione, accessDaChangeTmp,
  4317.                 isToken);
  4318.     }
  4319.     public List<DataElement> addRuoliToDati(TipoOperazione tipoOp,List<DataElement> dati,boolean enableUpdate, FiltroRicercaRuoli filtroRuoli, String nome,
  4320.             List<String> ruoliGiaConfigurati, boolean addSelezioneVuota, boolean addMsgServiziApplicativoNonDisponibili, String labelParametro,
  4321.             boolean addTitoloSezione,
  4322.             String accessDaChangeTmp,
  4323.             boolean isToken) throws DriverRegistroServiziException {

  4324.         List<String> allRuoli = this.confCore.getAllRuoli(filtroRuoli);
  4325.         List<String> ruoliDaFarScegliere = new ArrayList<>();
  4326.         if(ruoliGiaConfigurati!=null && ruoliGiaConfigurati.size()>0){
  4327.             for (String ruolo : allRuoli) {
  4328.                 if(ruoliGiaConfigurati.contains(ruolo)==false){
  4329.                     ruoliDaFarScegliere.add(ruolo);
  4330.                 }
  4331.             }
  4332.         }
  4333.         else{
  4334.             ruoliDaFarScegliere.addAll(allRuoli);
  4335.         }
  4336.        
  4337.         DataElement de = new DataElement();
  4338.         de.setName(CostantiControlStation.PARAMETRO_ACCESSO_DA_CHANGE);
  4339.         de.setType(DataElementType.HIDDEN);
  4340.         de.setValue(accessDaChangeTmp);
  4341.         dati.add(de);
  4342.        
  4343.         if(isToken) {
  4344.             de = new DataElement();
  4345.             de.setType(DataElementType.HIDDEN);
  4346.             de.setName(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION);
  4347.             de.setValue("true");
  4348.             dati.add(de);
  4349.         }
  4350.        
  4351.         // Nome
  4352.         if(ruoliDaFarScegliere.size()>0){
  4353.            
  4354.             if(addTitoloSezione){
  4355.                 de = new DataElement();
  4356.                 de.setLabel(RuoliCostanti.LABEL_RUOLO);
  4357.                 de.setType(DataElementType.TITLE);
  4358.                 dati.add(de);
  4359.             }
  4360.            
  4361.             List<String> ruoli = new ArrayList<>();
  4362.             if(addSelezioneVuota){
  4363.                 ruoli.add("-");
  4364.             }
  4365.             ruoli.addAll(ruoliDaFarScegliere);
  4366.            
  4367.             de = new DataElement();
  4368.             de.setLabel(labelParametro);
  4369.             de.setValue(nome);
  4370.             if (tipoOp.equals(TipoOperazione.ADD) || enableUpdate) {
  4371.                 de.setType(DataElementType.SELECT);
  4372.                 de.setValues(ruoli);
  4373.                 de.setSelected(nome);
  4374.             } else {
  4375.                 de.setType(DataElementType.TEXT);
  4376.             }
  4377.             de.setName(CostantiControlStation.PARAMETRO_RUOLO);
  4378.             de.setSize(this.getSize());
  4379.             dati.add(de);
  4380.         }
  4381.         else{
  4382.             if(addMsgServiziApplicativoNonDisponibili){
  4383.                 if(allRuoli.size()>0){
  4384.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_ESISTONO_ULTERIORI_RUOLI_ASSOCIABILI);
  4385.                 }
  4386.                 else{
  4387.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_ESISTONO_RUOLI_ASSOCIABILI);
  4388.                 }
  4389.                 this.pd.disableEditMode();
  4390.             }
  4391.         }

  4392.         return dati;
  4393.     }
  4394.     public List<DataElement> addScopeToDati(TipoOperazione tipoOp,List<DataElement> dati,boolean enableUpdate, FiltroRicercaScope filtroScope, String nome,
  4395.             List<String> ruoliGiaConfigurati, boolean addSelezioneVuota, boolean addMsgServiziApplicativoNonDisponibili,
  4396.             boolean addTitoloSezione) throws DriverRegistroServiziException {
  4397.         return this.addScopeToDati(tipoOp, dati, enableUpdate, filtroScope, nome, ruoliGiaConfigurati,
  4398.                 addSelezioneVuota, addMsgServiziApplicativoNonDisponibili, CostantiControlStation.LABEL_PARAMETRO_SCOPE,
  4399.                 addTitoloSezione);
  4400.     }
  4401.     public List<DataElement> addScopeToDati(TipoOperazione tipoOp,List<DataElement> dati,boolean enableUpdate, FiltroRicercaScope filtroScope, String nome,
  4402.             List<String> scopeGiaConfigurati, boolean addSelezioneVuota, boolean addMsgServiziApplicativoNonDisponibili, String labelParametro,
  4403.             boolean addTitoloSezione) throws DriverRegistroServiziException {

  4404.         List<String> allRuoli = this.confCore.getAllScope(filtroScope);
  4405.         List<String> scopeDaFarScegliere = new ArrayList<>();
  4406.         if(scopeGiaConfigurati!=null && scopeGiaConfigurati.size()>0){
  4407.             for (String ruolo : allRuoli) {
  4408.                 if(scopeGiaConfigurati.contains(ruolo)==false){
  4409.                     scopeDaFarScegliere.add(ruolo);
  4410.                 }
  4411.             }
  4412.         }
  4413.         else{
  4414.             scopeDaFarScegliere.addAll(allRuoli);
  4415.         }
  4416.        
  4417.         // Nome
  4418.         if(scopeDaFarScegliere.size()>0){
  4419.            
  4420.             if(addTitoloSezione){
  4421.                 DataElement de = new DataElement();
  4422.                 de.setLabel(ScopeCostanti.LABEL_SCOPE);
  4423.                 de.setType(DataElementType.TITLE);
  4424.                 dati.add(de);
  4425.             }
  4426.            
  4427.             List<String> ruoli = new ArrayList<>();
  4428.             if(addSelezioneVuota){
  4429.                 ruoli.add("-");
  4430.             }
  4431.             ruoli.addAll(scopeDaFarScegliere);
  4432.            
  4433.             DataElement de = new DataElement();
  4434.             de.setLabel(labelParametro);
  4435.             de.setValue(nome);
  4436.             if (tipoOp.equals(TipoOperazione.ADD) || enableUpdate) {
  4437.                 de.setType(DataElementType.SELECT);
  4438.                 de.setValues(ruoli);
  4439.                 de.setSelected(nome);
  4440.             } else {
  4441.                 de.setType(DataElementType.TEXT);
  4442.             }
  4443.             de.setName(CostantiControlStation.PARAMETRO_SCOPE);
  4444.             de.setSize(this.getSize());
  4445.             dati.add(de);
  4446.         }
  4447.         else{
  4448.             if(addMsgServiziApplicativoNonDisponibili){
  4449.                 if(allRuoli.size()>0){
  4450.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_ESISTONO_ULTERIORI_SCOPE_ASSOCIABILI);
  4451.                 }
  4452.                 else{
  4453.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_ESISTONO_SCOPE_ASSOCIABILI);
  4454.                 }
  4455.                 this.pd.disableEditMode();
  4456.             }
  4457.         }

  4458.         return dati;
  4459.     }
  4460.    
  4461.     public boolean ruoloCheckData(TipoOperazione tipoOp, String nome, List<String> ruoli) throws DriverControlStationException {
  4462.         try {
  4463.            
  4464.             if(ruoli!=null && ruoli.contains(nome)){
  4465.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_IL_RUOLO_XX_E_GIA_STATO_ASSOCIATA_AL_SOGGETTO, nome));
  4466.                 return false;
  4467.             }

  4468.             return true;

  4469.         } catch (Exception e) {
  4470.             this.logError("Exception: " + e.getMessage(), e);
  4471.             throw new DriverControlStationException(e);
  4472.         }
  4473.     }
  4474.    
  4475.     public boolean scopeCheckData(TipoOperazione tipoOp, String nome, List<String> scopes) throws DriverControlStationException {
  4476.         try {
  4477.            
  4478.             if(scopes!=null && scopes.contains(nome)){
  4479.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_LO_SCOPE_XX_E_GIA_STATO_ASSOCIATA_AL_SOGGETTO, nome));
  4480.                 return false;
  4481.             }

  4482.             return true;

  4483.         } catch (Exception e) {
  4484.             this.logError("Exception: " + e.getMessage(), e);
  4485.             throw new DriverControlStationException(e);
  4486.         }
  4487.     }
  4488.    
  4489.     public void controlloAccessi(List<DataElement> dati) throws DriverControlStationException{
  4490.         DataElement de = new DataElement();
  4491.         de.setType(DataElementType.TITLE);
  4492.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI);
  4493.         dati.add(de);
  4494.     }
  4495.    
  4496.     public List<String> convertFromDataElementValue_parametroAutenticazioneList(String autenticazione, TipoAutenticazionePrincipal autenticazionePrincipal) throws DriverControlStationException{
  4497.         List<String> l = null;
  4498.        
  4499.         if(TipoAutenticazione.BASIC.equals(autenticazione)) {
  4500.            
  4501.             // posizione 0: clean
  4502.             String v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  4503.             if(v!=null && !"".equals(v)) {
  4504.                 l = new ArrayList<>();
  4505.                 l.add(v);
  4506.             }
  4507.            
  4508.         }
  4509.         else if(TipoAutenticazione.PRINCIPAL.equals(autenticazione)) {
  4510.                                
  4511.             if(autenticazionePrincipal==null) {
  4512.                 autenticazionePrincipal = TipoAutenticazionePrincipal.CONTAINER;    
  4513.             }
  4514.            
  4515.             switch (autenticazionePrincipal) {
  4516.             case CONTAINER:
  4517.             case INDIRIZZO_IP:
  4518.             case INDIRIZZO_IP_X_FORWARDED_FOR:
  4519.                 break;
  4520.             case HEADER:
  4521.             case FORM:
  4522.                
  4523.                 // posizione 0: nome
  4524.                 String v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  4525.                 if(v!=null && !"".equals(v)) {
  4526.                     l = new ArrayList<>();
  4527.                     l.add(v);
  4528.                 }
  4529.                
  4530.                 // posizione 1: clean
  4531.                 if(l==null) {
  4532.                     break;
  4533.                 }
  4534.                 v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  4535.                 if(v!=null && !"".equals(v)) {
  4536.                     l.add(v);
  4537.                 }

  4538.                 break;
  4539.             case URL:
  4540.                
  4541.                 // posizione 0: pattern
  4542.                 v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  4543.                 if(v!=null && !"".equals(v)) {
  4544.                     l = new ArrayList<>();
  4545.                     l.add(v);
  4546.                 }
  4547.                 break;
  4548.             case TOKEN:
  4549.                
  4550.                 // posizione 0: tipoToken
  4551.                 v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  4552.                 if(v!=null && !"".equals(v)) {
  4553.                     l = new ArrayList<>();
  4554.                     l.add(v);
  4555.                 }
  4556.                
  4557.                 // posizione 1: nome claim proprietario
  4558.                 if(l==null) {
  4559.                     break;
  4560.                 }
  4561.                 v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  4562.                 if(v!=null && !"".equals(v)) {
  4563.                     l.add(v);
  4564.                 }

  4565.                 break;
  4566.             }
  4567.         }
  4568.         else if(TipoAutenticazione.APIKEY.equals(autenticazione)) {
  4569.            
  4570.             // DATA ELEMENT
  4571.             // 0: appId (CHECKBOX)
  4572.             // 1: posizione (MULTI_SELECT)
  4573.             // 2: useOAS3Names (CHECKBOX)
  4574.             // 3: forwardApiKey (CHECKBOX)
  4575.             // 4: queryParameterApiKey (TEXT_EDIT)
  4576.             // 5: headerApiKey (TEXT_EDIT)
  4577.             // 6: cookieApiKey (TEXT_EDIT)
  4578.             // 7: forwardAppId (CHECKBOX)
  4579.             // 8: queryParameterAppId (TEXT_EDIT)
  4580.             // 9: headerAppId (TEXT_EDIT)
  4581.             // 10: cookieAppId (TEXT_EDIT)
  4582.            
  4583.             l = new ArrayList<>();
  4584.            
  4585.             // posizione 0: appId
  4586.             String v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  4587.             l.add(ServletUtils.isCheckBoxEnabled(v)+"");
  4588.            
  4589.             // posizione 1: queryParameter
  4590.             // posizione 2: header
  4591.             // posizione 3: cookie
  4592.             String [] vPos = this.getParameterValues(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  4593.             boolean query = false;
  4594.             boolean header = false;
  4595.             boolean cookie = false;
  4596.             if(vPos!=null && vPos.length>0) {
  4597.                 for (int i = 0; i < vPos.length; i++) {
  4598.                     String sel = vPos[i];
  4599.                     if(ParametriAutenticazioneApiKey.QUERY_PARAMETER.equals(sel)) {
  4600.                         query = true;
  4601.                     }
  4602.                     else if(ParametriAutenticazioneApiKey.HEADER.equals(sel)) {
  4603.                         header = true;
  4604.                     }
  4605.                     else if(ParametriAutenticazioneApiKey.COOKIE.equals(sel)) {
  4606.                         cookie = true;
  4607.                     }
  4608.                 }
  4609.             }
  4610.             l.add(query+"");
  4611.             l.add(header+"");
  4612.             l.add(cookie+"");
  4613.            
  4614.             // posizione 4: useOAS3Names
  4615.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+2);
  4616.             l.add(ServletUtils.isCheckBoxEnabled(v)+"");
  4617.            
  4618.             // posizione 5: cleanApiKey
  4619.             String forwardApiKey = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+3);
  4620.             if (ServletUtils.isCheckBoxEnabled(forwardApiKey)) {
  4621.                 l.add(false+"");
  4622.             }
  4623.             else {
  4624.                 l.add(true+"");
  4625.             }

  4626.             // posizione 6: cleanAppId
  4627.             String forwardAppId = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+7);
  4628.             if (ServletUtils.isCheckBoxEnabled(forwardAppId)) {
  4629.                 l.add(false+"");
  4630.             }
  4631.             else {
  4632.                 l.add(true+"");
  4633.             }

  4634.             // posizione 7: queryParameterApiKey
  4635.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+4);
  4636.             l.add(v);
  4637.            
  4638.             // posizione 8: headerApiKey
  4639.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+5);
  4640.             l.add(v);
  4641.            
  4642.             // posizione 9: cookieApiKey
  4643.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+6);
  4644.             l.add(v);
  4645.            
  4646.             // posizione 10: queryParameterAppId
  4647.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+8);
  4648.             l.add(v);
  4649.            
  4650.             // posizione 11: headerAppId
  4651.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+9);
  4652.             l.add(v);
  4653.            
  4654.             // posizione 12: cookieAppId
  4655.             v = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+10);
  4656.             l.add(v);
  4657.         }
  4658.        
  4659.         return l;
  4660.     }
  4661.    
  4662.     public void controlloAccessiAdd(List<DataElement> dati, TipoOperazione tipoOperazione, String statoControlloAccessiAdd, boolean forceAutenticato) {
  4663.        
  4664.         if(!this.isModalitaCompleta() && TipoOperazione.ADD.equals(tipoOperazione)) {
  4665.            
  4666.             if(!forceAutenticato) {
  4667.                 DataElement de = new DataElement();
  4668.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI );
  4669.                 de.setType(DataElementType.TITLE);
  4670.                 dati.add(de);
  4671.             }
  4672.            
  4673.             DataElement de = new DataElement();
  4674.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_STATO);
  4675.             de.setName(CostantiControlStation.PARAMETRO_PORTE_CONTROLLO_ACCESSI_STATO);
  4676.             if(forceAutenticato) {
  4677.                 de.setType(DataElementType.HIDDEN);
  4678.                 de.setValue(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_STATO_AUTENTICATO);
  4679.             }
  4680.             else {
  4681.                 de.setType(DataElementType.SELECT);
  4682.                 de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_PORTE_CONTROLLO_ACCESSI_STATO);
  4683.                 de.setLabels(CostantiControlStation.SELECT_VALUES_PARAMETRO_PORTE_CONTROLLO_ACCESSI_STATO);
  4684.                 de.setSelected(statoControlloAccessiAdd);
  4685.             }
  4686.             dati.add(de);
  4687.            
  4688.         }
  4689.        
  4690.     }
  4691.            
  4692.    
  4693.     public void controlloAccessiAutenticazione(List<DataElement> dati, TipoOperazione tipoOperazione, String servletChiamante, Object oggetto, String protocolloParam,
  4694.             String autenticazione, String autenticazioneCustom, String autenticazioneOpzionale,
  4695.             TipoAutenticazionePrincipal autenticazionePrincipal,  List<String> autenticazioneParametroList,
  4696.             boolean confPers, boolean isSupportatoAutenticazioneSoggetti,boolean isPortaDelegata,
  4697.             String gestioneToken,String gestioneTokenPolicy,String autenticazioneTokenIssuer,String autenticazioneTokenClientId,String autenticazioneTokenSubject,String autenticazioneTokenUsername,String autenticazioneTokenEMail,
  4698.             boolean oldAutenticazioneCustom, String urlAutenticazioneCustomProperties, int numAutenticazioneCustomPropertiesList,
  4699.             boolean forceHttps, boolean forceDisableOptional) throws DriverControlStationException{
  4700.        
  4701.         boolean tokenAbilitato = StatoFunzionalita.ABILITATO.getValue().equalsIgnoreCase(gestioneToken) &&
  4702.                 gestioneTokenPolicy != null && !gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO);
  4703.        
  4704.         boolean mostraSezione = !tipoOperazione.equals(TipoOperazione.ADD) ||
  4705.                 (isPortaDelegata ? this.core.isEnabledAutenticazione_generazioneAutomaticaPorteDelegate() : this.core.isEnabledAutenticazione_generazioneAutomaticaPorteApplicative());
  4706.        
  4707.         boolean allHidden = false;
  4708.         if(!this.isModalitaCompleta() && TipoOperazione.ADD.equals(tipoOperazione)) {
  4709.             allHidden = true;
  4710.         }
  4711.        
  4712.         String protocollo = protocolloParam;
  4713.         if((protocollo==null || "".equals(protocollo)) && oggetto!=null){
  4714.             if(isPortaDelegata){
  4715.                 PortaDelegata pd = (PortaDelegata) oggetto;
  4716.                 if(pd!=null && pd.getServizio()!=null && pd.getServizio().getTipo()!=null) {
  4717.                     try {
  4718.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pd.getServizio().getTipo());
  4719.                     }catch(Exception e) {
  4720.                         throw new DriverControlStationException(e.getMessage(),e);
  4721.                     }
  4722.                 }
  4723.             }
  4724.             else {
  4725.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  4726.                 if(pa!=null && pa.getServizio()!=null && pa.getServizio().getTipo()!=null) {
  4727.                     try {
  4728.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pa.getServizio().getTipo());
  4729.                     }catch(Exception e) {
  4730.                         throw new DriverControlStationException(e.getMessage(),e);
  4731.                     }
  4732.                 }
  4733.             }
  4734.         }
  4735.        
  4736.         boolean existsAutorizzazioniPuntuali = false;
  4737.         if(oggetto!=null) {
  4738.             if(isPortaDelegata){
  4739.                 PortaDelegata pdObject = (PortaDelegata) oggetto;
  4740.                 if(pdObject!=null && pdObject.sizeServizioApplicativoList()>0) {
  4741.                     existsAutorizzazioniPuntuali = true;
  4742.                 }
  4743.             }
  4744.             else {
  4745.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  4746.                 if(pa!=null &&
  4747.                     (
  4748.                             (pa.getSoggetti()!=null && pa.getSoggetti().sizeSoggettoList()>0)
  4749.                             ||
  4750.                             (pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0))
  4751.                     ){
  4752.                     existsAutorizzazioniPuntuali = true;
  4753.                 }
  4754.             }
  4755.         }
  4756.        
  4757.         boolean modipa = this.isProfiloModIPA(protocollo);
  4758.        
  4759.         if(forceHttps) {
  4760.             autenticazione = TipoAutenticazione.SSL.getValue();
  4761.         }
  4762.         if(forceDisableOptional) {
  4763.             // Fix: se l'autenticazioneOpzionale risulta abilitata e sono nella servlet di cambio controllo degli accessi, significa che siamo arrivati da una condizione in cui l'erogazione era stata creata con API C01 e poi successivamente l'API è stata modificata in C02
  4764.             if(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI.equals(servletChiamante) && ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale)) {
  4765.                 forceDisableOptional=false;
  4766.             }
  4767.             else {
  4768.                 autenticazioneOpzionale = Costanti.CHECK_BOX_DISABLED;
  4769.             }
  4770.         }
  4771.                
  4772.         if(mostraSezione){
  4773.            
  4774.             if(tokenAbilitato) {

  4775.                 if(!allHidden) {
  4776.                     DataElement de = new DataElement();
  4777.                     de.setType(DataElementType.SUBTITLE); //SUBTITLE);
  4778.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TOKEN_CLAIMS);
  4779.                     dati.add(de);
  4780.                 }
  4781.                
  4782.                 DataElement de = new DataElement();
  4783.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_ISSUER);
  4784.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_ISSUER);
  4785.                 if(allHidden) {
  4786.                     de.setType(DataElementType.HIDDEN);
  4787.                     de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneTokenIssuer)+"");
  4788.                 }
  4789.                 else {
  4790.                     de.setType(DataElementType.CHECKBOX);
  4791.                     de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneTokenIssuer));
  4792.                 }
  4793.                 dati.add(de);
  4794.                
  4795.                 de = new DataElement();
  4796.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_CLIENT_ID);
  4797.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_CLIENT_ID);
  4798.                 if(allHidden) {
  4799.                     de.setType(DataElementType.HIDDEN);
  4800.                     de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneTokenClientId)+"");
  4801.                 }
  4802.                 else {
  4803.                     de.setType(DataElementType.CHECKBOX);
  4804.                     de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneTokenClientId));
  4805.                 }
  4806.                 dati.add(de);
  4807.                
  4808.                 de = new DataElement();
  4809.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_SUBJECT);
  4810.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_SUBJECT);
  4811.                 if(allHidden) {
  4812.                     de.setType(DataElementType.HIDDEN);
  4813.                     de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneTokenSubject)+"");
  4814.                 }
  4815.                 else {
  4816.                     de.setType(DataElementType.CHECKBOX);
  4817.                     de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneTokenSubject));
  4818.                 }
  4819.                 dati.add(de);
  4820.                
  4821.                 de = new DataElement();
  4822.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_USERNAME);
  4823.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_USERNAME);
  4824.                 if(allHidden) {
  4825.                     de.setType(DataElementType.HIDDEN);
  4826.                     de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneTokenUsername)+"");
  4827.                 }
  4828.                 else {
  4829.                     de.setType(DataElementType.CHECKBOX);
  4830.                     de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneTokenUsername));
  4831.                 }
  4832.                 dati.add(de);
  4833.                
  4834.                 de = new DataElement();
  4835.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_MAIL);
  4836.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_MAIL);
  4837.                 if(allHidden) {
  4838.                     de.setType(DataElementType.HIDDEN);
  4839.                     de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneTokenEMail)+"");
  4840.                 }
  4841.                 else {
  4842.                     de.setType(DataElementType.CHECKBOX);
  4843.                     de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneTokenEMail));
  4844.                 }
  4845.                 dati.add(de);
  4846.                
  4847.             }
  4848.            
  4849.             boolean addTitle = !allHidden && isSupportatoAutenticazioneSoggetti;
  4850.             if(addTitle) {
  4851.                 DataElement de = new DataElement();
  4852.                 de.setType(DataElementType.TITLE); //SUBTITLE);
  4853.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TITLE);
  4854.                 if(modipa && !isPortaDelegata) {
  4855.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE+" "+CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_CANALE);
  4856.                 }
  4857.                 else {
  4858.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE+" "+CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TRASPORTO);
  4859.                 }
  4860.                 de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.APERTO);
  4861.                 dati.add(de);
  4862.             }
  4863.            
  4864.             if(isSupportatoAutenticazioneSoggetti){
  4865.                
  4866. //              if(!allHidden) {
  4867. //                  DataElement de = new DataElement();
  4868. //                  de.setType(DataElementType.SUBTITLE); //SUBTITLE);
  4869. //                  de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TRASPORTO);
  4870. //                  dati.add(de);
  4871. //              }
  4872.            
  4873.                 List<String> autenticazioneValues = TipoAutenticazione.getValues();
  4874.                 List<String> autenticazioneLabels = TipoAutenticazione.getLabels();
  4875.                 int totEl = autenticazioneValues.size();
  4876.                 if (confPers)
  4877.                     totEl++;
  4878.                 String[] tipoAutenticazione = new String[totEl];
  4879.                 String[] labelTipoAutenticazione = new String[totEl];
  4880.                 for (int i = 0; i < autenticazioneValues.size(); i++) {
  4881.                     tipoAutenticazione[i]=autenticazioneValues.get(i);
  4882.                     labelTipoAutenticazione[i]=autenticazioneLabels.get(i);
  4883.                 }
  4884.                 if (confPers ){
  4885.                     tipoAutenticazione[totEl-1] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  4886.                     labelTipoAutenticazione[totEl-1] = CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  4887.                 }
  4888.                 DataElement de = new DataElement();
  4889.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE);
  4890.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE);
  4891.                 if(allHidden) {
  4892.                     de.setType(DataElementType.HIDDEN);
  4893.                     de.setValue(autenticazione);
  4894.                 }
  4895.                 else {
  4896.                     if(forceHttps) {
  4897.                         de.setType(DataElementType.HIDDEN);
  4898.                         de.setValue(autenticazione);
  4899.                         dati.add(de);
  4900.                        
  4901.                         de = new DataElement();
  4902.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE);
  4903.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  4904.                         de.setType(DataElementType.TEXT);
  4905.                         de.setValue(TipoAutenticazione.SSL.getLabel());
  4906.                         de.setValoreDefault(TipoAutenticazione.DISABILITATO.getLabel());
  4907.                     }
  4908.                     else if(existsAutorizzazioniPuntuali) {
  4909.                         de.setType(DataElementType.HIDDEN);
  4910.                         de.setValue(autenticazione);
  4911.                         dati.add(de);
  4912.                        
  4913.                         de = new DataElement();
  4914.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE);
  4915.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  4916.                         de.setType(DataElementType.TEXT);
  4917.                         String labelAutenticazione = null;
  4918.                         for (int i = 0; i < tipoAutenticazione.length; i++) {
  4919.                             if(autenticazione!=null && autenticazione.equals(tipoAutenticazione[i])) {
  4920.                                 labelAutenticazione = labelTipoAutenticazione[i];
  4921.                                 break;
  4922.                             }
  4923.                         }
  4924.                         de.setValue(labelAutenticazione!=null ? labelAutenticazione : autenticazione);
  4925.                         de.setValoreDefault(TipoAutenticazione.DISABILITATO.getLabel());
  4926.                     }
  4927.                     else {
  4928.                         de.setType(DataElementType.SELECT);
  4929.                         de.setValues(tipoAutenticazione);
  4930.                         de.setLabels(labelTipoAutenticazione);
  4931.                         de.setPostBack(true);
  4932.                         de.setSelected(autenticazione);
  4933.                         de.setValoreDefaultSelect(TipoAutenticazione.DISABILITATO.getValue());
  4934.                     }
  4935.                 }
  4936.                 dati.add(de);
  4937.        
  4938.                 String tipoAutenticazioneCustom = isPortaDelegata ? Filtri.FILTRO_RUOLO_VALORE_FRUIZIONE : Filtri.FILTRO_RUOLO_VALORE_EROGAZIONE;
  4939.                 boolean autenticazioneCustomHidden = (allHidden || (autenticazione == null) || (!autenticazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM)));
  4940.                 this.addCustomField(TipoPlugin.AUTENTICAZIONE,
  4941.                         tipoAutenticazioneCustom,
  4942.                         null,
  4943.                         CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE,
  4944.                         CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM,
  4945.                         CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM,
  4946.                         autenticazioneCustom, autenticazioneCustomHidden, dati,
  4947.                         false);    
  4948.                 /**
  4949.                 de = new DataElement();
  4950.                 de.setLabel("");
  4951.                 if(allHidden) {
  4952.                     de.setType(DataElementType.HIDDEN);
  4953.                 }
  4954.                 else if (autenticazione == null ||
  4955.                         !autenticazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM)) {
  4956.                     de.setType(DataElementType.HIDDEN);
  4957.                 }else {
  4958.                     de.setType(DataElementType.TEXT_EDIT);
  4959.                     de.setRequired(true);
  4960.                 }
  4961.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM);
  4962.                 de.setValue(autenticazioneCustom);
  4963.                 dati.add(de);
  4964.                 */
  4965.                
  4966.                 // se ho salvato il tipo custom faccio vedere il link alle proprieta'
  4967.                 if(autenticazione != null && autenticazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM)) {
  4968.                     if(oldAutenticazioneCustom) {
  4969.                         Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
  4970.                         de = new DataElement();
  4971.                         de.setType(DataElementType.LINK);
  4972.                         de.setUrl(urlAutenticazioneCustomProperties);
  4973.                         String labelCustomProperties = CostantiControlStation.LABEL_PARAMETRO_AUTENTICAZIONE_CUSTOM_PROPERTIES;
  4974.                         if (contaListe) {
  4975.                             ServletUtils.setDataElementCustomLabel(de,labelCustomProperties,Long.valueOf(numAutenticazioneCustomPropertiesList));
  4976.                         } else {
  4977.                             ServletUtils.setDataElementCustomLabel(de,labelCustomProperties);
  4978.                         }
  4979.                         dati.add(de);
  4980.                     }
  4981.                 }
  4982.                        
  4983.                 try {
  4984.                     if(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE.equals(this.getPostBackElementName())) {
  4985.                         autenticazioneParametroList = null;
  4986.                     }
  4987.                 }catch(Exception e) {
  4988.                     // ignore
  4989.                 }
  4990.                
  4991.                 boolean addOpzionale = true;
  4992.                
  4993.                 if(TipoAutenticazione.BASIC.equals(autenticazione)) {
  4994.                    
  4995.                     // posizione 0: clean
  4996.                     String autenticazioneParametro = null;
  4997.                     if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty()) {
  4998.                         autenticazioneParametro = autenticazioneParametroList.get(0);
  4999.                     }
  5000.                    
  5001.                     de = new DataElement();
  5002.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_BASIC_FORWARD);
  5003.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  5004.                     if(allHidden) {
  5005.                         de.setType(DataElementType.HIDDEN);
  5006.                         de.setValue(ServletUtils.isCheckBoxEnabled(autenticazioneParametro)+"");
  5007.                     }
  5008.                     else {
  5009.                         de.setType(DataElementType.CHECKBOX);
  5010.                         if(autenticazioneParametro==null || "".equals(autenticazioneParametro)) {
  5011.                             autenticazioneParametro = Costanti.CHECK_BOX_DISABLED;
  5012.                         }
  5013.                         de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneParametro));
  5014.                     }
  5015.                     dati.add(de);
  5016.                 }
  5017.                 else if(TipoAutenticazione.PRINCIPAL.equals(autenticazione)) {
  5018.                                        
  5019.                     List<String> autenticazionePrincipalValues = TipoAutenticazionePrincipal.getValues(tokenAbilitato);
  5020.                     List<String> autenticazionePrincipalLabels = TipoAutenticazionePrincipal.getLabels(tokenAbilitato);
  5021.                     de = new DataElement();
  5022.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TIPO);
  5023.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TIPO);
  5024.                     if(autenticazionePrincipal==null) {
  5025.                         autenticazionePrincipal = TipoAutenticazionePrincipal.CONTAINER;    
  5026.                     }
  5027.                     if(allHidden) {
  5028.                         de.setType(DataElementType.HIDDEN);
  5029.                         de.setValue(autenticazionePrincipal.getValue());
  5030.                     }
  5031.                     else {
  5032.                         de.setType(DataElementType.SELECT);
  5033.                         de.setValues(autenticazionePrincipalValues);
  5034.                         de.setLabels(autenticazionePrincipalLabels);
  5035.                         de.setPostBack(true);
  5036.                         de.setSelected(autenticazionePrincipal.getValue());
  5037.                     }
  5038.                     dati.add(de);
  5039.                    
  5040.                     switch (autenticazionePrincipal) {
  5041.                     case CONTAINER:
  5042.                     case INDIRIZZO_IP:
  5043.                     case INDIRIZZO_IP_X_FORWARDED_FOR:
  5044.                         break;
  5045.                     case HEADER:
  5046.                     case FORM:
  5047.                        
  5048.                         // posizione 0: nome
  5049.                         String autenticazioneParametro = null;
  5050.                         if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty()) {
  5051.                             autenticazioneParametro = autenticazioneParametroList.get(0);
  5052.                         }
  5053.                         de = new DataElement();
  5054.                         if(TipoAutenticazionePrincipal.HEADER.equals(autenticazionePrincipal)) {
  5055.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_HEADER);
  5056.                         }
  5057.                         else {
  5058.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_FORM);
  5059.                         }
  5060.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  5061.                         de.setValue(autenticazioneParametro);
  5062.                         if(allHidden) {
  5063.                             de.setType(DataElementType.HIDDEN);
  5064.                         }
  5065.                         else {
  5066.                             de.setType(DataElementType.TEXT_EDIT);
  5067.                             de.setRequired(true);
  5068.                         }
  5069.                         dati.add(de);
  5070.                        
  5071.                         // posizione 1: clean
  5072.                         if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty() &&
  5073.                                 autenticazioneParametroList.size()>1) {
  5074.                             autenticazioneParametro = autenticazioneParametroList.get(1);
  5075.                         }
  5076.                         de = new DataElement();
  5077.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  5078.                         if(TipoAutenticazionePrincipal.HEADER.equals(autenticazionePrincipal)) {
  5079.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_FORWARD_HEADER);
  5080.                         }else {
  5081.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_FORWARD_FORM);
  5082.                         }
  5083.                         if(autenticazioneParametro==null || "".equals(autenticazioneParametro)) {
  5084.                             autenticazioneParametro = Costanti.CHECK_BOX_DISABLED;
  5085.                         }
  5086.                         if(allHidden) {
  5087.                             de.setType(DataElementType.HIDDEN);
  5088.                             de.setValue(autenticazioneParametro);
  5089.                         }
  5090.                         else {
  5091.                             de.setType(DataElementType.CHECKBOX);
  5092.                             de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneParametro));
  5093.                         }
  5094.                         dati.add(de);
  5095.                        
  5096.                         break;
  5097.                        
  5098.                     case URL:
  5099.                        
  5100.                         // posizione 0: pattern
  5101.                         autenticazioneParametro = null;
  5102.                         if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty()) {
  5103.                             autenticazioneParametro = autenticazioneParametroList.get(0);
  5104.                         }
  5105.                         de = new DataElement();
  5106.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_ESPRESSIONE);
  5107.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  5108.                         de.setValue(autenticazioneParametro);
  5109.                         if(allHidden) {
  5110.                             de.setType(DataElementType.HIDDEN);
  5111.                         }
  5112.                         else {
  5113.                             de.setType(DataElementType.TEXT_AREA);
  5114.                             de.setRequired(true);
  5115.                         }
  5116.                         dati.add(de);
  5117.                        
  5118.                         break;
  5119.                        
  5120.                     case TOKEN:
  5121.                        
  5122.                         // posizione 0: tipoToken
  5123.                         autenticazioneParametro = null;
  5124.                         if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty()) {
  5125.                             autenticazioneParametro = autenticazioneParametroList.get(0);
  5126.                         }
  5127.                         de = new DataElement();
  5128.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TOKEN_CLAIM);
  5129.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  5130.                         de.setValue(autenticazioneParametro);
  5131.                         if(allHidden) {
  5132.                             de.setType(DataElementType.HIDDEN);
  5133.                         }
  5134.                         else {
  5135.                             de.setType(DataElementType.SELECT);
  5136.                            
  5137.                             List<String> values = new ArrayList<>();
  5138.                             /**values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_ISSUER);*/
  5139.                             values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_SUBJECT);
  5140.                             values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_CLIENT_ID);
  5141.                             values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_EMAIL);
  5142.                             values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_USERNAME);
  5143.                             List<String> labels = new ArrayList<>();
  5144.                             labels.addAll(values);
  5145.                             values.add(ParametriAutenticazionePrincipal.TOKEN_CLAIM_CUSTOM);
  5146.                             labels.add(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TOKEN_CLAIM_PERSONALIZZATO);
  5147.                            
  5148.                             de.setValues(values);
  5149.                             de.setLabels(labels);
  5150.                             de.setSelected(autenticazioneParametro);
  5151.                             de.setRequired(true);
  5152.                             de.setPostBack(true);
  5153.                         }
  5154.                         dati.add(de);
  5155.                        
  5156.                         // posizione 1: nome claim proprietario
  5157.                         boolean claimProprietario = ParametriAutenticazionePrincipal.TOKEN_CLAIM_CUSTOM.equals(autenticazioneParametro);
  5158.                         if(claimProprietario) {
  5159.                             if(autenticazioneParametroList!=null && !autenticazioneParametroList.isEmpty() &&
  5160.                                     autenticazioneParametroList.size()>1) {
  5161.                                 autenticazioneParametro = autenticazioneParametroList.get(1);
  5162.                             }
  5163.                             else {
  5164.                                 autenticazioneParametro = null;
  5165.                             }
  5166.                             de = new DataElement();
  5167.                             de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  5168.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TOKEN_CLAIM_PERSONALIZZATO_NOME);
  5169.                             de.setValue(autenticazioneParametro);
  5170.                             if(allHidden) {
  5171.                                 de.setType(DataElementType.HIDDEN);
  5172.                             }
  5173.                             else {
  5174.                                 de.setType(DataElementType.TEXT_EDIT);
  5175.                                 de.setRequired(true);
  5176.                             }
  5177.                             dati.add(de);
  5178.                         }
  5179.                        
  5180.                         break;
  5181.                     }
  5182.                 }
  5183.                 else if(TipoAutenticazione.APIKEY.equals(autenticazione)) {
  5184.                    
  5185.                     ApiKeyState apiKeyState = new ApiKeyState(autenticazioneParametroList);
  5186.                                        
  5187.                     // 0: appId (CHECKBOX)
  5188.                     // 1: posizione (MULTI_SELECT)
  5189.                     // 2: useOAS3Names (CHECKBOX)
  5190.                     // 3: forwardApiKey (CHECKBOX)
  5191.                     // 4: queryParameterApiKey (TEXT_EDIT)
  5192.                     // 5: headerApiKey (TEXT_EDIT)
  5193.                     // 6: cookieApiKey (TEXT_EDIT)
  5194.                     // 7: forwardAppId (CHECKBOX)
  5195.                     // 8: queryParameterAppId (TEXT_EDIT)
  5196.                     // 9: headerAppId (TEXT_EDIT)
  5197.                     // 10: cookieAppId (TEXT_EDIT)
  5198.                    
  5199.                     // appId                
  5200.                     de = new DataElement();
  5201.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+0);
  5202.                     de.setValue(apiKeyState.appId);
  5203.                     if(allHidden) {
  5204.                         de.setType(DataElementType.HIDDEN);
  5205.                     }
  5206.                     else {
  5207.                         de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID);
  5208.                         de.setType(DataElementType.CHECKBOX);
  5209.                         de.setSelected(apiKeyState.appIdSelected);
  5210.                         de.setPostBack(true);
  5211.                     }
  5212.                     dati.add(de);
  5213.                    
  5214.                     // opzionale
  5215.                     addOpzionale(dati, allHidden, forceDisableOptional, autenticazioneOpzionale, autenticazione);
  5216.                     addOpzionale = false;
  5217.                    
  5218.                     // posizione
  5219.                     de = new DataElement();
  5220.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+1);
  5221.                     if(allHidden) {
  5222.                         de.setType(DataElementType.HIDDEN);
  5223.                         de.setSelezionati(apiKeyState.posizioneSelected);
  5224.                     }
  5225.                     else {
  5226.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_POSIZIONE);
  5227.                         de.setType(DataElementType.MULTI_SELECT);
  5228.                         de.setSelezionati(apiKeyState.posizioneSelected);
  5229.                         de.setValues(apiKeyState.posizioneValues);
  5230.                         de.setLabels(apiKeyState.posizioneLabels);
  5231.                         de.setRows(3);
  5232.                         de.setPostBack(!apiKeyState.useOAS3NamesSelected);
  5233.                     }
  5234.                     dati.add(de);
  5235.                    
  5236.                     // useOAS3Names            
  5237.                     de = new DataElement();
  5238.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+2);
  5239.                     de.setValue(apiKeyState.useOAS3Names);
  5240.                     if(allHidden) {
  5241.                         de.setType(DataElementType.HIDDEN);
  5242.                     }
  5243.                     else {
  5244.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_NOMI_STANDARD_OAS3);
  5245.                         de.setType(DataElementType.CHECKBOX);
  5246.                         de.setSelected(apiKeyState.useOAS3NamesSelected);
  5247.                         de.setPostBack(true);
  5248.                     }
  5249.                     dati.add(de);
  5250.                    
  5251.                     // ** sezione apiKey **
  5252.                     if(!apiKeyState.useOAS3NamesSelected) {
  5253.                         de = new DataElement();
  5254.                         de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY);
  5255.                         de.setType(DataElementType.SUBTITLE);
  5256.                         dati.add(de);
  5257.                     }
  5258.                    
  5259.                     // forwardApiKey
  5260.                     de = new DataElement();
  5261.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+3);
  5262.                     de.setValue(apiKeyState.forwardApiKey);
  5263.                     if(allHidden) {
  5264.                         de.setType(DataElementType.HIDDEN);
  5265.                     }
  5266.                     else {
  5267.                         if(apiKeyState.useOAS3NamesSelected) {
  5268.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_FORWARD_PREFIX+
  5269.                                     ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY);
  5270.                         }
  5271.                         else {
  5272.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_FORWARD);
  5273.                         }
  5274.                         de.setType(DataElementType.CHECKBOX);
  5275.                         de.setSelected(apiKeyState.forwardApiKeySelected);
  5276.                     }
  5277.                     dati.add(de);
  5278.                    
  5279.                     // queryParameterApiKey
  5280.                     de = new DataElement();
  5281.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+4);
  5282.                     de.setValue(apiKeyState.queryParameterApiKey);
  5283.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.queryParameterEnabled) {
  5284.                         de.setType(DataElementType.HIDDEN);
  5285.                     }
  5286.                     else {
  5287.                         de.setLabel(ModalitaIdentificazione.FORM_BASED.getLabel());
  5288.                         de.setType(DataElementType.TEXT_EDIT);
  5289.                         de.setValue(apiKeyState.queryParameterApiKey);
  5290.                         de.setRequired(true);
  5291.                     }
  5292.                     dati.add(de);
  5293.                    
  5294.                     // headerApiKey
  5295.                     de = new DataElement();
  5296.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+5);
  5297.                     de.setValue(apiKeyState.headerApiKey);
  5298.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.headerEnabled) {
  5299.                         de.setType(DataElementType.HIDDEN);
  5300.                     }
  5301.                     else {
  5302.                         de.setLabel(ModalitaIdentificazione.HEADER_BASED.getLabel());
  5303.                         de.setType(DataElementType.TEXT_EDIT);
  5304.                         de.setValue(apiKeyState.headerApiKey);
  5305.                         de.setRequired(true);
  5306.                     }
  5307.                     dati.add(de);
  5308.                    
  5309.                     // cookieApiKey
  5310.                     de = new DataElement();
  5311.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+6);
  5312.                     de.setValue(apiKeyState.cookieApiKey);
  5313.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.cookieEnabled) {
  5314.                         de.setType(DataElementType.HIDDEN);
  5315.                     }
  5316.                     else {
  5317.                         de.setLabel(ModalitaIdentificazione.COOKIE_BASED.getLabel());
  5318.                         de.setType(DataElementType.TEXT_EDIT);
  5319.                         de.setValue(apiKeyState.cookieApiKey);
  5320.                         de.setRequired(true);
  5321.                     }
  5322.                     dati.add(de);
  5323.                    
  5324.                    
  5325.                    
  5326.                     // ** sezione appId **
  5327.                     if(!apiKeyState.useOAS3NamesSelected && apiKeyState.appIdSelected) {
  5328.                         de = new DataElement();
  5329.                         de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID);
  5330.                         de.setType(DataElementType.SUBTITLE);
  5331.                         dati.add(de);
  5332.                     }
  5333.                    
  5334.                     // forwardAppId
  5335.                     de = new DataElement();
  5336.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+7);
  5337.                     de.setValue(apiKeyState.forwardAppId);
  5338.                     if(allHidden || !apiKeyState.appIdSelected) {
  5339.                         de.setType(DataElementType.HIDDEN);
  5340.                     }
  5341.                     else {
  5342.                         if(apiKeyState.useOAS3NamesSelected) {
  5343.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_FORWARD_PREFIX+
  5344.                                     ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID);
  5345.                         }
  5346.                         else {
  5347.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_FORWARD);
  5348.                         }
  5349.                         de.setType(DataElementType.CHECKBOX);
  5350.                         de.setSelected(apiKeyState.forwardAppIdSelected);
  5351.                     }
  5352.                     dati.add(de);
  5353.                    
  5354.                     // queryParameterAppId
  5355.                     de = new DataElement();
  5356.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+8);
  5357.                     de.setValue(apiKeyState.queryParameterAppId);
  5358.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.queryParameterEnabled || !apiKeyState.appIdSelected) {
  5359.                         de.setType(DataElementType.HIDDEN);
  5360.                     }
  5361.                     else {
  5362.                         de.setLabel(ModalitaIdentificazione.FORM_BASED.getLabel());
  5363.                         de.setType(DataElementType.TEXT_EDIT);
  5364.                         de.setValue(apiKeyState.queryParameterAppId);
  5365.                         de.setRequired(true);
  5366.                     }
  5367.                     dati.add(de);
  5368.                    
  5369.                     // headerAppId
  5370.                     de = new DataElement();
  5371.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+9);
  5372.                     de.setValue(apiKeyState.headerAppId);
  5373.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.headerEnabled || !apiKeyState.appIdSelected) {
  5374.                         de.setType(DataElementType.HIDDEN);
  5375.                     }
  5376.                     else {
  5377.                         de.setLabel(ModalitaIdentificazione.HEADER_BASED.getLabel());
  5378.                         de.setType(DataElementType.TEXT_EDIT);
  5379.                         de.setValue(apiKeyState.headerAppId);
  5380.                         de.setRequired(true);
  5381.                     }
  5382.                     dati.add(de);
  5383.                    
  5384.                     // cookieAppId
  5385.                     de = new DataElement();
  5386.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_PARAMETRO_LIST+10);
  5387.                     de.setValue(apiKeyState.cookieAppId);
  5388.                     if(allHidden || apiKeyState.useOAS3NamesSelected || !apiKeyState.cookieEnabled || !apiKeyState.appIdSelected) {
  5389.                         de.setType(DataElementType.HIDDEN);
  5390.                     }
  5391.                     else {
  5392.                         de.setLabel(ModalitaIdentificazione.COOKIE_BASED.getLabel());
  5393.                         de.setType(DataElementType.TEXT_EDIT);
  5394.                         de.setValue(apiKeyState.cookieAppId);
  5395.                         de.setRequired(true);
  5396.                     }
  5397.                     dati.add(de);
  5398.                 }
  5399.                
  5400.                 if(addOpzionale) {
  5401.                     addOpzionale(dati, allHidden, forceDisableOptional, autenticazioneOpzionale, autenticazione);
  5402.                 }
  5403.                
  5404.             }
  5405.            
  5406.             if(addTitle) {
  5407.                 this.impostaAperturaTitle(dati, CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_TITLE);
  5408.             }
  5409.            
  5410.         } else {
  5411.             DataElement de = new DataElement();
  5412.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE);
  5413.             de.setType(DataElementType.HIDDEN);
  5414.             de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE);
  5415.             de.setValue(TipoAutenticazione.DISABILITATO.getValue());
  5416.             dati.add(de);
  5417.         }
  5418.     }
  5419.    
  5420.     private void addOpzionale(List<DataElement> dati, boolean allHidden, boolean forceDisableOptional, String autenticazioneOpzionale, String autenticazione) {
  5421.         DataElement de = new DataElement();
  5422.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_OPZIONALE);
  5423.         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_OPZIONALE);
  5424.         if(forceDisableOptional) {
  5425.             de.setType(DataElementType.HIDDEN);
  5426.             de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale));
  5427.         }
  5428.         else if(!allHidden && TipoAutenticazione.DISABILITATO.getValue().equals(autenticazione)==false){
  5429.             de.setType(DataElementType.CHECKBOX);
  5430.             de.setSelected(ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale));
  5431.         }
  5432.         else{
  5433.             de.setType(DataElementType.HIDDEN);
  5434.             de.setValue("");
  5435.         }
  5436.         dati.add(de);
  5437.     }
  5438.    
  5439.    
  5440.     public void controlloAccessiGestioneToken(List<DataElement> dati, TipoOperazione tipoOperazione, String gestioneToken, String[] gestioneTokenPolicyLabels, String[] gestioneTokenPolicyValues,
  5441.             String gestioneTokenPolicy, String gestioneTokenOpzionale, String gestioneTokenValidazioneInput, String gestioneTokenIntrospection, String gestioneTokenUserInfo, String gestioneTokenForward,
  5442.             Object oggetto, String protocolloParam ,boolean isPortaDelegata, boolean forceGestioneToken) throws DriverControlStationException {
  5443.         this.controlloAccessiGestioneToken(dati, tipoOperazione, gestioneToken, gestioneTokenPolicyLabels, gestioneTokenPolicyValues,
  5444.                 gestioneTokenPolicy, gestioneTokenOpzionale, gestioneTokenValidazioneInput, gestioneTokenIntrospection, gestioneTokenUserInfo, gestioneTokenForward,
  5445.                 oggetto, protocolloParam ,isPortaDelegata, forceGestioneToken, false);
  5446.     }
  5447.     public void controlloAccessiGestioneToken(List<DataElement> dati, TipoOperazione tipoOperazione, String gestioneToken, String[] gestioneTokenPolicyLabels, String[] gestioneTokenPolicyValues,
  5448.             String gestioneTokenPolicy, String gestioneTokenOpzionale, String gestioneTokenValidazioneInput, String gestioneTokenIntrospection, String gestioneTokenUserInfo, String gestioneTokenForward,
  5449.             Object oggetto, String protocolloParam ,boolean isPortaDelegata, boolean forceGestioneToken, boolean forceMostraSezione) throws DriverControlStationException {
  5450.        
  5451.         if(oggetto!=null) {
  5452.             // nop
  5453.         }
  5454.        
  5455.         boolean mostraSezione = !tipoOperazione.equals(TipoOperazione.ADD) ||
  5456.                 (isPortaDelegata ? this.core.isEnabledToken_generazioneAutomaticaPorteDelegate() : this.core.isEnabledToken_generazioneAutomaticaPorteApplicative());
  5457.        
  5458.         if(mostraSezione || forceMostraSezione) {
  5459.            
  5460.             DataElement de = new DataElement();
  5461.             de.setType(DataElementType.TITLE);
  5462.             de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_TITLE);
  5463.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_GESTIONE_TOKEN);
  5464.             de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.CHIUSO);
  5465.             dati.add(de);
  5466.            
  5467.             String [] valoriAbilitazione = {StatoFunzionalita.DISABILITATO.getValue(), StatoFunzionalita.ABILITATO.getValue()};
  5468.            
  5469.             // stato abilitazione
  5470.             de = new DataElement();
  5471.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN);
  5472.             de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN);
  5473.             if(forceGestioneToken) {
  5474.                 de.setType(DataElementType.HIDDEN);
  5475.                 de.setValue(gestioneToken);
  5476.             }
  5477.             else {
  5478.                 de.setType(DataElementType.SELECT);
  5479.                 de.setValues(valoriAbilitazione);
  5480.                 de.setValoreDefaultSelect(StatoFunzionalita.DISABILITATO.getValue());
  5481.                 de.setPostBack(true);
  5482.                 de.setSelected(gestioneToken);
  5483.             }
  5484.             dati.add(de);
  5485.            
  5486.             if(StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)){
  5487.                 // nome della policy da utilizzare
  5488.                 de = new DataElement();
  5489.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY);
  5490.                 de.setType(DataElementType.SELECT);
  5491.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY);
  5492.                 de.setValues(gestioneTokenPolicyValues);
  5493.                 de.setValues(gestioneTokenPolicyLabels);
  5494.                 de.setSelected(gestioneTokenPolicy);
  5495.                 de.setRequired(true);
  5496.                 if(forceGestioneToken) {
  5497.                     de.setValoreDefaultSelect(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO);
  5498.                 }
  5499.                 de.setPostBack(true);
  5500.                 dati.add(de);
  5501.                
  5502.                 if(gestioneTokenPolicy != null && !gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
  5503.                    
  5504.                     Map<String, Properties> mappaDB = null;
  5505.                     try {
  5506.                         GenericProperties policySelezionata = this.confCore.getGenericProperties(gestioneTokenPolicy, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN,true);
  5507.                         mappaDB = this.confCore.readGestorePolicyTokenPropertiesConfiguration(policySelezionata.getId());
  5508.                     }catch(Exception e) {
  5509.                         throw new DriverControlStationException(e.getMessage(),e);
  5510.                     }
  5511.                        
  5512.                     de = new DataElement();
  5513.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_OPZIONALE);
  5514.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_OPZIONALE);
  5515.                     if(!isPortaDelegata && protocolloParam!=null && this.core.isProfiloModIPA(protocolloParam) &&
  5516.                             (!StatoFunzionalita.ABILITATO.getValue().equals(gestioneTokenOpzionale) )
  5517.                         ) {
  5518.                         if(forceGestioneToken) {
  5519.                             de.setType(DataElementType.HIDDEN);
  5520.                         }
  5521.                         else {
  5522.                             /** Ripristino la possibilità di impostarlo opzionale se non previsto l'utilizzo da pattern tramite indicazione sorgente */
  5523.                             de.setType(DataElementType.CHECKBOX);
  5524.                             de.setSelected(ServletUtils.isCheckBoxEnabled(gestioneTokenOpzionale));
  5525.                         }
  5526.                     }
  5527.                     else {
  5528.                         de.setType(DataElementType.CHECKBOX);
  5529.                         de.setSelected(ServletUtils.isCheckBoxEnabled(gestioneTokenOpzionale));
  5530.                     }
  5531.                     dati.add(de);
  5532.                    
  5533.                     // validazione input
  5534.                     de = new DataElement();
  5535.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT);
  5536.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT);
  5537.                     try {
  5538.                         if(TokenUtilities.isValidazioneEnabled(mappaDB)) {
  5539.                             if(forceGestioneToken && tipoOperazione.equals(TipoOperazione.ADD)) {
  5540.                                 de.setType(DataElementType.TEXT);
  5541.                                 de.setValue(gestioneTokenValidazioneInput);
  5542.                             }
  5543.                             else {
  5544.                                 de.setType(DataElementType.SELECT);
  5545.                                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA_CON_WARNING);
  5546.                                 de.setSelected(gestioneTokenValidazioneInput);
  5547.                                 de.setPostBack(true);
  5548.                             }
  5549.                         }else {
  5550.                             de.setType(DataElementType.HIDDEN);
  5551.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5552.                         }
  5553.                     }catch(Exception e) {
  5554.                         throw new DriverControlStationException(e.getMessage(),e);
  5555.                     }
  5556.                     dati.add(de);
  5557.                    
  5558.                     // introspection
  5559.                     de = new DataElement();
  5560.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION);
  5561.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION);
  5562.                     try {
  5563.                         if(TokenUtilities.isIntrospectionEnabled(mappaDB)) {
  5564.                             if(forceGestioneToken && tipoOperazione.equals(TipoOperazione.ADD)) {
  5565.                                 de.setType(DataElementType.TEXT);
  5566.                                 de.setValue(gestioneTokenIntrospection);
  5567.                             }
  5568.                             else {
  5569.                                 de.setType(DataElementType.SELECT);
  5570.                                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA_CON_WARNING);
  5571.                                 de.setSelected(gestioneTokenIntrospection);
  5572.                                 de.setPostBack(true);
  5573.                             }
  5574.                         }else {
  5575.                             de.setType(DataElementType.HIDDEN);
  5576.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5577.                         }
  5578.                     }catch(Exception e) {
  5579.                         throw new DriverControlStationException(e.getMessage(),e);
  5580.                     }
  5581.                     dati.add(de);
  5582.                    
  5583.                     // userInfo
  5584.                     de = new DataElement();
  5585.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO);
  5586.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO);
  5587.                     try {
  5588.                         if(TokenUtilities.isUserInfoEnabled(mappaDB)) {
  5589.                             if(forceGestioneToken && tipoOperazione.equals(TipoOperazione.ADD)) {
  5590.                                 de.setType(DataElementType.TEXT);
  5591.                                 de.setValue(gestioneTokenUserInfo);
  5592.                             }
  5593.                             else {
  5594.                                 de.setType(DataElementType.SELECT);
  5595.                                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA_CON_WARNING);
  5596.                                 de.setSelected(gestioneTokenUserInfo);
  5597.                                 de.setPostBack(true);
  5598.                             }
  5599.                         }else {
  5600.                             de.setType(DataElementType.HIDDEN);
  5601.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5602.                         }
  5603.                     }catch(Exception e) {
  5604.                         throw new DriverControlStationException(e.getMessage(),e);
  5605.                     }
  5606.                     dati.add(de);
  5607.                    
  5608.                     // token forward
  5609.                     de = new DataElement();
  5610.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  5611.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  5612.                     try {
  5613.                         if(TokenUtilities.isTokenForwardEnabled(mappaDB)) {
  5614.                             if(forceGestioneToken && tipoOperazione.equals(TipoOperazione.ADD)) {
  5615.                                 de.setType(DataElementType.TEXT);
  5616.                                 de.setValue(gestioneTokenForward);
  5617.                             }
  5618.                             else {
  5619.                                 de.setType(DataElementType.SELECT);
  5620.                                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  5621.                                 de.setSelected(gestioneTokenForward);
  5622.                                 de.setPostBack(true);
  5623.                             }
  5624.                         }else {
  5625.                             de.setType(DataElementType.HIDDEN);
  5626.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5627.                         }
  5628.                     }catch(Exception e) {
  5629.                         throw new DriverControlStationException(e.getMessage(),e);
  5630.                     }
  5631.                     dati.add(de);
  5632.                 }
  5633.             }
  5634.            
  5635.             this.impostaAperturaTitle(dati, CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_TITLE);
  5636.            
  5637.         } else {
  5638.             // stato abilitazione
  5639.             DataElement de = new DataElement();
  5640.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN);
  5641.             de.setType(DataElementType.HIDDEN);
  5642.             de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN);
  5643.             de.setValue(gestioneToken);
  5644.             dati.add(de);
  5645.            
  5646.             if(StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)){
  5647.                
  5648.                 // nome della policy da utilizzare
  5649.                 de = new DataElement();
  5650.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY);
  5651.                 de.setType(DataElementType.HIDDEN);
  5652.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY);
  5653.                 de.setValue(gestioneTokenPolicy);
  5654.                 dati.add(de);
  5655.                
  5656.                 if(gestioneTokenPolicy != null && !gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
  5657.                    
  5658.                     Map<String, Properties> mappaDB = null;
  5659.                     try {
  5660.                         GenericProperties policySelezionata = this.confCore.getGenericProperties(gestioneTokenPolicy, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN,true);
  5661.                         mappaDB = this.confCore.readGestorePolicyTokenPropertiesConfiguration(policySelezionata.getId());
  5662.                     }catch(Exception e) {
  5663.                         throw new DriverControlStationException(e.getMessage(),e);
  5664.                     }
  5665.                    
  5666.                     de = new DataElement();
  5667.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_OPZIONALE);
  5668.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_OPZIONALE);
  5669.                     if(!isPortaDelegata && protocolloParam!=null && this.core.isProfiloModIPA(protocolloParam) &&
  5670.                             (!StatoFunzionalita.ABILITATO.getValue().equals(gestioneTokenOpzionale) )
  5671.                         ) {
  5672.                         de.setType(DataElementType.HIDDEN);
  5673.                     }
  5674.                     else {
  5675.                         de.setType(DataElementType.HIDDEN);
  5676.                         de.setValue(ServletUtils.isCheckBoxEnabled(gestioneTokenOpzionale) ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  5677.                     }
  5678.                     dati.add(de);
  5679.                    
  5680.                     // validazione input
  5681.                     de = new DataElement();
  5682.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT);
  5683.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT);
  5684.                     de.setType(DataElementType.HIDDEN);
  5685.                     try {
  5686.                         if(TokenUtilities.isValidazioneEnabled(mappaDB)) {
  5687.                             de.setValue(gestioneTokenValidazioneInput);
  5688.                         }else {
  5689.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5690.                         }
  5691.                     }catch(Exception e) {
  5692.                         throw new DriverControlStationException(e.getMessage(),e);
  5693.                     }
  5694.                     dati.add(de);
  5695.                    
  5696.                     // introspection
  5697.                     de = new DataElement();
  5698.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION);
  5699.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION);
  5700.                     de.setType(DataElementType.HIDDEN);
  5701.                     try {
  5702.                         if(TokenUtilities.isIntrospectionEnabled(mappaDB)) {
  5703.                             de.setValue(gestioneTokenIntrospection);
  5704.                         }else {
  5705.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5706.                         }
  5707.                     }catch(Exception e) {
  5708.                         throw new DriverControlStationException(e.getMessage(),e);
  5709.                     }
  5710.                     dati.add(de);
  5711.                    
  5712.                     // userInfo
  5713.                     de = new DataElement();
  5714.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO);
  5715.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO);
  5716.                     de.setType(DataElementType.HIDDEN);
  5717.                     try {
  5718.                         if(TokenUtilities.isUserInfoEnabled(mappaDB)) {
  5719.                             de.setValue(gestioneTokenUserInfo);
  5720.                         }else {
  5721.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5722.                         }
  5723.                     }catch(Exception e) {
  5724.                         throw new DriverControlStationException(e.getMessage(),e);
  5725.                     }
  5726.                     dati.add(de);
  5727.                    
  5728.                     // token forward
  5729.                     de = new DataElement();
  5730.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  5731.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  5732.                     de.setType(DataElementType.HIDDEN);
  5733.                     try {
  5734.                         if(TokenUtilities.isTokenForwardEnabled(mappaDB)) {
  5735.                             de.setValue(gestioneTokenForward);
  5736.                         }else {
  5737.                             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  5738.                         }
  5739.                     }catch(Exception e) {
  5740.                         throw new DriverControlStationException(e.getMessage(),e);
  5741.                     }
  5742.                     dati.add(de);
  5743.                 }
  5744.             }
  5745.         }
  5746.     }
  5747.    
  5748.     public void controlloAccessiAutorizzazione(List<DataElement> dati, TipoOperazione tipoOperazione, String servletChiamante, Object oggetto, String protocolloParam,
  5749.             String autenticazione, String autenticazioneCustom,
  5750.             String autorizzazione, String autorizzazioneCustom,
  5751.             String autorizzazioneAutenticati, String urlAutorizzazioneAutenticati, int numAutenticati, List<String> autenticati, String autenticato,
  5752.             String autorizzazioneRuoli,  String urlAutorizzazioneRuoli, int numRuoli, String ruolo, String autorizzazioneRuoliTipologia, String autorizzazioneRuoliMatch,
  5753.             boolean confPers, boolean isSupportatoAutenticazione, boolean contaListe, boolean isPortaDelegata,
  5754.             boolean addTitoloSezione,String autorizzazioneScope,  String urlAutorizzazioneScope, int numScope, String scope, String autorizzazioneScopeMatch,
  5755.             String gestioneToken, String gestioneTokenPolicy, String autorizzazione_token, String autorizzazione_tokenOptions,BinaryParameter allegatoXacmlPolicy,
  5756.             String urlAutorizzazioneErogazioneApplicativiAutenticati, int numErogazioneApplicativiAutenticati,
  5757.             String urlAutorizzazioneCustomPropertiesList, int numAutorizzazioneCustomPropertiesList,
  5758.             String identificazioneAttributiStato, String[] attributeAuthorityLabels, String[] attributeAuthorityValues, String [] attributeAuthoritySelezionate, String attributeAuthorityAttributi,
  5759.             String autorizzazioneAutenticatiToken, String urlAutorizzazioneAutenticatiToken, int numAutenticatiToken,
  5760.             String autorizzazioneRuoliToken,  String urlAutorizzazioneRuoliToken, int numRuoliToken, String autorizzazioneRuoliTipologiaToken, String autorizzazioneRuoliMatchToken) throws DriverControlStationException{
  5761.         this.controlloAccessiAutorizzazione(dati, tipoOperazione, servletChiamante, oggetto, protocolloParam,
  5762.                 autenticazione, autenticazioneCustom,
  5763.                 autorizzazione, autorizzazioneCustom,
  5764.                 autorizzazioneAutenticati, urlAutorizzazioneAutenticati, numAutenticati, autenticati, null, autenticato,
  5765.                 autorizzazioneRuoli, urlAutorizzazioneRuoli, numRuoli, ruolo, autorizzazioneRuoliTipologia, autorizzazioneRuoliMatch,
  5766.                 confPers, isSupportatoAutenticazione, contaListe, isPortaDelegata, addTitoloSezione,autorizzazioneScope,urlAutorizzazioneScope,numScope,scope,autorizzazioneScopeMatch,
  5767.                 gestioneToken, gestioneTokenPolicy, autorizzazione_token, autorizzazione_tokenOptions,allegatoXacmlPolicy,
  5768.                 urlAutorizzazioneErogazioneApplicativiAutenticati, numErogazioneApplicativiAutenticati,
  5769.                 urlAutorizzazioneCustomPropertiesList, numAutorizzazioneCustomPropertiesList,
  5770.                 identificazioneAttributiStato, attributeAuthorityLabels, attributeAuthorityValues, attributeAuthoritySelezionate, attributeAuthorityAttributi,
  5771.                 autorizzazioneAutenticatiToken, urlAutorizzazioneAutenticatiToken, numAutenticatiToken,
  5772.                 autorizzazioneRuoliToken,  urlAutorizzazioneRuoliToken, numRuoliToken, autorizzazioneRuoliTipologiaToken, autorizzazioneRuoliMatchToken);
  5773.        
  5774.     }
  5775.    
  5776.     public void controlloAccessiAutorizzazione(List<DataElement> dati, TipoOperazione tipoOperazione, String servletChiamante, Object oggetto, String protocolloParam,
  5777.             String autenticazione, String autenticazioneCustom,
  5778.             String autorizzazione, String autorizzazioneCustom,
  5779.             String autorizzazioneAutenticati, String urlAutorizzazioneAutenticati, int numAutenticati, List<String> autenticati, List<String> autenticatiLabel, String autenticato,
  5780.             String autorizzazioneRuoli,  String urlAutorizzazioneRuoli, int numRuoli, String ruolo, String autorizzazioneRuoliTipologia, String autorizzazioneRuoliMatch,
  5781.             boolean confPers, boolean isSupportatoAutenticazione, boolean contaListe, boolean isPortaDelegata, boolean addTitoloSezione,
  5782.             String autorizzazioneScope,  String urlAutorizzazioneScope, int numScope, String scope, String autorizzazioneScopeMatch,
  5783.             String gestioneToken, String gestioneTokenPolicy, String autorizzazione_token, String autorizzazione_tokenOptions, BinaryParameter allegatoXacmlPolicy,
  5784.             String urlAutorizzazioneErogazioneApplicativiAutenticati, int numErogazioneApplicativiAutenticati,
  5785.             String urlAutorizzazioneCustomPropertiesList, int numAutorizzazioneCustomPropertiesList,
  5786.             String identificazioneAttributiStato, String[] attributeAuthorityLabels, String[] attributeAuthorityValues, String [] attributeAuthoritySelezionate, String attributeAuthorityAttributi,
  5787.             String autorizzazioneAutenticatiToken, String urlAutorizzazioneAutenticatiToken, int numAutenticatiToken,
  5788.             String autorizzazioneRuoliToken,  String urlAutorizzazioneRuoliToken, int numRuoliToken, String autorizzazioneRuoliTipologiaToken, String autorizzazioneRuoliMatchToken
  5789.             ) throws DriverControlStationException{
  5790.        
  5791.         boolean allHidden = false;
  5792.         if(!this.isModalitaCompleta() && TipoOperazione.ADD.equals(tipoOperazione)) {
  5793.             allHidden = true;
  5794.         }
  5795.        
  5796.         String protocollo = protocolloParam;
  5797.         if((protocollo==null || "".equals(protocollo)) && oggetto!=null){
  5798.             if(isPortaDelegata){
  5799.                 PortaDelegata pd = (PortaDelegata) oggetto;
  5800.                 if(pd!=null && pd.getServizio()!=null && pd.getServizio().getTipo()!=null) {
  5801.                     try {
  5802.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pd.getServizio().getTipo());
  5803.                     }catch(Exception e) {
  5804.                         throw new DriverControlStationException(e.getMessage(),e);
  5805.                     }
  5806.                 }
  5807.             }
  5808.             else {
  5809.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  5810.                 if(pa!=null && pa.getServizio()!=null && pa.getServizio().getTipo()!=null) {
  5811.                     try {
  5812.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pa.getServizio().getTipo());
  5813.                     }catch(Exception e) {
  5814.                         throw new DriverControlStationException(e.getMessage(),e);
  5815.                     }
  5816.                 }
  5817.             }
  5818.         }
  5819.        
  5820.         String oldAutenticazione = null;
  5821.         IDServizio idAps = null;
  5822.         if(oggetto!=null) {
  5823.             if(isPortaDelegata){
  5824.                 PortaDelegata pd = (PortaDelegata) oggetto;
  5825.                 if(pd!=null) {
  5826.                     oldAutenticazione = pd.getAutenticazione();
  5827.                 }
  5828.             }
  5829.             else {
  5830.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  5831.                 if(pa!=null) {
  5832.                     oldAutenticazione = pa.getAutenticazione();
  5833.                     if(PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI.equals(servletChiamante)) {
  5834.                         // Altrimenti arriva una porta applicativa con il solo tipo impostato
  5835.                         try {
  5836.                             idAps = IDServizioFactory.getInstance().getIDServizioFromValues(pa.getServizio().getTipo(), pa.getServizio().getNome(),
  5837.                                     pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
  5838.                                     pa.getServizio().getVersione());
  5839.                         }catch(Exception e) {
  5840.                             throw new DriverControlStationException(e.getMessage(),e);
  5841.                         }
  5842.                     }
  5843.                 }
  5844.             }
  5845.         }
  5846.                
  5847.        
  5848.         boolean mostraSezione = false;
  5849.         try {
  5850.             mostraSezione = !tipoOperazione.equals(TipoOperazione.ADD) ||
  5851.                     (isPortaDelegata ? this.core.isEnabledAutorizzazione_generazioneAutomaticaPorteDelegate() :
  5852.                         this.core.isEnabledAutorizzazione_generazioneAutomaticaPorteApplicative(protocollo==null ? true : this.soggettiCore.isSupportatoAutenticazioneSoggetti(protocollo)));
  5853.         }catch(Exception e) {
  5854.             throw new DriverControlStationException(e.getMessage(),e);
  5855.         }
  5856.        
  5857.         boolean tokenAbilitato = StatoFunzionalita.ABILITATO.getValue().equalsIgnoreCase(gestioneToken) &&
  5858.                 gestioneTokenPolicy != null && !gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO);
  5859.        
  5860.         boolean profiloModi = this.isProfiloModIPA(protocollo);
  5861.        
  5862.         @SuppressWarnings("unused")
  5863.         boolean isSupportatoAutenticazioneApplicativiEsterni = false;
  5864.         try{
  5865.             isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocollo);
  5866.         }catch(Exception e) {
  5867.             throw new DriverControlStationException(e.getMessage(),e);
  5868.         }
  5869.        
  5870.         boolean modiSicurezzaMessaggio = false;
  5871.         if(!isPortaDelegata && profiloModi && !allHidden && PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CONTROLLO_ACCESSI.equals(servletChiamante) && idAps!=null) {
  5872.             try {
  5873.                 AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idAps);
  5874.                 idAps.setPortType(asps.getPortType());
  5875.                 idAps.setUriAccordoServizioParteComune(asps.getAccordoServizioParteComune());
  5876.                
  5877.                 IProtocolFactory<?> protocolFactory = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  5878.                 IConsoleDynamicConfiguration consoleDynamicConfiguration = protocolFactory.createDynamicConfigurationConsole();
  5879.                 IRegistryReader registryReader = this.apcCore.getRegistryReader(protocolFactory);
  5880.                 IConfigIntegrationReader configRegistryReader = this.apcCore.getConfigIntegrationReader(protocolFactory);
  5881.                 ConsoleConfiguration consoleConfiguration = consoleDynamicConfiguration.getDynamicConfigAccordoServizioParteSpecifica(ConsoleOperationType.CHANGE, this,
  5882.                         registryReader, configRegistryReader, idAps );
  5883.                 if(consoleConfiguration!=null && consoleConfiguration.getConsoleItem()!=null && !consoleConfiguration.getConsoleItem().isEmpty()) {
  5884.                     modiSicurezzaMessaggio = true;
  5885.                 }
  5886.             }catch(Exception e) {
  5887.                 throw new DriverControlStationException(e.getMessage(),e);
  5888.             }
  5889.         }
  5890.        
  5891.        
  5892.         if(mostraSezione) {
  5893.            
  5894.             if(!tipoOperazione.equals(TipoOperazione.ADD) && attributeAuthorityValues!=null && attributeAuthorityValues.length>0){
  5895.                 DataElement de = new DataElement();
  5896.                 de.setType(DataElementType.TITLE); //SUBTITLE);
  5897.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_STATO_TITLE);
  5898.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_TITLE);
  5899.                 de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.CHIUSO);
  5900.                 dati.add(de);
  5901.            
  5902.                 de = new DataElement();
  5903.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_STATO);
  5904.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_STATO);
  5905.                 de.setValue(identificazioneAttributiStato);
  5906.                 if(allHidden) {
  5907.                     de.setType(DataElementType.HIDDEN);
  5908.                 }
  5909.                 else {
  5910.                     de.setType(DataElementType.SELECT);
  5911.                     String [] valoriAbilitazione = {StatoFunzionalita.DISABILITATO.getValue(), StatoFunzionalita.ABILITATO.getValue()};
  5912.                     de.setValues(valoriAbilitazione);
  5913.                     de.setPostBack(true);
  5914.                     de.setSelected(identificazioneAttributiStato);
  5915.                     de.setValoreDefaultSelect(StatoFunzionalita.DISABILITATO.getValue());
  5916.                 }
  5917.                 dati.add(de);
  5918.                
  5919.                 de = new DataElement();
  5920.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY);
  5921.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY);
  5922.                 if(allHidden || !StatoFunzionalita.ABILITATO.getValue().equals(identificazioneAttributiStato)) {
  5923.                     de.setType(DataElementType.HIDDEN);
  5924.                     de.setSelezionati(attributeAuthoritySelezionate);
  5925.                 }
  5926.                 else {
  5927.                     de.setRequired(true);
  5928.                     de.setType(DataElementType.MULTI_SELECT);
  5929.                     de.setValues(attributeAuthorityValues);
  5930.                     de.setLabels(attributeAuthorityLabels);
  5931.                     de.setPostBack(true); // cambia la descrizione in autorizzazione per claims
  5932.                     de.setSelezionati(attributeAuthoritySelezionate);
  5933.                 }
  5934.                 dati.add(de);
  5935.                
  5936.                 de = new DataElement();
  5937.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI);
  5938.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI);
  5939.                 int sizeAA = 0;
  5940.                 if(attributeAuthoritySelezionate!=null) {
  5941.                     sizeAA = attributeAuthoritySelezionate.length;
  5942.                 }
  5943.                 de.setValue(attributeAuthorityAttributi);
  5944.                 if(allHidden || !StatoFunzionalita.ABILITATO.getValue().equals(identificazioneAttributiStato)) {
  5945.                     de.setType(DataElementType.HIDDEN);
  5946.                 }
  5947.                 else if(sizeAA>1) {
  5948.                     de.setType(DataElementType.TEXT_AREA);
  5949.                     de.setNote(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI_NOTE_MULTIPLE_AA);
  5950.                     de.setRows(sizeAA<=10 ? sizeAA : 10);
  5951.                 }
  5952.                 else {
  5953.                     de.setType(DataElementType.TEXT_EDIT);
  5954.                     de.setNote(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI_NOTE_SINGLE_AA);
  5955.                 }
  5956.                 dati.add(de);
  5957.                
  5958.                 this.impostaAperturaTitle(dati, CostantiControlStation.PARAMETRO_PORTE_ATTRIBUTI_STATO_TITLE);
  5959.             }
  5960.            
  5961.            
  5962.             boolean addTitle = false;
  5963.             if(!allHidden) {
  5964.                 addTitle = true;
  5965.                 DataElement de = new DataElement();
  5966.                 de.setType(DataElementType.TITLE);
  5967.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TITLE);
  5968.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_DIFFERENTE_DA_TRASPORTO_E_TOKEN);
  5969.                 de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.APERTO);
  5970.                 dati.add(de);
  5971.             }
  5972.            
  5973.             List<String> auturizzazioneValues = AutorizzazioneUtilities.getStati();
  5974.             int totEl = auturizzazioneValues.size();
  5975.             if (confPers )
  5976.                 totEl++;
  5977.             String[] tipoAutorizzazione = new String[totEl];
  5978.             String[] tipoAutorizzazione_label = new String[totEl];
  5979.             for (int i = 0; i < auturizzazioneValues.size(); i++) {
  5980.                 tipoAutorizzazione[i]=auturizzazioneValues.get(i);
  5981.                 tipoAutorizzazione_label[i]=auturizzazioneValues.get(i);
  5982.             }
  5983.             if (confPers ){
  5984.                 tipoAutorizzazione[totEl-1] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  5985.                 tipoAutorizzazione_label[totEl-1] = CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  5986.             }
  5987.            
  5988.             if(modiSicurezzaMessaggio) {
  5989.                 // backward compatibility
  5990.                 if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione) && numErogazioneApplicativiAutenticati>0) {
  5991.                     autorizzazione=AutorizzazioneUtilities.STATO_ABILITATO;
  5992.                 }
  5993.             }
  5994.            
  5995.             DataElement de = new DataElement();
  5996.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE);
  5997.             de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE);
  5998.             if(allHidden) {
  5999.                 de.setType(DataElementType.HIDDEN);
  6000.                 de.setValue(autorizzazione);
  6001.             }
  6002.             else {
  6003.                 de.setType(DataElementType.SELECT);
  6004.                 de.setValues(tipoAutorizzazione);
  6005.                 de.setLabels(tipoAutorizzazione_label);
  6006.                 de.setPostBack(true);
  6007.                 de.setSelected(autorizzazione);
  6008.                 de.setValoreDefaultSelect(StatoFunzionalita.DISABILITATO.getValue());
  6009.             }
  6010.             dati.add(de);
  6011.            
  6012.             String tipoAutorizzazioneCustom = isPortaDelegata ? Filtri.FILTRO_RUOLO_VALORE_FRUIZIONE : Filtri.FILTRO_RUOLO_VALORE_EROGAZIONE;
  6013.             boolean autorizzazioneCustomHidden = (allHidden || (autorizzazione == null) || (!autorizzazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM)));
  6014.             this.addCustomField(TipoPlugin.AUTORIZZAZIONE,
  6015.                     tipoAutorizzazioneCustom,
  6016.                     null,
  6017.                     CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE,
  6018.                     CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM,
  6019.                     CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM,
  6020.                     autorizzazioneCustom, autorizzazioneCustomHidden, dati,
  6021.                     false);
  6022.                        
  6023.             boolean old_autorizzazione_autenticazione = false;
  6024.             boolean old_autorizzazione_ruoli = false;
  6025.             boolean old_autorizzazione_token_autenticazione = false;
  6026.             boolean old_autorizzazione_token_ruoli = false;
  6027.             boolean old_autorizzazione_scope = false;
  6028.             boolean old_xacmlPolicy = false;
  6029.             boolean old_autorizzazione_custom = false;
  6030.             String old_autorizzazione = null;
  6031.             Long idPorta = null;
  6032.             IDServizio idServizio = null;
  6033.            
  6034.             String nomePostback = this.getPostBackElementName();
  6035.             if(!CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_AUTENTICAZIONE.equals(nomePostback) &&
  6036.                     TipoOperazione.CHANGE.equals(tipoOperazione) && (numAutenticati>0)) {
  6037.                 autorizzazioneAutenticati = Costanti.CHECK_BOX_ENABLED;
  6038.             }
  6039.             if(!CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI.equals(nomePostback) &&
  6040.                     TipoOperazione.CHANGE.equals(tipoOperazione) && (numRuoli>0)) {
  6041.                 autorizzazioneRuoli = Costanti.CHECK_BOX_ENABLED;
  6042.             }
  6043.            
  6044.             if(TipoOperazione.CHANGE.equals(tipoOperazione) && oggetto!=null){
  6045.                 if(isPortaDelegata){
  6046.                     PortaDelegata pd = (PortaDelegata) oggetto;
  6047.                     old_autorizzazione = AutorizzazioneUtilities.convertToStato(pd.getAutorizzazione());
  6048.                     old_autorizzazione_autenticazione = TipoAutorizzazione.isAuthenticationRequired(pd.getAutorizzazione());
  6049.                     old_autorizzazione_ruoli = TipoAutorizzazione.isRolesRequired(pd.getAutorizzazione());
  6050.                     old_autorizzazione_token_autenticazione = pd.getAutorizzazioneToken()!=null && StatoFunzionalita.ABILITATO.equals(pd.getAutorizzazioneToken().getAutorizzazioneApplicativi());
  6051.                     old_autorizzazione_token_ruoli = pd.getAutorizzazioneToken()!=null && StatoFunzionalita.ABILITATO.equals(pd.getAutorizzazioneToken().getAutorizzazioneRuoli());
  6052.                     old_autorizzazione_scope = pd.getScope() != null && pd.getScope().getStato().equals(StatoFunzionalita.ABILITATO);
  6053.                     old_xacmlPolicy = StringUtils.isNotEmpty(pd.getXacmlPolicy());
  6054.                     idPorta = pd.getId();
  6055.                     try {
  6056.                         idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(pd.getServizio().getTipo(), pd.getServizio().getNome(),
  6057.                                 pd.getSoggettoErogatore().getTipo(), pd.getSoggettoErogatore().getNome(),
  6058.                                 pd.getServizio().getVersione());
  6059.                     }catch(Exception e) {
  6060.                         throw new DriverControlStationException(e.getMessage(),e);
  6061.                     }
  6062.                     old_autorizzazione_custom = pd.getAutorizzazione() != null && !TipoAutorizzazione.getAllValues().contains(pd.getAutorizzazione());
  6063.                 }
  6064.                 else {
  6065.                     PortaApplicativa pa = (PortaApplicativa) oggetto;
  6066.                     old_autorizzazione = AutorizzazioneUtilities.convertToStato(pa.getAutorizzazione());
  6067.                     old_autorizzazione_autenticazione = TipoAutorizzazione.isAuthenticationRequired(pa.getAutorizzazione());
  6068.                     old_autorizzazione_ruoli = TipoAutorizzazione.isRolesRequired(pa.getAutorizzazione());
  6069.                     old_autorizzazione_token_autenticazione = pa.getAutorizzazioneToken()!=null && StatoFunzionalita.ABILITATO.equals(pa.getAutorizzazioneToken().getAutorizzazioneApplicativi());
  6070.                     old_autorizzazione_token_ruoli = pa.getAutorizzazioneToken()!=null && StatoFunzionalita.ABILITATO.equals(pa.getAutorizzazioneToken().getAutorizzazioneRuoli());
  6071.                     old_autorizzazione_scope = pa.getScope() != null && pa.getScope().getStato().equals(StatoFunzionalita.ABILITATO);
  6072.                     old_xacmlPolicy = StringUtils.isNotEmpty(pa.getXacmlPolicy());
  6073.                     idPorta = pa.getId();
  6074.                     try {
  6075.                         idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(pa.getServizio().getTipo(), pa.getServizio().getNome(),
  6076.                                 pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
  6077.                                 pa.getServizio().getVersione());
  6078.                     }catch(Exception e) {
  6079.                         throw new DriverControlStationException(e.getMessage(),e);
  6080.                     }
  6081.                     old_autorizzazione_custom = pa.getAutorizzazione() != null && !TipoAutorizzazione.getAllValues().contains(pa.getAutorizzazione());
  6082.                 }
  6083.             }
  6084.            
  6085.             // se ho salvato il tipo custom faccio vedere il link alle proprieta'
  6086.             if(autorizzazione != null && autorizzazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM)) {
  6087.                 if(old_autorizzazione_custom) {
  6088.                     de = new DataElement();
  6089.                     de.setType(DataElementType.LINK);
  6090.                     de.setUrl(urlAutorizzazioneCustomPropertiesList);
  6091.                     String labelCustomProperties = CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CUSTOM_PROPERTIES;
  6092.                     if (contaListe) {
  6093.                         ServletUtils.setDataElementCustomLabel(de,labelCustomProperties,Long.valueOf(numAutorizzazioneCustomPropertiesList));
  6094.                     } else {
  6095.                         ServletUtils.setDataElementCustomLabel(de,labelCustomProperties);
  6096.                     }
  6097.                     dati.add(de);
  6098.                 }
  6099.             }

  6100.             // ** Trasporto Richiedente **
  6101.             boolean labelAutorizzazioneTrasportoAttuata = false;
  6102.             if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)==false){
  6103.            
  6104.                 boolean autorizzazione_autenticazione =  false;
  6105.                 boolean isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione = false;
  6106.                 try {
  6107.                     isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione = this.soggettiCore.isSupportatoAutorizzazioneRichiedenteSenzaAutenticazioneErogazione(protocollo);
  6108.                 }catch(Exception e) {
  6109.                     throw new DriverControlStationException(e.getMessage(),e);
  6110.                 }
  6111.                
  6112.                            
  6113.                 if(AutorizzazioneUtilities.STATO_ABILITATO.equals(autorizzazione)){
  6114.                
  6115.                     if(!allHidden) {
  6116.                         if( !isSupportatoAutenticazione
  6117.                                 ||
  6118.                                 (autenticazione!=null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  6119.                                 ||
  6120.                                 isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione
  6121.                                 ){  
  6122.                             de = new DataElement();
  6123.                             de.setType(DataElementType.SUBTITLE);
  6124.                             if(isPortaDelegata){
  6125.                                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO);
  6126.                             }
  6127.                             else{
  6128.                                
  6129.                                 String labelTrasporto = CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO;
  6130.                                 if(profiloModi && !isPortaDelegata) {
  6131.                                     labelTrasporto = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE;
  6132.                                 }
  6133.                                
  6134.                                 String labelSoggetti = (isSupportatoAutenticazione &&
  6135.                                         (
  6136.                                                 (autenticazione!=null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  6137.                                                 ||
  6138.                                                 isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione
  6139.                                         )
  6140.                                         ) ? labelTrasporto : CostantiControlStation.LABEL_PARAMETRO_SOGGETTI;
  6141.                                 de.setLabel(labelSoggetti);
  6142.                             }
  6143.                             labelAutorizzazioneTrasportoAttuata=true;
  6144.                             dati.add(de);
  6145.                         }
  6146.                     }
  6147.                    
  6148.                     autorizzazione_autenticazione = ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati);
  6149.                    
  6150.                     de = new DataElement();
  6151.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RICHIEDENTE);
  6152.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_AUTENTICAZIONE);
  6153.                     if( !isSupportatoAutenticazione
  6154.                             ||
  6155.                             (autenticazione!=null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  6156.                             ||
  6157.                             isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione
  6158.                             ){  
  6159.                         if(allHidden) {
  6160.                             de.setType(DataElementType.HIDDEN);
  6161.                             de.setValue(autorizzazione_autenticazione+"");
  6162.                         }
  6163.                         else {
  6164.                             de.setType(DataElementType.CHECKBOX);
  6165.                             de.setSelected(autorizzazione_autenticazione);
  6166.                             de.setPostBack(true);
  6167.                         }
  6168.                     }
  6169.                     else{
  6170.                         de.setType(DataElementType.HIDDEN);
  6171.                         de.setValue(Costanti.CHECK_BOX_DISABLED);
  6172.                     }
  6173.                     dati.add(de);
  6174.                    
  6175.                 }
  6176.                
  6177.                 if(TipoOperazione.CHANGE.equals(tipoOperazione)){
  6178.                    
  6179.                     if( !isSupportatoAutenticazione
  6180.                             ||
  6181.                             (autenticazione!=null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  6182.                             ||
  6183.                             isSupportatoAutorizzazioneRichiedentiSenzaAutenticazione
  6184.                             ){  
  6185.                    
  6186.                         if(urlAutorizzazioneAutenticati!=null && autorizzazione_autenticazione &&
  6187.                                 (old_autorizzazione_autenticazione || CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM.equals(old_autorizzazione)) &&
  6188.                                 (oldAutenticazione!=null && (
  6189.                                             oldAutenticazione.equals(autenticazione)
  6190.                                             ||  
  6191.                                             (CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM.equals(autenticazione) && oldAutenticazione.equals(autenticazioneCustom) )
  6192.                                         )
  6193.                                 )
  6194.                                 ){
  6195.                             de = new DataElement();
  6196.                             de.setType(DataElementType.LINK);
  6197.                             de.setUrl(urlAutorizzazioneAutenticati);
  6198.                             if(isPortaDelegata){
  6199.                                 String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI;
  6200.                                 if(!this.isModalitaCompleta()) {
  6201.                                     labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;
  6202.                                 }
  6203.                                 if (contaListe) {
  6204.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numAutenticati));
  6205.                                 } else
  6206.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  6207.                             }
  6208.                             else{
  6209.                                 if (contaListe) {
  6210.                                     ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI,Long.valueOf(numAutenticati));
  6211.                                 } else
  6212.                                     ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI);
  6213.                             }
  6214.                             dati.add(de);
  6215.                         }
  6216.                        
  6217.                         boolean supportatoAutenticazioneApplicativiErogazione = false;
  6218.                         try {
  6219.                             supportatoAutenticazioneApplicativiErogazione = this.saCore.isSupportatoAutenticazioneApplicativiErogazione(protocollo);
  6220.                         }catch(Exception e) {
  6221.                             throw new DriverControlStationException(e.getMessage(),e);
  6222.                         }
  6223.                         if(!isPortaDelegata &&  supportatoAutenticazioneApplicativiErogazione
  6224.                                 && isSupportatoAutenticazione // il link degli applicativi sulla pa deve essere visualizzato SOLO se è abilitata l'autenticazione
  6225.                                 && !profiloModi // e non siamo nel profilo ModI
  6226.                                 &&
  6227.                                 (oldAutenticazione!=null && (
  6228.                                         oldAutenticazione.equals(autenticazione)
  6229.                                         ||  
  6230.                                         (CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM.equals(autenticazione) && oldAutenticazione.equals(autenticazioneCustom) )
  6231.                                     )
  6232.                                 )
  6233.                                 ){
  6234.                             if(urlAutorizzazioneErogazioneApplicativiAutenticati!=null && autorizzazione_autenticazione && (old_autorizzazione_autenticazione || CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM.equals(old_autorizzazione)) ){
  6235.                                 de = new DataElement();
  6236.                                 de.setType(DataElementType.LINK);
  6237.                                 de.setUrl(urlAutorizzazioneErogazioneApplicativiAutenticati);
  6238.                                 String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI; // uso cmq label PD
  6239.                                 if(!this.isModalitaCompleta()) {
  6240.                                     labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;// uso cmq label PD
  6241.                                 }
  6242.                                 if (contaListe) {
  6243.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numErogazioneApplicativiAutenticati));
  6244.                                 } else {
  6245.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  6246.                                 }
  6247.                                 dati.add(de);
  6248.                             }
  6249.                         }
  6250.                     }
  6251.                 }
  6252.                 else{
  6253.                     if(!allHidden) {
  6254.                         if(!isSupportatoAutenticazione ||  (autenticazione!=null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))) {
  6255.                             if(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_FRUITORI_ADD.equals(servletChiamante) && autorizzazione_autenticazione && isPortaDelegata){
  6256.                                 String [] saArray = null;
  6257.                                 if(autenticati!=null && autenticati.size()>0){
  6258.                                     saArray = autenticati.toArray(new String[1]);
  6259.                                 }
  6260.                                 this.addPorteServizioApplicativoToDati(tipoOperazione, dati, autenticato, saArray, 0, false, false, false);
  6261.                             }
  6262.         //                  if(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante) && autorizzazione_autenticazione && !isPortaDelegata && isSupportatoAutenticazione) {
  6263.                             if(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante) && autorizzazione_autenticazione && !isPortaDelegata) {
  6264.                                 String soggettiList [] = null;
  6265.                                 String soggettiLabelList[] = null;
  6266.                                 if(autenticati!=null && autenticati.size()>0){
  6267.                                     soggettiList = autenticati.toArray(new String[1]);
  6268.                                     if(autenticatiLabel!=null && autenticatiLabel.size()>0){
  6269.                                         soggettiLabelList = autenticatiLabel.toArray(new String[1]);
  6270.                                     }
  6271.                                 }
  6272.                                 this.addPorteSoggettoToDati(tipoOperazione, dati, soggettiLabelList, soggettiList, autenticato, 0, false, false);
  6273.                             }
  6274.                         }
  6275.                     }
  6276.                 }
  6277.             }
  6278.            
  6279.             // ** Trasporto Ruoli **
  6280.             if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)==false){
  6281.                    
  6282.                 boolean autorizzazione_ruoli = false;
  6283.                
  6284.                 if(AutorizzazioneUtilities.STATO_ABILITATO.equals(autorizzazione)){
  6285.                    
  6286.                     if(!allHidden && !labelAutorizzazioneTrasportoAttuata) {
  6287.                         de = new DataElement();
  6288.                         de.setType(DataElementType.SUBTITLE);
  6289.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO);
  6290.                         dati.add(de);
  6291.                     }
  6292.                
  6293.                     autorizzazione_ruoli = ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli);
  6294.                    
  6295.                     de = new DataElement();
  6296.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RUOLI);
  6297.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI);
  6298.                     if(allHidden) {
  6299.                         de.setType(DataElementType.HIDDEN);
  6300.                         de.setValue(autorizzazione_ruoli+"");
  6301.                     }
  6302.                     else {
  6303.                         de.setType(DataElementType.CHECKBOX);
  6304.                         de.setSelected(autorizzazione_ruoli);
  6305.                         de.setPostBack(true);
  6306.                     }
  6307.                     dati.add(de);
  6308.                
  6309.                 }
  6310.                        
  6311.                 if(autorizzazione_ruoli || AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)){
  6312.                    
  6313.                     de = new DataElement();
  6314.                     if(autorizzazione_ruoli){
  6315.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO_TIPOLOGIA);
  6316.                     }
  6317.                     else{
  6318.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO_TIPOLOGIA_XACML_POLICY);
  6319.                     }
  6320.                     de.setName(CostantiControlStation.PARAMETRO_RUOLO_TIPOLOGIA);
  6321.                     de.setValue(autorizzazioneRuoliTipologia);      
  6322.                     if(allHidden) {
  6323.                         de.setType(DataElementType.HIDDEN);
  6324.                     }
  6325.                     else {
  6326.                         de.setType(DataElementType.SELECT);
  6327.                         de.setValues(RuoliCostanti.getRuoliTipologia());
  6328.                         de.setLabels(RuoliCostanti.getRuoliTipologiaLabel());
  6329.                         de.setSelected(autorizzazioneRuoliTipologia);
  6330.                         if(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_FRUITORI_ADD.equals(servletChiamante) ||
  6331.                                 AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante)){
  6332.                             de.setPostBack(true);
  6333.                         }
  6334.                     }
  6335.                     dati.add(de);
  6336.                    
  6337.                 }
  6338.                
  6339.                 String postbackElement = this.getPostBackElementName();
  6340.                 boolean aggiornatoFile = false;
  6341.                 if(postbackElement != null) {
  6342.                     if(postbackElement.equals(allegatoXacmlPolicy.getName())) {
  6343.                         aggiornatoFile = true;
  6344.                     }
  6345.                 }
  6346.                 if(AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)) {
  6347.                     String filePolicyLabel = CostantiControlStation.LABEL_PARAMETRO_DOCUMENTO_SICUREZZA_XACML_POLICY;
  6348.                     if(old_xacmlPolicy && !aggiornatoFile) {
  6349.                         filePolicyLabel = CostantiControlStation.LABEL_PARAMETRO_DOCUMENTO_SICUREZZA_XACML_NUOVA_POLICY;
  6350.                         DataElement saveAs = new DataElement();
  6351.                         saveAs.setValue(CostantiControlStation.LABEL_DOWNLOAD_DOCUMENTO_SICUREZZA_XACML_POLICY);
  6352.                         saveAs.setType(DataElementType.LINK);
  6353.                         Parameter pIdAccordo = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_ID_ACCORDO, idPorta+ "");
  6354.                         Parameter pTipoAllegato = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, isPortaDelegata ? "pd" : "pa");
  6355.                         Parameter pTipoDoc = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, isPortaDelegata ? ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_DELEGATA_XACML_POLICY : ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_APPLICATIVA_XACML_POLICY);
  6356.                         saveAs.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT, pIdAccordo, pTipoAllegato, pTipoDoc);
  6357.                         saveAs.setDisabilitaAjaxStatus();
  6358.                         dati.add(saveAs);
  6359.                        
  6360.                         de = new DataElement();
  6361.                         de.setType(DataElementType.SUBTITLE);
  6362.                         de.setLabel(CostantiControlStation.LABEL_AGGIORNAMENTO_DOCUMENTO_SICUREZZA_XACML_POLICY);
  6363.                         de.setLabelStyleClass("noBold");
  6364.                         dati.add(de);
  6365.                     }
  6366.                     dati.add(allegatoXacmlPolicy.getFileDataElement(filePolicyLabel, "", getSize()));
  6367.                     dati.addAll(allegatoXacmlPolicy.getFileNameDataElement());
  6368.                     dati.add(allegatoXacmlPolicy.getFileIdDataElement());
  6369.                 }
  6370.                
  6371.                 if(autorizzazione_ruoli){
  6372.                     String[] tipoRole = { RuoloTipoMatch.ALL.getValue(),
  6373.                             RuoloTipoMatch.ANY.getValue() };
  6374.                     String[] labelRole = { CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH_ALL, CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH_ANY };
  6375.                     de = new DataElement();
  6376.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH);
  6377.                     de.setName(CostantiControlStation.PARAMETRO_RUOLO_MATCH);
  6378.                     de.setValue(autorizzazioneRuoliMatch);          
  6379.                     if(allHidden) {
  6380.                         de.setType(DataElementType.HIDDEN);
  6381.                     }
  6382.                     else {
  6383.                         de.setType(DataElementType.SELECT);
  6384.                         de.setValues(tipoRole);
  6385.                         de.setLabels(labelRole);
  6386.                         de.setSelected(autorizzazioneRuoliMatch);
  6387.                     }
  6388.                     dati.add(de);
  6389.                 }
  6390.                
  6391.                 if(TipoOperazione.CHANGE.equals(tipoOperazione)){
  6392.                     if(urlAutorizzazioneRuoli!=null && autorizzazione_ruoli && (old_autorizzazione_ruoli || CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM.equals(old_autorizzazione)) ){
  6393.                        
  6394.                         de = new DataElement();
  6395.                         de.setType(DataElementType.LINK);
  6396.                         de.setUrl(urlAutorizzazioneRuoli);
  6397.                         if (contaListe) {
  6398.                             ServletUtils.setDataElementCustomLabel(de,RuoliCostanti.LABEL_RUOLI,Long.valueOf(numRuoli));
  6399.                         } else
  6400.                             ServletUtils.setDataElementCustomLabel(de,RuoliCostanti.LABEL_RUOLI);
  6401.                         dati.add(de);
  6402.                                    
  6403.                     }
  6404.                 }
  6405.                 else{
  6406.                     if(!allHidden) {
  6407.                         if( (AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_FRUITORI_ADD.equals(servletChiamante) ||
  6408.                                 AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante))
  6409.                                 && autorizzazione_ruoli){
  6410.                             FiltroRicercaRuoli filtroRuoli = new FiltroRicercaRuoli();
  6411.                             if(isPortaDelegata){
  6412.                                 filtroRuoli.setContesto(RuoloContesto.PORTA_DELEGATA);
  6413.                             }
  6414.                             else{
  6415.                                 filtroRuoli.setContesto(RuoloContesto.PORTA_APPLICATIVA);
  6416.                             }
  6417.                             filtroRuoli.setTipologia(RuoloTipologia.QUALSIASI);
  6418.                             if(RuoloTipologia.INTERNO.equals(autorizzazioneRuoliTipologia) ){
  6419.                                 filtroRuoli.setTipologia(RuoloTipologia.INTERNO);
  6420.                             }
  6421.                             else if(RuoloTipologia.ESTERNO.equals(autorizzazioneRuoliTipologia) ){
  6422.                                 filtroRuoli.setTipologia(RuoloTipologia.ESTERNO);
  6423.                             }
  6424.                             try {
  6425.                                 this.addRuoliToDati(tipoOperazione, dati, false, filtroRuoli, ruolo, null, true, false,
  6426.                                         AccordiServizioParteSpecificaCostanti.LABEL_PARAMETRO_APS_RUOLO, addTitoloSezione, null, false);
  6427.                             }catch(Exception e) {
  6428.                                 throw new DriverControlStationException(e.getMessage(),e);
  6429.                             }
  6430.                         }
  6431.                     }
  6432.                 }
  6433.                
  6434.             }
  6435.                    
  6436.            
  6437.            
  6438.             boolean labelAutorizzazioneTokenAttuata = false;
  6439.            
  6440.             // ** Token **
  6441.             if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)==false){
  6442.            
  6443.                 // ** Token Richiedente **
  6444.                 if( (tokenAbilitato || modiSicurezzaMessaggio) && !AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)) {
  6445.                    
  6446.                     boolean autorizzazione_autenticazione_token =  false;
  6447.                                                
  6448.                     if(!allHidden && !labelAutorizzazioneTokenAttuata) {
  6449.                         de = new DataElement();
  6450.                         de.setType(DataElementType.SUBTITLE);
  6451.                        
  6452.                         String labelToken = CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN;
  6453.                         if(profiloModi && !isPortaDelegata) {
  6454.                             labelToken = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO;
  6455.                         }
  6456.                        
  6457.                         de.setLabel(labelToken);
  6458.                         labelAutorizzazioneTokenAttuata=true;
  6459.                         dati.add(de);
  6460.                     }
  6461.                    
  6462.                     autorizzazione_autenticazione_token = ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticatiToken);
  6463.                    
  6464.                     if(modiSicurezzaMessaggio) {
  6465.                         // backward compatibility
  6466.                         if(!old_autorizzazione_token_autenticazione && !autorizzazione_autenticazione_token && numErogazioneApplicativiAutenticati>0) {
  6467.                             autorizzazione_autenticazione_token=true;
  6468.                         }
  6469.                     }
  6470.                    
  6471.                     de = new DataElement();
  6472.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RICHIEDENTE);
  6473.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_AUTENTICAZIONE_TOKEN);
  6474.                     if(allHidden) {
  6475.                         de.setType(DataElementType.HIDDEN);
  6476.                         de.setValue(autorizzazione_autenticazione_token+"");
  6477.                     }
  6478.                     else {
  6479.                         de.setType(DataElementType.CHECKBOX);
  6480.                         de.setSelected(autorizzazione_autenticazione_token);
  6481.                         de.setPostBack(true);
  6482.                     }
  6483.                     dati.add(de);
  6484.                    
  6485.                                    
  6486.                     if(TipoOperazione.CHANGE.equals(tipoOperazione)){

  6487.                         if((urlAutorizzazioneAutenticatiToken!=null && autorizzazione_autenticazione_token && old_autorizzazione_token_autenticazione) ||
  6488.                                 (modiSicurezzaMessaggio && (numErogazioneApplicativiAutenticati>0))){
  6489.                             de = new DataElement();
  6490.                             de.setType(DataElementType.LINK);
  6491.                             if(!isPortaDelegata && profiloModi) {
  6492.                                 de.setUrl(urlAutorizzazioneErogazioneApplicativiAutenticati,
  6493.                                         new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, modiSicurezzaMessaggio+""),
  6494.                                         new Parameter(CostantiControlStation.PARAMETRO_TOKEN_AUTHORIZATION, tokenAbilitato+""));
  6495.                             }
  6496.                             else {
  6497.                                 de.setUrl(urlAutorizzazioneAutenticatiToken);
  6498.                             }
  6499.                             String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI;
  6500.                             if(!this.isModalitaCompleta()) {
  6501.                                 labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;
  6502.                             }
  6503.                             if (contaListe) {
  6504.                                 if(!isPortaDelegata && profiloModi) {
  6505.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numErogazioneApplicativiAutenticati));
  6506.                                 }
  6507.                                 else {
  6508.                                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numAutenticatiToken));
  6509.                                 }
  6510.                             } else {
  6511.                                 ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  6512.                             }
  6513.                             dati.add(de);
  6514.                         }
  6515.                        
  6516.                     }

  6517.                 }
  6518.                
  6519.                 // ** Token Ruoli **
  6520.                 if((tokenAbilitato || modiSicurezzaMessaggio) && !AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)) {
  6521.                    
  6522.                     boolean autorizzazione_ruoli_token = false;
  6523.                        
  6524.                     if(!allHidden && !labelAutorizzazioneTokenAttuata) {
  6525.                         de = new DataElement();
  6526.                         de.setType(DataElementType.SUBTITLE);
  6527.                        
  6528.                         String labelToken = CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN;
  6529.                         if(profiloModi && !isPortaDelegata) {
  6530.                             labelToken = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO;
  6531.                         }
  6532.                        
  6533.                         de.setLabel(labelToken);
  6534.                         dati.add(de);
  6535.                     }
  6536.                
  6537.                     autorizzazione_ruoli_token = ServletUtils.isCheckBoxEnabled(autorizzazioneRuoliToken);
  6538.                    
  6539.                     de = new DataElement();
  6540.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RUOLI);
  6541.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_TOKEN);
  6542.                     if(allHidden) {
  6543.                         de.setType(DataElementType.HIDDEN);
  6544.                         de.setValue(autorizzazione_ruoli_token+"");
  6545.                     }
  6546.                     else {
  6547.                         de.setType(DataElementType.CHECKBOX);
  6548.                         de.setSelected(autorizzazione_ruoli_token);
  6549.                         de.setPostBack(true);
  6550.                     }
  6551.                     dati.add(de);
  6552.                    
  6553.                            
  6554.                     if(autorizzazione_ruoli_token){
  6555.                        
  6556.                         de = new DataElement();
  6557.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO_TIPOLOGIA);
  6558.                         de.setName(CostantiControlStation.PARAMETRO_RUOLO_TIPOLOGIA_TOKEN);
  6559.                         de.setValue(autorizzazioneRuoliTipologiaToken);    
  6560.                         if(allHidden) {
  6561.                             de.setType(DataElementType.HIDDEN);
  6562.                         }
  6563.                         else {
  6564.                             de.setType(DataElementType.SELECT);
  6565.                             de.setValues(RuoliCostanti.getRuoliTipologia());
  6566.                             de.setLabels(RuoliCostanti.getRuoliTipologiaLabel());
  6567.                             de.setSelected(autorizzazioneRuoliTipologiaToken);
  6568.                             if(AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_FRUITORI_ADD.equals(servletChiamante) ||
  6569.                                     AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante)){
  6570.                                 de.setPostBack(true);
  6571.                             }
  6572.                         }
  6573.                         dati.add(de);
  6574.                        
  6575.                     }
  6576.                    
  6577.                     if(autorizzazione_ruoli_token){
  6578.                         String[] tipoRole = { RuoloTipoMatch.ALL.getValue(),
  6579.                                 RuoloTipoMatch.ANY.getValue() };
  6580.                         String[] labelRole = { CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH_ALL, CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH_ANY };
  6581.                         de = new DataElement();
  6582.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RUOLO_MATCH);
  6583.                         de.setName(CostantiControlStation.PARAMETRO_RUOLO_MATCH_TOKEN);
  6584.                         de.setValue(autorizzazioneRuoliMatchToken);        
  6585.                         if(allHidden) {
  6586.                             de.setType(DataElementType.HIDDEN);
  6587.                         }
  6588.                         else {
  6589.                             de.setType(DataElementType.SELECT);
  6590.                             de.setValues(tipoRole);
  6591.                             de.setLabels(labelRole);
  6592.                             de.setSelected(autorizzazioneRuoliMatchToken);
  6593.                         }
  6594.                         dati.add(de);
  6595.                     }
  6596.                    
  6597.                     if(TipoOperazione.CHANGE.equals(tipoOperazione)){
  6598.                         if(urlAutorizzazioneRuoliToken!=null && autorizzazione_ruoli_token && old_autorizzazione_token_ruoli ){
  6599.                            
  6600.                             de = new DataElement();
  6601.                             de.setType(DataElementType.LINK);
  6602.                             if(!isPortaDelegata && profiloModi) {
  6603.                                 de.setUrl(urlAutorizzazioneRuoliToken,
  6604.                                         new Parameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_MODIPA, modiSicurezzaMessaggio+""));
  6605.                             }
  6606.                             else {
  6607.                                 de.setUrl(urlAutorizzazioneRuoliToken);
  6608.                             }
  6609.                             if (contaListe) {
  6610.                                 ServletUtils.setDataElementCustomLabel(de,RuoliCostanti.LABEL_RUOLI,Long.valueOf(numRuoliToken));
  6611.                             } else
  6612.                                 ServletUtils.setDataElementCustomLabel(de,RuoliCostanti.LABEL_RUOLI);
  6613.                             dati.add(de);
  6614.                                        
  6615.                         }
  6616.                     }
  6617.                    
  6618.                 }
  6619.                
  6620.                
  6621.                
  6622.                 // ** Token Claims **
  6623.                
  6624.                 if(tokenAbilitato && !AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)) {
  6625.                    
  6626.                     if(!allHidden) {
  6627.                         de = new DataElement();
  6628.                         de.setType(DataElementType.SUBTITLE);
  6629.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_CLAIMS_SUBTITLE);
  6630.                         dati.add(de);
  6631.                     }

  6632.                     boolean autorizzazioneTokenEnabled = ServletUtils.isCheckBoxEnabled(autorizzazione_token);
  6633.                    
  6634.                     de = new DataElement();
  6635.                     de.setLabel(CostantiControlStation.LABEL_ABILITATO);
  6636.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN);
  6637.                     if(allHidden) {
  6638.                         de.setType(DataElementType.HIDDEN);
  6639.                         de.setValue(autorizzazioneTokenEnabled+"");
  6640.                     }
  6641.                     else {
  6642.                         de.setType(DataElementType.CHECKBOX);
  6643.                         de.setSelected(autorizzazioneTokenEnabled);
  6644.                         de.setPostBack(true);
  6645.                     }
  6646.                     dati.add(de);
  6647.                    
  6648.                     if(autorizzazioneTokenEnabled) {
  6649.                         de = new DataElement();
  6650.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_CLAIMS);
  6651.                         de.setNote(DynamicHelperCostanti.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_NOTE);
  6652.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_OPTIONS);
  6653.                         de.setValue(autorizzazione_tokenOptions);
  6654.                         if(allHidden) {
  6655.                             de.setType(DataElementType.HIDDEN);
  6656.                         }
  6657.                         else {
  6658.                             de.setType(DataElementType.TEXT_AREA);
  6659.                             de.setRows(6);
  6660.                             de.setCols(55);
  6661.                         }
  6662.                        
  6663.                         org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding = org.openspcoop2.core.registry.constants.ServiceBinding.REST;
  6664.                         if(idServizio!=null) {
  6665.                             try {
  6666.                                 AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
  6667.                                 AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  6668.                                 serviceBinding = aspc.getServiceBinding();
  6669.                             }catch(Exception e) {
  6670.                                 throw new DriverControlStationException(e.getMessage(),e);
  6671.                             }
  6672.                         }
  6673.                         int sizeAA = 0;
  6674.                         if(attributeAuthoritySelezionate!=null) {
  6675.                             sizeAA = attributeAuthoritySelezionate.length;
  6676.                         }
  6677.                        
  6678.                         DataElementInfo dInfoTokenClaims = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_CLAIMS);
  6679.                         if(sizeAA>1) {
  6680.                             dInfoTokenClaims.setHeaderBody(DynamicHelperCostanti.LABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN_CLAIMS_MULTI_ATTRIBUTE_AUTHORITY);
  6681.                         }
  6682.                         else if(sizeAA==1) {
  6683.                             dInfoTokenClaims.setHeaderBody(DynamicHelperCostanti.LABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN_CLAIMS_SINGLE_ATTRIBUTE_AUTHORITY);
  6684.                         }
  6685.                         else {
  6686.                             dInfoTokenClaims.setHeaderBody(DynamicHelperCostanti.LABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN_CLAIMS_NO_ATTRIBUTE_AUTHORITY);
  6687.                         }
  6688.                         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  6689.                             dInfoTokenClaims.setListBody(DynamicHelperCostanti.getLABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN_CLAIMS_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata));
  6690.                         }
  6691.                         else {
  6692.                             dInfoTokenClaims.setListBody(DynamicHelperCostanti.getLABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN_CLAIMS_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata));
  6693.                         }
  6694.                         de.setInfo(dInfoTokenClaims);
  6695.                        
  6696.                         dati.add(de);
  6697.                     }
  6698.                 }
  6699.                
  6700.                
  6701.                 boolean autorizzazione_scope = false;
  6702.            
  6703.                 if(AutorizzazioneUtilities.STATO_ABILITATO.equals(autorizzazione) && tokenAbilitato){
  6704.                    
  6705.                     // ** Scope **
  6706.                    
  6707.                     if(!allHidden) {
  6708.                         de = new DataElement();
  6709.                         de.setType(DataElementType.SUBTITLE);
  6710.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SCOPE);
  6711.                         dati.add(de);
  6712.                     }
  6713.                
  6714.                     autorizzazione_scope = ServletUtils.isCheckBoxEnabled(autorizzazioneScope);
  6715.                    
  6716.                     de = new DataElement();
  6717.                     de.setLabel(CostantiControlStation.LABEL_ABILITATO);
  6718.                     de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_SCOPE);
  6719.                     if(allHidden) {
  6720.                         de.setType(DataElementType.HIDDEN);
  6721.                         de.setValue(autorizzazione_scope+"");
  6722.                     }
  6723.                     else {
  6724.                         de.setType(DataElementType.CHECKBOX);
  6725.                         de.setSelected(autorizzazione_scope);
  6726.                         de.setPostBack(true);
  6727.                     }
  6728.                     dati.add(de);
  6729.                
  6730.                     if(autorizzazione_scope){
  6731.                         String[] tipoScope = { ScopeTipoMatch.ALL.getValue(),   ScopeTipoMatch.ANY.getValue() };
  6732.                         String[] labelScope = { CostantiControlStation.LABEL_PARAMETRO_SCOPE_MATCH_ALL, CostantiControlStation.LABEL_PARAMETRO_SCOPE_MATCH_ANY };
  6733.                         de = new DataElement();
  6734.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SCOPE_MATCH);
  6735.                         de.setName(CostantiControlStation.PARAMETRO_SCOPE_MATCH);
  6736.                         if(allHidden) {
  6737.                             de.setType(DataElementType.HIDDEN);
  6738.                             de.setValue(autorizzazioneScopeMatch+"");
  6739.                         }
  6740.                         else {
  6741.                             de.setType(DataElementType.SELECT);
  6742.                             de.setValues(tipoScope);
  6743.                             de.setLabels(labelScope);
  6744.                             de.setSelected(autorizzazioneScopeMatch);
  6745.                         }
  6746.                         dati.add(de);
  6747.                     }
  6748.                    
  6749.                     if(TipoOperazione.CHANGE.equals(tipoOperazione)){
  6750.                         if(urlAutorizzazioneScope!=null && autorizzazione_scope && old_autorizzazione_scope){
  6751.                            
  6752.                             de = new DataElement();
  6753.                             de.setType(DataElementType.LINK);
  6754.                             de.setUrl(urlAutorizzazioneScope);
  6755.                             if (contaListe) {
  6756.                                 ServletUtils.setDataElementCustomLabel(de,ScopeCostanti.LABEL_SCOPE,Long.valueOf(numScope));
  6757.                             } else
  6758.                                 ServletUtils.setDataElementCustomLabel(de,ScopeCostanti.LABEL_SCOPE);
  6759.                             dati.add(de);
  6760.                                        
  6761.                         }
  6762.                     }
  6763.                     else{
  6764.                         if(!allHidden) {
  6765.                             if( (AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_FRUITORI_ADD.equals(servletChiamante) ||
  6766.                                     AccordiServizioParteSpecificaCostanti.SERVLET_NAME_APS_ADD.equals(servletChiamante))
  6767.                                     && autorizzazione_scope){
  6768.                                 FiltroRicercaScope filtroScope = new FiltroRicercaScope();
  6769.                                 if(isPortaDelegata){
  6770.                                     filtroScope.setContesto(ScopeContesto.PORTA_DELEGATA);
  6771.                                 }
  6772.                                 else{
  6773.                                     filtroScope.setContesto(ScopeContesto.PORTA_APPLICATIVA);
  6774.                                 }

  6775.                                 try {
  6776.                                     this.addScopeToDati(tipoOperazione, dati, false, filtroScope, scope, null, true, false,
  6777.                                         AccordiServizioParteSpecificaCostanti.LABEL_PARAMETRO_APS_SCOPE, addTitoloSezione);
  6778.                                 }catch(Exception e) {
  6779.                                     throw new DriverControlStationException(e.getMessage(),e);
  6780.                                 }
  6781.                             }
  6782.                         }
  6783.                     }
  6784.                    
  6785.                 }
  6786.                
  6787.             }
  6788.            
  6789.             if(addTitle) {
  6790.                 this.impostaAperturaTitle(dati, CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TITLE);
  6791.             }
  6792.            
  6793.         } else {
  6794.             DataElement de = new DataElement();
  6795.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE);
  6796.             de.setType(DataElementType.HIDDEN);
  6797.             de.setName(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE);
  6798.             de.setValue(AutorizzazioneUtilities.STATO_DISABILITATO);
  6799.             dati.add(de);
  6800.         }
  6801.        
  6802.     }
  6803.    
  6804.     public void controlloAccessiAutorizzazioneContenuti(List<DataElement> dati, TipoOperazione tipoOperazione, boolean isPortaDelegata, Object oggetto, String protocolloParam,
  6805.             String autorizzazioneContenutiStato, String autorizzazioneContenuti, String autorizzazioneContenutiProperties, ServiceBinding serviceBinding,
  6806.             boolean old_autorizzazione_contenuti_custom, String urlAutorizzazioneContenutiCustomPropertiesList, int numAutorizzazioneContenutiCustomPropertiesList,
  6807.             boolean confPers) throws DriverControlStationException{
  6808.        
  6809.         String protocollo = protocolloParam;
  6810.         if((protocollo==null || "".equals(protocollo)) && oggetto!=null){
  6811.             if(isPortaDelegata){
  6812.                 PortaDelegata pd = (PortaDelegata) oggetto;
  6813.                 if(pd!=null && pd.getServizio()!=null && pd.getServizio().getTipo()!=null) {
  6814.                     try {
  6815.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pd.getServizio().getTipo());
  6816.                     }catch(Exception e) {
  6817.                         throw new DriverControlStationException(e.getMessage(),e);
  6818.                     }
  6819.                 }
  6820.             }
  6821.             else {
  6822.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  6823.                 if(pa!=null && pa.getServizio()!=null && pa.getServizio().getTipo()!=null) {
  6824.                     try {
  6825.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pa.getServizio().getTipo());
  6826.                     }catch(Exception e) {
  6827.                         throw new DriverControlStationException(e.getMessage(),e);
  6828.                     }
  6829.                 }
  6830.             }
  6831.         }
  6832.        
  6833.         DataElement de = new DataElement();
  6834.         de.setType(DataElementType.TITLE);
  6835.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI);
  6836.         de.setName(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO_TITLE);
  6837.         de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.CHIUSO);
  6838.         dati.add(de);
  6839.        
  6840.         List<String> authContenutiLabels = new ArrayList<>();
  6841.         List<String> authContenutiValues = new ArrayList<>();
  6842.        
  6843.         authContenutiLabels.addAll(Arrays.asList(CostantiControlStation.PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_LABELS));
  6844.         authContenutiValues.addAll(Arrays.asList(CostantiControlStation.PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_VALUES));
  6845.        
  6846.         if(confPers || autorizzazioneContenutiStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_CUSTOM)) {
  6847.             authContenutiLabels.add(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_CUSTOM);
  6848.             authContenutiValues.add(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_CUSTOM);
  6849.         }
  6850.        
  6851.         de = new DataElement();
  6852.         de.setType(DataElementType.SELECT);
  6853.         de.setSelected(autorizzazioneContenutiStato);
  6854.         de.setValues(authContenutiValues);
  6855.         de.setLabels(authContenutiLabels);
  6856.         de.setName(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO);
  6857.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO);
  6858.         de.setPostBack(true);
  6859.         de.setValoreDefaultSelect(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_DISABILITATO);
  6860.         dati.add(de);
  6861.        
  6862.         if(!autorizzazioneContenutiStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_DISABILITATO)) {
  6863.             // abilitato
  6864.             if(autorizzazioneContenutiStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_ABILITATO)) {
  6865.                 de = new DataElement();
  6866.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  6867.                 de.setType(DataElementType.HIDDEN);
  6868.                 de.setName(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  6869.                 de.setValue(autorizzazioneContenuti);
  6870.                 dati.add(de);
  6871.                
  6872.                
  6873.                 de = new DataElement();
  6874.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  6875.                 de.setType(DataElementType.TEXT_AREA);
  6876.                 de.setName(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_PROPERTIES);
  6877.                 de.setValue(autorizzazioneContenutiProperties);
  6878.                 de.setNote(DynamicHelperCostanti.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CONTENUTI_NOTE);
  6879.                 DataElementInfo info = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI);
  6880.                 info.setHeaderBody(DynamicHelperCostanti.LABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI);
  6881.                 if(ServiceBinding.REST.equals(serviceBinding)) {
  6882.                     info.setListBody(DynamicHelperCostanti.getLABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata));
  6883.                 }
  6884.                 else {
  6885.                     info.setListBody(DynamicHelperCostanti.getLABEL_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata));
  6886.                 }
  6887.                 de.setValoreDefault("");
  6888.                 de.setInfo(info );
  6889.                 dati.add(de);
  6890.             }
  6891.            
  6892.             // custom
  6893.             if(autorizzazioneContenutiStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_CUSTOM)) {
  6894.                
  6895.                 String tipoAutorizzazioneCustom = isPortaDelegata ? Filtri.FILTRO_RUOLO_VALORE_FRUIZIONE : Filtri.FILTRO_RUOLO_VALORE_EROGAZIONE;
  6896.                 boolean autorizzazioneCustomHidden = false;
  6897.                 this.addCustomField(TipoPlugin.AUTORIZZAZIONE_CONTENUTI,
  6898.                         tipoAutorizzazioneCustom,
  6899.                         null,
  6900.                         CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO,
  6901.                         CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI,
  6902.                         CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM,
  6903.                         autorizzazioneContenuti, autorizzazioneCustomHidden, dati,
  6904.                         false);
  6905.                
  6906. //              de = new DataElement();
  6907. //              de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  6908. //              de.setType(DataElementType.TEXT_EDIT);
  6909. //              de.setName(CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI);
  6910. //              de.setValue(autorizzazioneContenuti);
  6911. //              de.setRequired(true);
  6912. //              dati.add(de);
  6913.                
  6914.                 // link proprieta
  6915.                 if(old_autorizzazione_contenuti_custom) {
  6916.                     Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
  6917.                     de = new DataElement();
  6918.                     de.setType(DataElementType.LINK);
  6919.                     de.setUrl(urlAutorizzazioneContenutiCustomPropertiesList);
  6920.                     String labelCustomProperties = CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CONTENUTI_CUSTOM_PROPERTIES;
  6921.                     if (contaListe) {
  6922.                         ServletUtils.setDataElementCustomLabel(de,labelCustomProperties,Long.valueOf(numAutorizzazioneContenutiCustomPropertiesList));
  6923.                     } else {
  6924.                         ServletUtils.setDataElementCustomLabel(de,labelCustomProperties);
  6925.                     }
  6926.                     dati.add(de);
  6927.                 }
  6928.             }
  6929.         }
  6930.        
  6931.         this.impostaAperturaTitle(dati, CostantiControlStation.PARAMETRO_AUTORIZZAZIONE_CONTENUTI_STATO_TITLE);
  6932.     }
  6933.    
  6934.     public boolean controlloAccessiCheck(TipoOperazione tipoOperazione,
  6935.             String autenticazione, String autenticazioneOpzionale, TipoAutenticazionePrincipal autenticazionePrincipal, List<String> autenticazioneParametroList,
  6936.             String autorizzazione, String autorizzazioneAutenticati, String autorizzazioneRuoli,  
  6937.             String autorizzazioneRuoliTipologia, String autorizzazioneRuoliMatch,
  6938.             boolean isSupportatoAutenticazione, boolean isPortaDelegata, Object oggetto,
  6939.             List<String> ruoli,String gestioneToken,
  6940.             String policy, String validazioneInput, String introspection, String userInfo, String forward,
  6941.             String autorizzazioneAutenticatiToken, String autorizzazioneRuoliToken,
  6942.             String autorizzazione_token, String autorizzazione_tokenOptions,
  6943.             String autorizzazioneScope, String autorizzazioneScopeMatch, BinaryParameter allegatoXacmlPolicy,
  6944.             String autorizzazioneContenutiStato, String autorizzazioneContenuto, String autorizzazioneContenutiProperties,
  6945.             String protocollo,
  6946.             String identificazioneAttributiStato, String [] attributeAuthoritySelezionate, String attributeAuthorityAttributi) throws DriverControlStationException{
  6947.         try {
  6948.            
  6949.             if(TipoAutenticazione.PRINCIPAL.equals(autenticazione) &&  autenticazionePrincipal!=null) {
  6950.                 switch (autenticazionePrincipal) {
  6951.                 case CONTAINER:
  6952.                 case INDIRIZZO_IP:
  6953.                 case INDIRIZZO_IP_X_FORWARDED_FOR:
  6954.                     break;
  6955.                 case HEADER:
  6956.                     if(autenticazioneParametroList==null || autenticazioneParametroList.isEmpty() || StringUtils.isEmpty(autenticazioneParametroList.get(0))){
  6957.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_HEADER));
  6958.                         return false;
  6959.                     }
  6960.                     break;
  6961.                 case FORM:
  6962.                     if(autenticazioneParametroList==null || autenticazioneParametroList.isEmpty() || StringUtils.isEmpty(autenticazioneParametroList.get(0))){
  6963.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_FORM));
  6964.                         return false;
  6965.                     }
  6966.                     break;
  6967.                 case URL:
  6968.                     if(autenticazioneParametroList==null || autenticazioneParametroList.isEmpty() || StringUtils.isEmpty(autenticazioneParametroList.get(0))){
  6969.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_ESPRESSIONE));
  6970.                         return false;
  6971.                     }
  6972.                    
  6973.                     if(this.checkRegexp(autenticazioneParametroList.get(0),ModalitaIdentificazione.URL_BASED.getLabelParametro())==false){
  6974.                         return false;
  6975.                     }
  6976.                    
  6977.                     break;
  6978.                 case TOKEN:
  6979.                     if(autenticazioneParametroList==null || autenticazioneParametroList.isEmpty() || StringUtils.isEmpty(autenticazioneParametroList.get(0))){
  6980.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TOKEN_CLAIM));
  6981.                         return false;
  6982.                     }
  6983.                     String tipo = autenticazioneParametroList.get(0);
  6984.                     if(ParametriAutenticazionePrincipal.TOKEN_CLAIM_CUSTOM.equals(tipo)) {
  6985.                         if(autenticazioneParametroList.size()<=1 || StringUtils.isEmpty(autenticazioneParametroList.get(1))){
  6986.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  6987.                                     CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_PRINCIPAL_TOKEN_CLAIM_PERSONALIZZATO_ESTESO));
  6988.                             return false;
  6989.                         }
  6990.                     }
  6991.                     break;
  6992.                 }
  6993.             }
  6994.            
  6995.             if(TipoAutenticazione.APIKEY.equals(autenticazione)) {
  6996.                 if(autenticazioneParametroList==null || autenticazioneParametroList.isEmpty()){
  6997.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  6998.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_POSIZIONE));
  6999.                     return false;
  7000.                 }
  7001.                
  7002.                 ApiKeyState apiKeyState = new ApiKeyState(autenticazioneParametroList);
  7003.                 if(!apiKeyState.queryParameterEnabled && !apiKeyState.headerEnabled && !apiKeyState.cookieEnabled) {
  7004.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7005.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_APIKEY_POSIZIONE));
  7006.                     return false;
  7007.                 }
  7008.                
  7009.                 if(!apiKeyState.useOAS3NamesSelected) {
  7010.                     if(apiKeyState.queryParameterEnabled) {
  7011.                         if(apiKeyState.queryParameterApiKey==null || "".equals(apiKeyState.queryParameterApiKey)) {
  7012.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7013.                                     ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY+" - "+ModalitaIdentificazione.FORM_BASED.getLabel()));
  7014.                             return false;
  7015.                         }
  7016.                     }
  7017.                     if(apiKeyState.headerEnabled) {
  7018.                         if(apiKeyState.headerApiKey==null || "".equals(apiKeyState.headerApiKey)) {
  7019.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7020.                                     ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY+" - "+ModalitaIdentificazione.HEADER_BASED.getLabel()));
  7021.                             return false;
  7022.                         }
  7023.                     }
  7024.                     if(apiKeyState.cookieEnabled) {
  7025.                         if(apiKeyState.cookieApiKey==null || "".equals(apiKeyState.cookieApiKey)) {
  7026.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7027.                                     ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY+" - "+ModalitaIdentificazione.COOKIE_BASED.getLabel()));
  7028.                             return false;
  7029.                         }
  7030.                     }
  7031.                    
  7032.                     if(apiKeyState.appIdSelected) {
  7033.                         if(apiKeyState.queryParameterEnabled) {
  7034.                             if(apiKeyState.queryParameterAppId==null || "".equals(apiKeyState.queryParameterAppId)) {
  7035.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7036.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+" - "+ModalitaIdentificazione.FORM_BASED.getLabel()));
  7037.                                 return false;
  7038.                             }
  7039.                             if(apiKeyState.queryParameterAppId.equalsIgnoreCase(apiKeyState.queryParameterApiKey)) {
  7040.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_CAMPI_DIFFERENTI,  
  7041.                                         "'"+ModalitaIdentificazione.FORM_BASED.getLabel()+"' tra "+ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY,
  7042.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID));
  7043.                                 return false;
  7044.                             }
  7045.                         }
  7046.                         if(apiKeyState.headerEnabled) {
  7047.                             if(apiKeyState.headerAppId==null || "".equals(apiKeyState.headerAppId)) {
  7048.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7049.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+" - "+ModalitaIdentificazione.HEADER_BASED.getLabel()));
  7050.                                 return false;
  7051.                             }
  7052.                             if(apiKeyState.headerAppId.equalsIgnoreCase(apiKeyState.headerApiKey)) {
  7053.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_CAMPI_DIFFERENTI,  
  7054.                                         "'"+ModalitaIdentificazione.HEADER_BASED.getLabel()+"' tra "+ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY,
  7055.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID));
  7056.                                 return false;
  7057.                             }
  7058.                         }
  7059.                         if(apiKeyState.cookieEnabled) {
  7060.                             if(apiKeyState.cookieAppId==null || "".equals(apiKeyState.cookieAppId)) {
  7061.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7062.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+" - "+ModalitaIdentificazione.COOKIE_BASED.getLabel()));
  7063.                                 return false;
  7064.                             }
  7065.                             if(apiKeyState.cookieAppId.equalsIgnoreCase(apiKeyState.cookieApiKey)) {
  7066.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_CAMPI_DIFFERENTI,  
  7067.                                         "'"+ModalitaIdentificazione.COOKIE_BASED.getLabel()+"' tra "+ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY,
  7068.                                         ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID));
  7069.                                 return false;
  7070.                             }
  7071.                         }
  7072.                     }
  7073.                 }
  7074.             }
  7075.            
  7076.             // tipo autenticazione custom
  7077.             String autenticazioneCustom = null;
  7078.             if(autenticazione != null && autenticazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM)) {
  7079.                 autenticazioneCustom = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM );
  7080.                
  7081.                 if(StringUtils.isEmpty(autenticazioneCustom) || CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(autenticazioneCustom)){
  7082.                     if(this.confCore.isConfigurazionePluginsEnabled()) {
  7083.                         this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTENTICAZIONE_CUSTOM_NON_INDICATA);
  7084.                     }
  7085.                     else {
  7086.                         this.pd.setMessage(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM+" obbligatorio per il tipo di autenticazione selezionato");
  7087.                     }
  7088.                     return false;
  7089.                 }
  7090.                
  7091.                 if(this.checkLength255(autenticazioneCustom, CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_CUSTOM)==false) {
  7092.                     return false;
  7093.                 }
  7094.             }
  7095.            
  7096.             // check token
  7097.             if(AutorizzazioneUtilities.STATO_ABILITATO.equals(gestioneToken)){
  7098.                
  7099.                 if(StringUtils.isEmpty(policy) || policy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)){
  7100.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_POLICY));
  7101.                     return false;
  7102.                 }
  7103.                
  7104.                 boolean validazioneInputB = !validazioneInput.equals(StatoFunzionalitaConWarning.DISABILITATO.getValue());
  7105.                 boolean introspectionB = !introspection.equals(StatoFunzionalitaConWarning.DISABILITATO.getValue());
  7106.                 boolean userInfoB = !userInfo.equals(StatoFunzionalitaConWarning.DISABILITATO.getValue());
  7107.                 boolean forwardB = !forward.equals(StatoFunzionalita.DISABILITATO.getValue());
  7108.                
  7109.                 if(!validazioneInputB && !introspectionB && !userInfoB && !forwardB) {
  7110.                     StringBuilder sb = new StringBuilder();
  7111.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_VALIDAZIONE_INPUT).append(", ");
  7112.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_INTROSPECTION).append(", ");
  7113.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_USERINFO).append(" o ");
  7114.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_GESTIONE_TOKEN_TOKEN_FORWARD);
  7115.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_POLICY_TOKEN_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_UNA_MODALITA, sb.toString()));
  7116.                     return false;
  7117.                 }
  7118.                
  7119.             }
  7120.            
  7121.             // check attribute authority
  7122.             if(AutorizzazioneUtilities.STATO_ABILITATO.equals(identificazioneAttributiStato)){
  7123.                 if(attributeAuthoritySelezionate==null || attributeAuthoritySelezionate.length<=0) {
  7124.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,  
  7125.                             CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY));
  7126.                     return false;
  7127.                 }
  7128.                 if (!checkAttributes(attributeAuthoritySelezionate, attributeAuthorityAttributi)) {
  7129.                     return false;
  7130.                 }
  7131.             }
  7132.            
  7133.             if(AutorizzazioneUtilities.STATO_ABILITATO.equals(autorizzazione)){
  7134.                
  7135.                 // autorizzazione abilitata
  7136.                
  7137.                 if(ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati)==false &&
  7138.                         ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli)==false &&
  7139.                         ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticatiToken)==false &&
  7140.                         ServletUtils.isCheckBoxEnabled(autorizzazioneRuoliToken)==false &&
  7141.                         ServletUtils.isCheckBoxEnabled(autorizzazioneScope)==false &&
  7142.                         (autorizzazione_tokenOptions==null || "".equals(autorizzazione_tokenOptions))){
  7143.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SELEZIONARE_ALMENO_UNA_MODALITÀ_DI_AUTORIZZAZIONE);
  7144.                     return false;
  7145.                 }
  7146.                
  7147.                 if(ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati) &&
  7148.                         ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli)==false){
  7149.                     // Se l'autorizzazione è solamente basata sull'autenticazione dei chiamanti, una autenticazione DEVE essere presente e non deve essere opzionale
  7150.                     if(isSupportatoAutenticazione){
  7151.                         if(isPortaDelegata || !this.soggettiCore.isSupportatoAutorizzazioneRichiedenteSenzaAutenticazioneErogazione(protocollo)) {
  7152.                            
  7153.                             boolean modipa = this.isProfiloModIPA(protocollo);
  7154.                             String label = CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TRASPORTO_SENZA_PREFIX;
  7155.                             if(modipa && !isPortaDelegata) {
  7156.                                 label = CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CANALE_SENZA_PREFIX;
  7157.                             }
  7158.                            
  7159.                             if(TipoAutenticazione.DISABILITATO.equals(autenticazione)){
  7160.                                 this.pd.setMessage(MessageFormat.format(
  7161.                                         CostantiControlStation.MESSAGGIO_ERRORE_CON_LA_SOLA_MODALITA_DI_AUTORIZZAZIONE_XX_DEVE_ESSERE_INDICATA_ANCHE_UNA_MODALITA_DI_AUTENTICAZIONE_YY,
  7162.                                         label));
  7163.                                 return false;
  7164.                             }
  7165.                             if(ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale)){
  7166.                                 this.pd.setMessage(MessageFormat.format(
  7167.                                         CostantiControlStation.MESSAGGIO_ERRORE_CON_LA_SOLA_MODALITA_DI_AUTORIZZAZIONE_XX_NON_E_POSSIBILE_ASSOCIATA_UNA_MODALITÀ_DI_AUTENTICAZIONE_OPZIONALE,
  7168.                                         label));
  7169.                                 return false;
  7170.                             }
  7171.                         }
  7172.                     }
  7173.                 }
  7174.                
  7175.                 if(ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati) &&
  7176.                         ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli)){
  7177.                     if(isSupportatoAutenticazione && ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale)==false){
  7178.                         // Rilasso questo vincolo alla solta autenticazione di tipo http-basic, poiche' nelle altre l'identificazione di un applicativo o soggetto non e' obbligatoria
  7179.                         // Inoltre serve solo se si seleziona una fonte esterna per i ruoli che quindi non richiede obbligatoriamente una autenticazione
  7180.                         RuoloTipologia ruoloTipologia = RuoloTipologia.toEnumConstant(autorizzazioneRuoliTipologia);
  7181.                         if(TipoAutenticazione.BASIC.equals(autenticazione) &&
  7182.                                 (ruoloTipologia==null || RuoloTipologia.QUALSIASI.equals(autorizzazioneRuoliTipologia)  || RuoloTipologia.ESTERNO.equals(autorizzazioneRuoliTipologia))){
  7183.                             this.pd.setMessage(MessageFormat.format(
  7184.                                     CostantiControlStation.MESSAGGIO_ERRORE_CON_UNA_MODALITA_DI_AUTENTICAZIONE_BASIC_OBBLIGATORIA_NON_E_POSSIBILE_SELEZIONARE_ENTRAMBE_LE_MODALITA_DI_AUTORIZZAZIONE,
  7185.                                     CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RICHIEDENTE, CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_PER_RUOLI_FONTE_ESTERNA_QUALSIASI));
  7186.                             return false;
  7187.                         }
  7188.                     }
  7189.                 }
  7190.                
  7191.                 if(ServletUtils.isCheckBoxEnabled(autorizzazione_token)) {
  7192.                     if(autorizzazione_tokenOptions==null || "".equals(autorizzazione_tokenOptions)) {
  7193.                         this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_TOKEN_OPTIONS_NON_INDICATI);
  7194.                         return false;
  7195.                     }
  7196.                 }
  7197.                 if(autorizzazione_tokenOptions!=null) {
  7198.                     Scanner scanner = new Scanner(autorizzazione_tokenOptions);
  7199.                     try {
  7200.                         while (scanner.hasNextLine()) {
  7201.                             String line = scanner.nextLine();
  7202.                             if(line==null || line.trim().equals("")) {
  7203.                                 continue;
  7204.                             }
  7205.                             line = line.trim();
  7206.                             if(line!=null && line.startsWith("#")) {
  7207.                                 continue;
  7208.                             }
  7209.                             if(line!=null && line.contains("=")==false) {
  7210.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_TOKEN);
  7211.                                 return false;
  7212.                             }
  7213.                         }
  7214.                     }finally {
  7215.                         scanner.close();
  7216.                     }
  7217.                    
  7218.                     if(this.checkLength(autorizzazione_tokenOptions, CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_OPTIONS,-1,4000)==false) {
  7219.                         return false;
  7220.                     }
  7221.                 }
  7222.             }
  7223.            
  7224.             if(AutorizzazioneUtilities.STATO_ABILITATO.equals(autorizzazione) ||
  7225.                     AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione) ){
  7226.                
  7227.                 if(AutorizzazioneUtilities.STATO_XACML_POLICY.equals(autorizzazione)){
  7228.                     if(ruoli!=null && ruoli.size()>0){
  7229.                         this.pd.setMessage(MessageFormat.format(
  7230.                                 CostantiControlStation.MESSAGGIO_ERRORE_LA_PORTA_CONTIENE_GIA_DEI_RUOLI_CHE_NON_SONO_COMPATIBILI_CON_LA_NUOVA_AUTORIZZAZIONE,
  7231.                                 AutorizzazioneUtilities.STATO_XACML_POLICY));
  7232.                         return false;
  7233.                     }
  7234.                    
  7235.                     // se questo parametro e' diverso da null vuol dire che ho aggiornato il valore dell'allegato e devo validare il contenuto
  7236.                     if(allegatoXacmlPolicy.getValue() != null) {
  7237.                         IProtocolFactory<?> pf = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  7238.                         Documento documento = new Documento();
  7239.                         documento.setFile("xacmlPolicy");
  7240.                         documento.setByteContenuto(allegatoXacmlPolicy.getValue());
  7241.                         documento.setTipo(TipiDocumentoSicurezza.XACML_POLICY.getNome());
  7242.                         documento.setRuolo(RuoliDocumento.specificaSicurezza.toString());
  7243.                         ValidazioneResult valida = pf.createValidazioneDocumenti().valida (documento);
  7244.                         if(!valida.isEsito()) {
  7245.                             this.pd.setMessage(valida.getMessaggioErrore());
  7246.                             return false;
  7247.                         }
  7248.                     } else {
  7249.                         if(oggetto!=null){
  7250.                             if(isPortaDelegata){
  7251.                                 PortaDelegata pd = (PortaDelegata) oggetto;
  7252.                                 if(StringUtils.isEmpty(pd.getXacmlPolicy())) {
  7253.                                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_POLICY_OBBLIGATORIA_CON_LA_NUOVA_AUTORIZZAZIONE, AutorizzazioneUtilities.STATO_XACML_POLICY));
  7254.                                     return false;
  7255.                                 }
  7256.                             }else {
  7257.                                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  7258.                                 if(StringUtils.isEmpty(pa.getXacmlPolicy())) {
  7259.                                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_POLICY_OBBLIGATORIA_CON_LA_NUOVA_AUTORIZZAZIONE, AutorizzazioneUtilities.STATO_XACML_POLICY));
  7260.                                     return false;
  7261.                                 }
  7262.                             }
  7263.                         }
  7264.                     }
  7265.                 }
  7266.                
  7267.                 RuoloTipologia ruoloTipologia = RuoloTipologia.toEnumConstant(autorizzazioneRuoliTipologia);
  7268.                 if(RuoloTipologia.INTERNO.equals(ruoloTipologia)){
  7269.                     if(isSupportatoAutenticazione && !AutorizzazioneUtilities.STATO_ABILITATO.equals(gestioneToken)){
  7270.                         if(TipoAutenticazione.DISABILITATO.equals(autenticazione)){
  7271.                             this.pd.setMessage(MessageFormat.format(
  7272.                                     CostantiControlStation.MESSAGGIO_ERRORE_CON_UNA_FONTE_PER_I_RUOLI_DI_TIPO_XX_DEVE_ESSERE_ASSOCIATA_UNA_MODALITÀ_DI_AUTENTICAZIONE,
  7273.                                     RuoliCostanti.LABEL_PARAMETRO_RUOLO_TIPOLOGIA.toLowerCase(), RuoliCostanti.RUOLI_TIPOLOGIA_LABEL_INTERNO));
  7274.                             return false;
  7275.                         }
  7276.                         if(ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale)){
  7277.                             this.pd.setMessage(MessageFormat.format(
  7278.                                     CostantiControlStation.MESSAGGIO_ERRORE_CON_UNA_FONTE_PER_I_RUOLI_DI_TIPO_XX_NON_E_POSSIBILE_ASSOCIATA_UNA_MODALITÀ_DI_AUTENTICAZIONE_OPZIONALE,
  7279.                                     RuoliCostanti.LABEL_PARAMETRO_RUOLO_TIPOLOGIA.toLowerCase(), RuoliCostanti.RUOLI_TIPOLOGIA_LABEL_INTERNO));
  7280.                             return false;
  7281.                         }
  7282.                     }
  7283.                 }
  7284.                
  7285.                 // check tipologia rispetto ai ruoli esistenti
  7286.                 List<String> ruoliNonCompatibili = new ArrayList<>();
  7287.                 if(ruoli!=null && ruoli.size()>0){
  7288.                     for (String ruolo : ruoli) {
  7289.                         Ruolo ruoloObject = this.ruoliCore.getRuolo(ruolo);
  7290.                         if(RuoloTipologia.INTERNO.equals(ruoloTipologia)){
  7291.                             if(RuoloTipologia.ESTERNO.equals(ruoloObject.getTipologia())){
  7292.                                 ruoliNonCompatibili.add(ruolo);
  7293.                             }
  7294.                         }
  7295.                         if(RuoloTipologia.ESTERNO.equals(ruoloTipologia)){
  7296.                             if(RuoloTipologia.INTERNO.equals(ruoloObject.getTipologia())){
  7297.                                 ruoliNonCompatibili.add(ruolo);
  7298.                             }
  7299.                         }
  7300.                     }
  7301.                 }
  7302.                 if(ruoliNonCompatibili.size()>0){
  7303.                     String label = "";
  7304.                     if(RuoloTipologia.INTERNO.equals(ruoloTipologia)){
  7305.                         label = RuoliCostanti.RUOLI_TIPOLOGIA_LABEL_INTERNO;
  7306.                     }
  7307.                     else{
  7308.                         label = RuoliCostanti.RUOLI_TIPOLOGIA_LABEL_ESTERNO;
  7309.                     }
  7310.                     this.pd.setMessage(MessageFormat.format(
  7311.                             CostantiControlStation.MESSAGGIO_ERRORE_LA_PORTA_CONTIENE_DEI_RUOLI_XX_CHE_NON_SONO_COMPATIBILI_CON_LA_NUOVA_FONTE_SCELTA,
  7312.                             ruoliNonCompatibili.toString(), RuoliCostanti.LABEL_PARAMETRO_RUOLO_TIPOLOGIA.toLowerCase(), label));
  7313.                     return false;
  7314.                 }
  7315.             }

  7316.             if(oggetto!=null){
  7317.                 if(isPortaDelegata){
  7318.                     PortaDelegata pd = (PortaDelegata) oggetto;
  7319.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione) ){
  7320.                         if(pd.getRuoli()!=null && pd.getRuoli().sizeRuoloList()>0) {
  7321.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7322.                             return false;
  7323.                         }
  7324.                     }
  7325.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli)==false) ){
  7326.                         if(pd.getRuoli()!=null && pd.getRuoli().sizeRuoloList()>0) {
  7327.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_PUNTUALMENTE);
  7328.                             return false;
  7329.                         }
  7330.                     }
  7331.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7332.                         if(pd.sizeServizioApplicativoList()>0) {
  7333.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7334.                             return false;
  7335.                         }
  7336.                        
  7337.                         /*
  7338.                          * Vale solo per l'autenticazione
  7339.                         Trasformazioni trasformazioni = pd.getTrasformazioni();
  7340.                         if(trasformazioni != null) {
  7341.                             StringBuilder sb = new StringBuilder();
  7342.                             for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7343.                                 if(regola.getApplicabilita()!= null) {
  7344.                                     if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7345.                                         sb.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7346.                                         sb.append("- ");
  7347.                                         sb.append(regola.getNome());
  7348.                                     }
  7349.                                 }
  7350.                             }
  7351.                            
  7352.                             if(sb.length() > 0) {
  7353.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTORIZZAZIONE_DISABILITATA + sb.toString());
  7354.                                 return false;
  7355.                             }
  7356.                         }
  7357.                         */
  7358.                     }
  7359.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati)==false) ){
  7360.                         if(pd.sizeServizioApplicativoList()>0) {
  7361.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_PUNTUALMENTE);
  7362.                             return false;
  7363.                         }
  7364.                     }
  7365.                    
  7366.                     StringBuilder sbCheckTrasformazioni = null;
  7367.                     StringBuilder sbCheckRateLimiting = null;
  7368.                     StringBuilder sbCheckAllarmi = null;
  7369.                     if(isSupportatoAutenticazione && pd.getAutenticazione()!=null){
  7370.                        
  7371.                         String prefix = "";
  7372.                        
  7373.                         boolean modificataAutenticazione = !pd.getAutenticazione().equals(autenticazione);
  7374.                         if(autenticazioneCustom!=null && !"".equals(autenticazioneCustom)) {
  7375.                             modificataAutenticazione = !pd.getAutenticazione().equals(autenticazioneCustom);
  7376.                         }
  7377.                         if(!modificataAutenticazione) {
  7378.                             if (ConnettoriCostanti.AUTENTICAZIONE_TIPO_APIKEY.equals(autenticazione)) {
  7379.                                 // verifico che non sia stato cambiato 'AppId'
  7380.                                 ApiKeyState immagineAttuale = new ApiKeyState(autenticazioneParametroList);
  7381.                                 ApiKeyState immaginePd = new ApiKeyState(this.porteDelegateCore.getParametroAutenticazione(autenticazione, pd.getProprietaAutenticazioneList()));
  7382.                                 if(immagineAttuale.appIdSelected!=immaginePd.appIdSelected) {
  7383.                                     modificataAutenticazione = true;
  7384.                                     prefix = "(Modifica "+ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+") ";
  7385.                                 }
  7386.                             }
  7387.                         }
  7388.                        
  7389.                         // modiifcata autenticazione
  7390.                         if(modificataAutenticazione) {
  7391.                             if(pd.sizeServizioApplicativoList()>0) {
  7392.                                 this.pd.setMessage(prefix+CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TRASPORTO_MODIFICATA);
  7393.                                 return false;
  7394.                             }
  7395.                            
  7396.                             Trasformazioni trasformazioni = pd.getTrasformazioni();
  7397.                             if(trasformazioni != null) {
  7398.                                 StringBuilder sbSoggetti = new StringBuilder();
  7399.                                 sbCheckTrasformazioni = new StringBuilder();
  7400.                                 for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7401.                                     if(regola.getApplicabilita()!= null) {
  7402.                                         if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  7403.                                             sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7404.                                             sbSoggetti.append("- ");
  7405.                                             sbSoggetti.append(regola.getNome());
  7406.                                         }
  7407.                                         if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7408.                                             sbCheckTrasformazioni.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7409.                                             sbCheckTrasformazioni.append("- ");
  7410.                                             sbCheckTrasformazioni.append(regola.getNome());
  7411.                                         }
  7412.                                     }
  7413.                                 }
  7414.                                
  7415.                                 if(sbSoggetti!=null && sbSoggetti.length() > 0) {
  7416.                                     this.pd.setMessage(prefix+
  7417.                                             (CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7418.                                             sbSoggetti.toString());
  7419.                                     return false;
  7420.                                 }
  7421.                                 if(sbCheckTrasformazioni.length() > 0) {
  7422.                                     this.pd.setMessage(prefix+
  7423.                                             (CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7424.                                             sbCheckTrasformazioni.toString());
  7425.                                     return false;
  7426.                                 }
  7427.                             }

  7428.                             ConsoleSearch ricercaAll = new ConsoleSearch(true);
  7429.                             List<AttivazionePolicy> listaRateLimiting = this.confCore.attivazionePolicyList(ricercaAll, RuoloPolicy.DELEGATA, pd.getNome());
  7430.                             if(listaRateLimiting!=null && !listaRateLimiting.isEmpty()) {
  7431.                                 sbCheckRateLimiting = new StringBuilder();
  7432.                                 for(AttivazionePolicy policyRT: listaRateLimiting) {
  7433.                                     if(policyRT.getFiltro()!= null && policyRT.getFiltro().getServizioApplicativoFruitore()!=null) {
  7434.                                         sbCheckRateLimiting.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7435.                                         sbCheckRateLimiting.append("- ");
  7436.                                         sbCheckRateLimiting.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getIdActivePolicy());
  7437.                                     }
  7438.                                 }
  7439.                                
  7440.                                 if(sbCheckRateLimiting.length() > 0) {
  7441.                                     this.pd.setMessage(prefix+CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TRASPORTO_MODIFICATA + sbCheckRateLimiting.toString());
  7442.                                     return false;
  7443.                                 }
  7444.                             }
  7445.                            
  7446.                             if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  7447.                                 ricercaAll = new ConsoleSearch(true);
  7448.                                 List<ConfigurazioneAllarmeBean> allarmi = this.confCore.allarmiList(ricercaAll, RuoloPorta.DELEGATA, pd.getNome());
  7449.                                 if(allarmi!=null && !allarmi.isEmpty()) {
  7450.                                     sbCheckAllarmi = new StringBuilder();
  7451.                                     for(ConfigurazioneAllarmeBean allarme: allarmi) {
  7452.                                         if(allarme.getFiltro()!= null && allarme.getFiltro().getServizioApplicativoFruitore()!=null) {
  7453.                                             sbCheckAllarmi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7454.                                             sbCheckAllarmi.append("- ");
  7455.                                             sbCheckAllarmi.append(allarme.getAlias()!=null ? allarme.getAlias() : allarme.getNome());
  7456.                                         }
  7457.                                     }
  7458.                                    
  7459.                                     if(sbCheckAllarmi.length() > 0) {
  7460.                                         this.pd.setMessage(prefix+CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TRASPORTO_MODIFICATA + sbCheckAllarmi.toString());
  7461.                                         return false;
  7462.                                     }
  7463.                                 }
  7464.                             }
  7465.                         }
  7466.                     }
  7467.                    
  7468.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  7469.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getRuoli()!=null &&
  7470.                                 pd.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7471.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  7472.                             return false;
  7473.                         }
  7474.                     }
  7475.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7476.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getRuoli()!=null &&
  7477.                                 pd.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7478.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7479.                             return false;
  7480.                         }
  7481.                     }
  7482.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneRuoliToken)==false) ){
  7483.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getRuoli()!=null &&
  7484.                                 pd.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7485.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_PUNTUALMENTE);
  7486.                             return false;
  7487.                         }
  7488.                     }
  7489.                    
  7490.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  7491.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7492.                                 pd.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7493.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  7494.                             return false;
  7495.                         }
  7496.                     }
  7497.                     if(pd.getGestioneToken()!=null && pd.getGestioneToken().getPolicy()!=null && !pd.getGestioneToken().getPolicy().equals(policy)){
  7498.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7499.                                 pd.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7500.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY);
  7501.                             return false;
  7502.                         }
  7503.                     }
  7504.                                        
  7505.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7506.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7507.                                 pd.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7508.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7509.                             return false;
  7510.                         }
  7511.                     }
  7512.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticatiToken)==false) ){
  7513.                         if(pd.getAutorizzazioneToken()!=null && pd.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7514.                                 pd.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7515.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_PUNTUALMENTE);
  7516.                             return false;
  7517.                         }
  7518.                     }
  7519.                    
  7520.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  7521.                         if(pd.getScope()!=null && pd.getScope().sizeScopeList()>0) {
  7522.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  7523.                             return false;
  7524.                         }
  7525.                     }
  7526.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7527.                         if(pd.getScope()!=null && pd.getScope().sizeScopeList()>0) {
  7528.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTORIZZAZIONE_SCOPE_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7529.                             return false;
  7530.                         }
  7531.                     }
  7532.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneScope)==false) ){
  7533.                         if(pd.getScope()!=null && pd.getScope().sizeScopeList()>0) {
  7534.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTORIZZAZIONE_SCOPE_DISABILITATA_PUNTUALMENTE);
  7535.                             return false;
  7536.                         }
  7537.                     }
  7538.                    
  7539.                     boolean disabilitatoGestioneToken = AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken);
  7540.                     boolean modificataTokenPolicy = pd.getGestioneToken()!=null && pd.getGestioneToken().getPolicy()!=null && !pd.getGestioneToken().getPolicy().equals(policy);
  7541.                    
  7542.                     if(disabilitatoGestioneToken || modificataTokenPolicy) {
  7543.                        
  7544.                         StringBuilder sbSoggetti = new StringBuilder();
  7545.                         if(sbCheckTrasformazioni==null) {
  7546.                             Trasformazioni trasformazioni = pd.getTrasformazioni();
  7547.                             if(trasformazioni != null) {
  7548.                                 sbCheckTrasformazioni = new StringBuilder();
  7549.                                 for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7550.                                     if(regola.getApplicabilita()!= null) {
  7551.                                         if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  7552.                                             sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7553.                                             sbSoggetti.append("- ");
  7554.                                             sbSoggetti.append(regola.getNome());
  7555.                                         }
  7556.                                         if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7557.                                             sbCheckTrasformazioni.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7558.                                             sbCheckTrasformazioni.append("- ");
  7559.                                             sbCheckTrasformazioni.append(regola.getNome());
  7560.                                         }
  7561.                                     }
  7562.                                 }
  7563.                             }
  7564.                         }
  7565.                         if(sbSoggetti!=null && sbSoggetti.length() > 0) {
  7566.                             this.pd.setMessage((disabilitatoGestioneToken ?
  7567.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA
  7568.                                     :
  7569.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  7570.                                     sbSoggetti.toString());
  7571.                             return false;
  7572.                         }
  7573.                         if(sbCheckTrasformazioni!=null && sbCheckTrasformazioni.length() > 0) {
  7574.                             this.pd.setMessage((disabilitatoGestioneToken ?
  7575.                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA
  7576.                                     :
  7577.                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  7578.                                     sbCheckTrasformazioni.toString());
  7579.                             return false;
  7580.                         }
  7581.                        
  7582.                         if(sbCheckRateLimiting==null) {
  7583.                             ConsoleSearch ricercaAll = new ConsoleSearch(true);
  7584.                             List<AttivazionePolicy> listaRateLimiting = this.confCore.attivazionePolicyList(ricercaAll, RuoloPolicy.DELEGATA, pd.getNome());
  7585.                             if(listaRateLimiting!=null && !listaRateLimiting.isEmpty()) {
  7586.                                 sbCheckRateLimiting = new StringBuilder();
  7587.                                 for(AttivazionePolicy policyRT: listaRateLimiting) {
  7588.                                     if(policyRT.getFiltro()!= null && policyRT.getFiltro().getServizioApplicativoFruitore()!=null) {
  7589.                                         sbCheckRateLimiting.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7590.                                         sbCheckRateLimiting.append("- ");
  7591.                                         sbCheckRateLimiting.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getIdActivePolicy());
  7592.                                     }
  7593.                                 }
  7594.                             }
  7595.                         }
  7596.                         if(sbCheckRateLimiting!=null && sbCheckRateLimiting.length() > 0) {
  7597.                             this.pd.setMessage((disabilitatoGestioneToken ?
  7598.                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TOKEN_MODIFICATA
  7599.                                     :
  7600.                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  7601.                                     sbCheckRateLimiting.toString());
  7602.                             return false;
  7603.                         }
  7604.                        
  7605.                         if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  7606.                             if(sbCheckAllarmi==null) {
  7607.                                 ConsoleSearch ricercaAll = new ConsoleSearch(true);
  7608.                                 List<ConfigurazioneAllarmeBean> allarmi = this.confCore.allarmiList(ricercaAll, RuoloPorta.DELEGATA, pd.getNome());
  7609.                                 if(allarmi!=null && !allarmi.isEmpty()) {
  7610.                                     sbCheckAllarmi = new StringBuilder();
  7611.                                     for(ConfigurazioneAllarmeBean allarme: allarmi) {
  7612.                                         if(allarme.getFiltro()!= null && allarme.getFiltro().getServizioApplicativoFruitore()!=null) {
  7613.                                             sbCheckAllarmi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7614.                                             sbCheckAllarmi.append("- ");
  7615.                                             sbCheckAllarmi.append(allarme.getAlias()!=null ? allarme.getAlias() : allarme.getNome());
  7616.                                         }
  7617.                                     }
  7618.                                 }
  7619.                             }
  7620.                             if(sbCheckAllarmi!=null && sbCheckAllarmi.length() > 0) {
  7621.                                 this.pd.setMessage((disabilitatoGestioneToken ?
  7622.                                         CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TOKEN_MODIFICATA
  7623.                                         :
  7624.                                         CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  7625.                                         sbCheckAllarmi.toString());
  7626.                                 return false;
  7627.                             }
  7628.                         }
  7629.                        
  7630.                     }
  7631.                 }
  7632.                 else {
  7633.                     PortaApplicativa pa = (PortaApplicativa) oggetto;
  7634.                     boolean profiloModi = this.isProfiloModIPA(protocollo);
  7635.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione) ){
  7636.                         if(pa.getRuoli()!=null && pa.getRuoli().sizeRuoloList()>0) {
  7637.                             this.pd.setMessage(profiloModi ?
  7638.                                 CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_AUTORIZZAZIONE_GENERALE
  7639.                                 :
  7640.                                 CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7641.                             return false;
  7642.                         }
  7643.                     }
  7644.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneRuoli)==false) ){
  7645.                         if(pa.getRuoli()!=null && pa.getRuoli().sizeRuoloList()>0) {
  7646.                             this.pd.setMessage(profiloModi ?
  7647.                                 CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_PUNTUALMENTE
  7648.                                 :
  7649.                                 CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_PUNTUALMENTE);
  7650.                             return false;
  7651.                         }
  7652.                     }
  7653.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7654.                         if(pa.getSoggetti()!=null && pa.getSoggetti().sizeSoggettoList()>0) {
  7655.                             this.pd.setMessage(profiloModi ?
  7656.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_AUTORIZZAZIONE_GENERALE
  7657.                                     :
  7658.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7659.                             return false;
  7660.                         }
  7661.                         if(!profiloModi) {
  7662.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7663.                                 this.pd.setMessage(
  7664.                                         //profiloModi ?
  7665.                                         //  CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_AUTORIZZAZIONE_GENERALE
  7666.                                         //  :
  7667.                                         CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_AUTORIZZAZIONE_GENERALE
  7668.                                     );
  7669.                                 return false;
  7670.                             }
  7671.                         }
  7672.                        
  7673.                         /*
  7674.                          * Vale solo per l'autenticazione
  7675.                         Trasformazioni trasformazioni = pa.getTrasformazioni();
  7676.                         if(trasformazioni != null) {
  7677.                             StringBuilder sbSoggetti = new StringBuilder();
  7678.                             StringBuilder sbApplicativi = new StringBuilder();
  7679.                            
  7680.                             for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7681.                                 if(regola.getApplicabilita()!= null) {
  7682.                                     if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  7683.                                         sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7684.                                         sbSoggetti.append("- ");
  7685.                                         sbSoggetti.append(regola.getNome());
  7686.                                     }
  7687.                                    
  7688.                                     if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7689.                                         sbApplicativi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7690.                                         sbApplicativi.append("- ");
  7691.                                         sbApplicativi.append(regola.getNome());
  7692.                                     }
  7693.                                 }
  7694.                             }
  7695.                            
  7696.                             if(sbSoggetti.length() > 0) {
  7697.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTORIZZAZIONE_DISABILITATA + sbSoggetti.toString());
  7698.                                 return false;
  7699.                             }
  7700.                            
  7701.                             if(sbApplicativi.length() > 0) {
  7702.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTORIZZAZIONE_DISABILITATA + sbApplicativi.toString());
  7703.                                 return false;
  7704.                             }
  7705.                         }
  7706.                         */
  7707.                     }
  7708.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticati)==false) ){
  7709.                         if(pa.getSoggetti()!=null && pa.getSoggetti().sizeSoggettoList()>0) {
  7710.                             this.pd.setMessage(profiloModi ?
  7711.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_PUNTUALMENTE
  7712.                                     :
  7713.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_PUNTUALMENTE);
  7714.                             return false;
  7715.                         }
  7716.                         if(!profiloModi) {
  7717.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7718.                                 this.pd.setMessage(
  7719.                                     //profiloModi ?
  7720.                                     //CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_CANALE_DISABILITATA_PUNTUALMENTE
  7721.                                     //:
  7722.                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TRASPORTO_DISABILITATA_PUNTUALMENTE
  7723.                                     );
  7724.                                 return false;
  7725.                             }
  7726.                         }
  7727.                     }
  7728.                     StringBuilder sbCheckTrasformazioni = null;
  7729.                     StringBuilder sbCheckRateLimiting = null;
  7730.                     StringBuilder sbCheckAllarmi = null;
  7731.                     if(isSupportatoAutenticazione && pa.getAutenticazione()!=null ){
  7732.                        
  7733.                         String prefix = "";
  7734.                        
  7735.                         boolean modificataAutenticazione = !pa.getAutenticazione().equals(autenticazione);
  7736.                         if(!modificataAutenticazione) {
  7737.                             if (ConnettoriCostanti.AUTENTICAZIONE_TIPO_APIKEY.equals(autenticazione)) {
  7738.                                 // verifico che non sia stato cambiato 'AppId'
  7739.                                 ApiKeyState immagineAttuale = new ApiKeyState(autenticazioneParametroList);
  7740.                                 ApiKeyState immaginePa = new ApiKeyState(this.porteApplicativeCore.getParametroAutenticazione(autenticazione, pa.getProprietaAutenticazioneList()));
  7741.                                 if(immagineAttuale.appIdSelected!=immaginePa.appIdSelected) {
  7742.                                     modificataAutenticazione = true;
  7743.                                     prefix = "(Modifica "+ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+") ";
  7744.                                 }
  7745.                             }
  7746.                         }
  7747.                        
  7748.                         // modiifcata autenticazione
  7749.                         if(modificataAutenticazione) {
  7750.                             if(pa.getSoggetti()!=null && pa.getSoggetti().sizeSoggettoList()>0) {
  7751.                                 this.pd.setMessage(prefix+
  7752.                                         (profiloModi ?
  7753.                                                 CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTENTICAZIONE_CANALE_MODIFICATA
  7754.                                                 :
  7755.                                                 CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_AUTENTICAZIONE_TRASPORTO_MODIFICATA));
  7756.                                 return false;
  7757.                             }
  7758.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7759.                                 this.pd.setMessage(prefix+
  7760.                                         (profiloModi ?
  7761.                                                 CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_CANALE_MODIFICATA
  7762.                                                 :
  7763.                                                 CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TRASPORTO_MODIFICATA));
  7764.                                 return false;
  7765.                             }
  7766.                            
  7767.                             Trasformazioni trasformazioni = pa.getTrasformazioni();
  7768.                             if(trasformazioni != null) {
  7769.                                 StringBuilder sbSoggetti = new StringBuilder();
  7770.                                 sbCheckTrasformazioni = new StringBuilder();
  7771.                                
  7772.                                 for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7773.                                     if(regola.getApplicabilita()!= null) {
  7774.                                         if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  7775.                                             sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7776.                                             sbSoggetti.append("- ");
  7777.                                             sbSoggetti.append(regola.getNome());
  7778.                                         }
  7779.                                        
  7780.                                         if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7781.                                             sbCheckTrasformazioni.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7782.                                             sbCheckTrasformazioni.append("- ");
  7783.                                             sbCheckTrasformazioni.append(regola.getNome());
  7784.                                         }
  7785.                                     }
  7786.                                 }
  7787.                                
  7788.                                 if(sbSoggetti.length() > 0) {
  7789.                                     this.pd.setMessage(prefix+
  7790.                                             (profiloModi ?
  7791.                                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_CANALE_MODIFICATA
  7792.                                                     :
  7793.                                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7794.                                             sbSoggetti.toString());
  7795.                                     return false;
  7796.                                 }
  7797.                                
  7798.                                 if(sbCheckTrasformazioni.length() > 0) {
  7799.                                     this.pd.setMessage(prefix+
  7800.                                             (profiloModi ?
  7801.                                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_CANALE_MODIFICATA
  7802.                                                     :
  7803.                                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7804.                                             sbCheckTrasformazioni.toString());
  7805.                                     return false;
  7806.                                 }
  7807.                             }
  7808.                            
  7809.                             ConsoleSearch ricercaAll = new ConsoleSearch(true);
  7810.                             List<AttivazionePolicy> listaRateLimiting = this.confCore.attivazionePolicyList(ricercaAll, RuoloPolicy.APPLICATIVA, pa.getNome());
  7811.                             if(listaRateLimiting!=null && !listaRateLimiting.isEmpty()) {
  7812.                                 sbCheckRateLimiting = new StringBuilder();
  7813.                                 for(AttivazionePolicy policyRT: listaRateLimiting) {
  7814.                                     if(policyRT.getFiltro()!= null &&
  7815.                                             (policyRT.getFiltro().getServizioApplicativoFruitore()!=null || policyRT.getFiltro().getNomeFruitore()!=null)) {
  7816.                                         sbCheckRateLimiting.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7817.                                         sbCheckRateLimiting.append("- ");
  7818.                                         sbCheckRateLimiting.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getIdActivePolicy());
  7819.                                     }
  7820.                                 }
  7821.                                
  7822.                                 if(sbCheckRateLimiting.length() > 0) {
  7823.                                     this.pd.setMessage(prefix+
  7824.                                             (profiloModi ?
  7825.                                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_CANALE_MODIFICATA
  7826.                                                     :
  7827.                                                     CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7828.                                             sbCheckRateLimiting.toString());
  7829.                                     return false;
  7830.                                 }
  7831.                             }
  7832.                            
  7833.                             if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  7834.                                 ricercaAll = new ConsoleSearch(true);
  7835.                                 List<ConfigurazioneAllarmeBean> allarmi = this.confCore.allarmiList(ricercaAll, RuoloPorta.APPLICATIVA, pa.getNome());
  7836.                                 if(allarmi!=null && !allarmi.isEmpty()) {
  7837.                                     sbCheckAllarmi = new StringBuilder();
  7838.                                     for(ConfigurazioneAllarmeBean policyRT: allarmi) {
  7839.                                         if(policyRT.getFiltro()!= null &&
  7840.                                                 (policyRT.getFiltro().getServizioApplicativoFruitore()!=null || policyRT.getFiltro().getNomeFruitore()!=null)) {
  7841.                                             sbCheckAllarmi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7842.                                             sbCheckAllarmi.append("- ");
  7843.                                             sbCheckAllarmi.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getNome());
  7844.                                         }
  7845.                                     }
  7846.                                    
  7847.                                     if(sbCheckAllarmi.length() > 0) {
  7848.                                         this.pd.setMessage(prefix+
  7849.                                                 (profiloModi ?
  7850.                                                         CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_CANALE_MODIFICATA
  7851.                                                         :
  7852.                                                         CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TRASPORTO_MODIFICATA) +
  7853.                                                 sbCheckAllarmi.toString());
  7854.                                         return false;
  7855.                                     }
  7856.                                 }
  7857.                             }
  7858.                         }
  7859.                     }

  7860.                     boolean modiSicurezzaMessaggio = false;
  7861.                     try {
  7862.                         IDServizio idAps = IDServizioFactory.getInstance().getIDServizioFromValues(pa.getServizio().getTipo(), pa.getServizio().getNome(),
  7863.                                 pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
  7864.                                 pa.getServizio().getVersione());
  7865.                         if(idAps!=null) {
  7866.                             AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idAps);
  7867.                             idAps.setPortType(asps.getPortType());
  7868.                             idAps.setUriAccordoServizioParteComune(asps.getAccordoServizioParteComune());
  7869.                            
  7870.                             IProtocolFactory<?> protocolFactory = ProtocolFactoryManager.getInstance().getProtocolFactoryByName(protocollo);
  7871.                             IConsoleDynamicConfiguration consoleDynamicConfiguration = protocolFactory.createDynamicConfigurationConsole();
  7872.                             IRegistryReader registryReader = this.apcCore.getRegistryReader(protocolFactory);
  7873.                             IConfigIntegrationReader configRegistryReader = this.apcCore.getConfigIntegrationReader(protocolFactory);
  7874.                             ConsoleConfiguration consoleConfiguration = consoleDynamicConfiguration.getDynamicConfigAccordoServizioParteSpecifica(ConsoleOperationType.CHANGE, this,
  7875.                                     registryReader, configRegistryReader, idAps );
  7876.                             if(consoleConfiguration!=null && consoleConfiguration.getConsoleItem()!=null && !consoleConfiguration.getConsoleItem().isEmpty()) {
  7877.                                 modiSicurezzaMessaggio = true;
  7878.                             }
  7879.                         }
  7880.                     }catch(Exception t) {
  7881.                         this.logError(t.getMessage(),t);
  7882.                     }
  7883.                    
  7884.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  7885.                         if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getRuoli()!=null &&
  7886.                                 pa.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7887.                             if(profiloModi) {
  7888.                                 if(!modiSicurezzaMessaggio) {
  7889.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA_MODI);
  7890.                                     return false;
  7891.                                 }
  7892.                             }
  7893.                             else {
  7894.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  7895.                                 return false;
  7896.                             }
  7897.                         }
  7898.                     }
  7899.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  7900.                         if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getRuoli()!=null &&
  7901.                                 pa.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7902.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7903.                             return false;
  7904.                         }
  7905.                     }
  7906.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneRuoliToken)==false) ){
  7907.                         if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getRuoli()!=null &&
  7908.                                 pa.getAutorizzazioneToken().getRuoli().sizeRuoloList()>0) {
  7909.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_RUOLI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_PUNTUALMENTE);
  7910.                             return false;
  7911.                         }
  7912.                     }
  7913.                    
  7914.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  7915.                         if(profiloModi) {
  7916.                             if(!modiSicurezzaMessaggio) {
  7917.                                 if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7918.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA_MODI);
  7919.                                     return false;
  7920.                                 }
  7921.                             }
  7922.                         }
  7923.                         else if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7924.                                 pa.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7925.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  7926.                             return false;
  7927.                         }
  7928.                     }
  7929.                     if(pa.getGestioneToken()!=null && pa.getGestioneToken().getPolicy()!=null && !pa.getGestioneToken().getPolicy().equals(policy)){
  7930.                         if(profiloModi) {
  7931.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7932.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY_MODI);
  7933.                                 return false;
  7934.                             }
  7935.                         }
  7936.                         else if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7937.                                 pa.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7938.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY);
  7939.                             return false;
  7940.                         }
  7941.                     }
  7942.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){

  7943.                         if(profiloModi) {
  7944.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7945.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_MESSAGGIO_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7946.                                 return false;
  7947.                             }
  7948.                         }
  7949.                         else if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7950.                                     pa.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7951.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  7952.                             return false;
  7953.                         }
  7954.                                                
  7955.                         /*
  7956.                          * Vale solo per l'autenticazione
  7957.                         Trasformazioni trasformazioni = pa.getTrasformazioni();
  7958.                         if(trasformazioni != null) {
  7959.                             StringBuilder sbSoggetti = new StringBuilder();
  7960.                             StringBuilder sbApplicativi = new StringBuilder();
  7961.                            
  7962.                             for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  7963.                                 if(regola.getApplicabilita()!= null) {
  7964.                                     if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  7965.                                         sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7966.                                         sbSoggetti.append("- ");
  7967.                                         sbSoggetti.append(regola.getNome());
  7968.                                     }
  7969.                                    
  7970.                                     if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  7971.                                         sbApplicativi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  7972.                                         sbApplicativi.append("- ");
  7973.                                         sbApplicativi.append(regola.getNome());
  7974.                                     }
  7975.                                 }
  7976.                             }
  7977.                            
  7978.                             if(sbSoggetti.length() > 0) {
  7979.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTORIZZAZIONE_DISABILITATA + sbSoggetti.toString());
  7980.                                 return false;
  7981.                             }
  7982.                            
  7983.                             if(sbApplicativi.length() > 0) {
  7984.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTORIZZAZIONE_DISABILITATA + sbApplicativi.toString());
  7985.                                 return false;
  7986.                             }
  7987.                         }
  7988.                         */
  7989.                     }
  7990.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneAutenticatiToken)==false) ){

  7991.                         if(profiloModi) {
  7992.                             if(pa.getServiziApplicativiAutorizzati()!=null && pa.getServiziApplicativiAutorizzati().sizeServizioApplicativoList()>0) {
  7993.                                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_MESSAGGIO_DISABILITATA_PUNTUALMENTE);
  7994.                                 return false;
  7995.                             }
  7996.                         }
  7997.                         else if(pa.getAutorizzazioneToken()!=null && pa.getAutorizzazioneToken().getServiziApplicativi()!=null &&
  7998.                                     pa.getAutorizzazioneToken().getServiziApplicativi().sizeServizioApplicativoList()>0) {
  7999.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_AUTORIZZAZIONE_TOKEN_DISABILITATA_PUNTUALMENTE);
  8000.                             return false;
  8001.                         }
  8002.                        
  8003.                     }
  8004.                    
  8005.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken)){
  8006.                         if(pa.getScope()!=null && pa.getScope().sizeScopeList()>0) {
  8007.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTENTICAZIONE_TOKEN_MODIFICATA);
  8008.                             return false;
  8009.                         }
  8010.                     }
  8011.                     if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)){
  8012.                         if(pa.getScope()!=null && pa.getScope().sizeScopeList()>0) {
  8013.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTORIZZAZIONE_SCOPE_DISABILITATA_AUTORIZZAZIONE_GENERALE);
  8014.                             return false;
  8015.                         }
  8016.                     }
  8017.                     if((ServletUtils.isCheckBoxEnabled(autorizzazioneScope)==false) ){
  8018.                         if(pa.getScope()!=null && pa.getScope().sizeScopeList()>0) {
  8019.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_SCOPE_PRESENTI_AUTORIZZAZIONE_SCOPE_DISABILITATA_PUNTUALMENTE);
  8020.                             return false;
  8021.                         }
  8022.                     }
  8023.                    
  8024.                     boolean disabilitatoGestioneToken = AutorizzazioneUtilities.STATO_DISABILITATO.equals(gestioneToken);
  8025.                     boolean modificataTokenPolicy = pa.getGestioneToken()!=null && pa.getGestioneToken().getPolicy()!=null && !pa.getGestioneToken().getPolicy().equals(policy);
  8026.                    
  8027.                     if(disabilitatoGestioneToken || modificataTokenPolicy) {
  8028.                        
  8029.                         StringBuilder sbSoggetti = new StringBuilder();
  8030.                         if(sbCheckTrasformazioni==null) {
  8031.                             Trasformazioni trasformazioni = pa.getTrasformazioni();
  8032.                             if(trasformazioni != null) {
  8033.                                 sbCheckTrasformazioni = new StringBuilder();
  8034.                                
  8035.                                 for(TrasformazioneRegola regola: trasformazioni.getRegolaList()) {
  8036.                                     if(regola.getApplicabilita()!= null) {
  8037.                                         if(regola.getApplicabilita().sizeSoggettoList() > 0) {
  8038.                                             sbSoggetti.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  8039.                                             sbSoggetti.append("- ");
  8040.                                             sbSoggetti.append(regola.getNome());
  8041.                                         }
  8042.                                         if(regola.getApplicabilita().sizeServizioApplicativoList() > 0) {
  8043.                                             sbCheckTrasformazioni.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  8044.                                             sbCheckTrasformazioni.append("- ");
  8045.                                             sbCheckTrasformazioni.append(regola.getNome());
  8046.                                         }
  8047.                                     }
  8048.                                 }
  8049.                             }
  8050.                         }
  8051.                         if(sbSoggetti!=null && sbSoggetti.length() > 0) {
  8052.                             this.pd.setMessage((disabilitatoGestioneToken ?
  8053.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA
  8054.                                     :
  8055.                                     CostantiControlStation.MESSAGGIO_ERRORE_SOGGETTI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  8056.                                     sbSoggetti.toString());
  8057.                             return false;
  8058.                         }
  8059.                         if(sbCheckTrasformazioni!=null && sbCheckTrasformazioni.length() > 0) {
  8060.                             this.pd.setMessage((disabilitatoGestioneToken ?
  8061.                                             CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA
  8062.                                             :
  8063.                                             CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_TRASFORMAZIONI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  8064.                                     sbCheckTrasformazioni.toString());
  8065.                             return false;
  8066.                         }
  8067.                        
  8068.                         if(sbCheckRateLimiting==null) {
  8069.                             ConsoleSearch ricercaAll = new ConsoleSearch(true);
  8070.                             List<AttivazionePolicy> listaRateLimiting = this.confCore.attivazionePolicyList(ricercaAll, RuoloPolicy.APPLICATIVA, pa.getNome());
  8071.                             if(listaRateLimiting!=null && !listaRateLimiting.isEmpty()) {
  8072.                                 sbCheckRateLimiting = new StringBuilder();
  8073.                                 for(AttivazionePolicy policyRT: listaRateLimiting) {
  8074.                                     if(policyRT.getFiltro()!= null &&
  8075.                                             (policyRT.getFiltro().getServizioApplicativoFruitore()!=null || policyRT.getFiltro().getNomeFruitore()!=null)) {
  8076.                                         sbCheckRateLimiting.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  8077.                                         sbCheckRateLimiting.append("- ");
  8078.                                         sbCheckRateLimiting.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getIdActivePolicy());
  8079.                                     }
  8080.                                 }
  8081.                             }
  8082.                         }
  8083.                         if(sbCheckRateLimiting!=null && sbCheckRateLimiting.length() > 0) {
  8084.                             this.pd.setMessage((disabilitatoGestioneToken ?
  8085.                                             CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TOKEN_MODIFICATA
  8086.                                             :
  8087.                                             CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_RATE_LIMITING_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  8088.                                     sbCheckRateLimiting.toString());
  8089.                             return false;
  8090.                         }
  8091.                        
  8092.                         if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  8093.                             if(sbCheckAllarmi==null) {
  8094.                                 ConsoleSearch ricercaAll = new ConsoleSearch(true);
  8095.                                 List<ConfigurazioneAllarmeBean> allarmi = this.confCore.allarmiList(ricercaAll, RuoloPorta.APPLICATIVA, pa.getNome());
  8096.                                 if(allarmi!=null && !allarmi.isEmpty()) {
  8097.                                     sbCheckAllarmi = new StringBuilder();
  8098.                                     for(ConfigurazioneAllarmeBean policyRT: allarmi) {
  8099.                                         if(policyRT.getFiltro()!= null &&
  8100.                                                 (policyRT.getFiltro().getServizioApplicativoFruitore()!=null || policyRT.getFiltro().getNomeFruitore()!=null)) {
  8101.                                             sbCheckAllarmi.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
  8102.                                             sbCheckAllarmi.append("- ");
  8103.                                             sbCheckAllarmi.append(policyRT.getAlias()!=null ? policyRT.getAlias() : policyRT.getNome());
  8104.                                         }
  8105.                                     }
  8106.                                 }
  8107.                             }
  8108.                             if(sbCheckAllarmi!=null && sbCheckAllarmi.length() > 0) {
  8109.                                 this.pd.setMessage((disabilitatoGestioneToken ?
  8110.                                                 CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TOKEN_MODIFICATA
  8111.                                                 :
  8112.                                                 CostantiControlStation.MESSAGGIO_ERRORE_APPLICATIVI_PRESENTI_ALLARMI_AUTENTICAZIONE_TOKEN_MODIFICATA_TOKEN_POLICY) +
  8113.                                         sbCheckAllarmi.toString());
  8114.                                 return false;
  8115.                             }
  8116.                         }
  8117.                     }
  8118.                 }
  8119.             }
  8120.            
  8121.             // tipo autorizzazione custom
  8122.             if(autorizzazione != null && autorizzazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM)) {
  8123.                 String autorizzazioneCustom = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM);
  8124.                
  8125.                 if(StringUtils.isEmpty(autorizzazioneCustom) || CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(autorizzazioneCustom)){
  8126.                     if(this.confCore.isConfigurazionePluginsEnabled()) {
  8127.                         this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CUSTOM_NON_INDICATA);
  8128.                     }
  8129.                     else {
  8130.                         this.pd.setMessage(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM+" obbligatorio per il tipo di autorizzazione selezionato");
  8131.                     }
  8132.                     return false;
  8133.                 }
  8134.                
  8135.                 if(this.checkLength255(autorizzazioneCustom,CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CUSTOM)==false) {
  8136.                     return false;
  8137.                 }
  8138.             }
  8139.            
  8140.             if(autorizzazioneContenutiStato!= null && !autorizzazioneContenutiStato.equals(StatoFunzionalita.DISABILITATO.getValue())) {
  8141.                 if(autorizzazioneContenutiStato.equals(StatoFunzionalita.ABILITATO.getValue())) {
  8142.                     if(autorizzazioneContenutiProperties==null || "".equals(autorizzazioneContenutiProperties)) {
  8143.                         this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_NON_INDICATA);
  8144.                         return false;
  8145.                     }
  8146.                     if(autorizzazioneContenutiProperties!=null) {
  8147.                         Scanner scanner = new Scanner(autorizzazioneContenutiProperties);
  8148.                         try {
  8149.                             while (scanner.hasNextLine()) {
  8150.                                 String line = scanner.nextLine();
  8151.                                 if(line==null || line.trim().equals("")) {
  8152.                                     continue;
  8153.                                 }
  8154.                                 line = line.trim();
  8155.                                 if(line!=null && line.startsWith("#")) {
  8156.                                     continue;
  8157.                                 }
  8158.                                 if(line.contains("=")==false) {
  8159.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI+line);
  8160.                                     return false;
  8161.                                 }
  8162.                                 String [] tmp = line.split("=");
  8163.                                 if(tmp==null || tmp.length<1) {
  8164.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI+line);
  8165.                                     return false;
  8166.                                 }
  8167.                                 String key = tmp[0];
  8168.                                 if(key==null || !key.contains("$")) {
  8169.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI_RISORSA_NON_DEFINITA_PREFIX+line);
  8170.                                     return false;
  8171.                                 }
  8172.                                 if(key.length()>255) {
  8173.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI_LUNGHEZZA_MASSIMA_SUPERATA_RISORSA+line);
  8174.                                     return false;
  8175.                                 }
  8176.                                 if(tmp.length<2 || tmp[1]==null || tmp[1].equals("")) {
  8177.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI_VALORE_NON_DEFINITO+line);
  8178.                                     return false;
  8179.                                 }
  8180.                                 String value = tmp[1];
  8181.                                 if(value.length()>255) {
  8182.                                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_TOKEN_NON_VALIDI_LUNGHEZZA_MASSIMA_SUPERATA_VALORE+line);
  8183.                                     return false;
  8184.                                 }
  8185.                             }
  8186.                         }finally {
  8187.                             scanner.close();
  8188.                         }
  8189.                        
  8190.                         // Viene gestita come singole proprieta
  8191. //                      if(this.checkLength(autorizzazioneContenutiProperties, CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_CONTROLLI_AUTORIZZAZIONE,-1,4000)==false) {
  8192. //                          return false;
  8193. //                      }
  8194.                     }
  8195.                 }
  8196.                
  8197.                 if(autorizzazioneContenutiStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_STATO_CUSTOM)) {
  8198.                     if(StringUtils.isEmpty(autorizzazioneContenuto) || CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(autorizzazioneContenuto)){
  8199.                         if(this.confCore.isConfigurazionePluginsEnabled()) {
  8200.                             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_CONTENUTO_CUSTOM_NON_INDICATA);
  8201.                         }
  8202.                         else {
  8203.                             this.pd.setMessage(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM+" obbligatorio per il tipo di autorizzazione selezionato");
  8204.                         }
  8205.                         return false;
  8206.                     }
  8207.                    
  8208.                     if(this.checkLength255(autorizzazioneContenuto, CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI_CONTROLLI_AUTORIZZAZIONE_CUSTOM)==false) {
  8209.                         return false;
  8210.                     }
  8211.                 }
  8212.             }
  8213.            
  8214.             return true;

  8215.         } catch (Exception e) {
  8216.             this.logError("Exception: " + e.getMessage(), e);
  8217.             throw new DriverControlStationException(e);
  8218.         }
  8219.     }
  8220.    
  8221.     private boolean checkAttributes(String [] attributeAuthoritySelezionate, String attributeAuthorityAttributi) {
  8222.         if(attributeAuthoritySelezionate!=null && attributeAuthoritySelezionate.length>1) {
  8223.             Properties properties = null;
  8224.             if(attributeAuthorityAttributi!=null && StringUtils.isNotEmpty(attributeAuthorityAttributi)) {
  8225.                 properties = PropertiesUtilities.convertTextToProperties(attributeAuthorityAttributi);
  8226.                 if(properties!=null && properties.size()>0) {
  8227.                     for (Object oKey : properties.keySet()) {
  8228.                         if(oKey instanceof String) {
  8229.                             String aaName = (String) oKey;
  8230.                             boolean find = false;
  8231.                             for (String aa : attributeAuthoritySelezionate) {
  8232.                                 if(aa.equals(aaName)) {
  8233.                                     find = true;
  8234.                                     break;
  8235.                                 }
  8236.                             }
  8237.                             if(!find) {
  8238.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_ATTRIBUTE_AUTHORITY_NON_ESISTENTE_XX,  
  8239.                                         aaName, CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI));
  8240.                                 return false;
  8241.                             }
  8242.                             String p = properties.getProperty(aaName);
  8243.                             List<String> attributi = DBUtils.convertToList(p);
  8244.                             if(attributi==null || attributi.isEmpty()) {
  8245.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_ATTRIBUTE_AUTHORITY_VUOTA_XX,  
  8246.                                         aaName, CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI));
  8247.                                 return false;
  8248.                             }
  8249.                         }
  8250.                     }
  8251.                 }
  8252.                 else {
  8253.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_ATTRIBUTE_AUTHORITY_NON_ESISTENTE_XX,  
  8254.                             attributeAuthorityAttributi, CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY_ATTRIBUTI));
  8255.                     return false;  
  8256.                 }
  8257.             }
  8258.         }
  8259.         return true;
  8260.     }
  8261.    
  8262.    
  8263.     // Stato PA
  8264.    
  8265.     public String getStatoMessageSecurityPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8266.        
  8267.         if(paAssociata==null) {
  8268.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8269.         }
  8270.        
  8271.         String statoMessageSecurity = paAssociata.getStatoMessageSecurity();
  8272.         return statoMessageSecurity;
  8273.     }


  8274.     public String getStatoDumpPortaApplicativa(PortaApplicativa paAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8275.        
  8276.         if(paAssociata==null) {
  8277.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8278.         }
  8279.        
  8280.         DumpConfigurazione dumpConfigurazione = paAssociata.getDump();
  8281.         String statoDump = dumpConfigurazione == null ? this.getDumpLabelDefault(usePrefixDefault, true) :
  8282.             (this.isDumpConfigurazioneAbilitato(dumpConfigurazione) ? CostantiControlStation.DEFAULT_VALUE_ABILITATO : CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  8283.         return statoDump;
  8284.     }
  8285.    
  8286.     public String getStatoDumpRichiestaPortaApplicativa(PortaApplicativa paAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8287.        
  8288.         if(paAssociata==null) {
  8289.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8290.         }
  8291.        
  8292.         DumpConfigurazione dumpConfigurazione = paAssociata.getDump();
  8293.         String statoDump = dumpConfigurazione == null ? this.getDumpLabelDefault(usePrefixDefault, true) :
  8294.             (this.isDumpConfigurazioneAbilitato(dumpConfigurazione, false) ? CostantiControlStation.DEFAULT_VALUE_ABILITATO : CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  8295.         return statoDump;
  8296.     }
  8297.    
  8298.     public String getStatoDumpRispostaPortaApplicativa(PortaApplicativa paAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8299.        
  8300.         if(paAssociata==null) {
  8301.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8302.         }
  8303.        
  8304.         DumpConfigurazione dumpConfigurazione = paAssociata.getDump();
  8305.         String statoDump = dumpConfigurazione == null ? this.getDumpLabelDefault(usePrefixDefault, true) :
  8306.             (this.isDumpConfigurazioneAbilitato(dumpConfigurazione, true) ? CostantiControlStation.DEFAULT_VALUE_ABILITATO : CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  8307.         return statoDump;
  8308.     }


  8309.     public String getStatoTracciamentoPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8310.        
  8311.         if(paAssociata==null) {
  8312.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8313.         }
  8314.        
  8315.         String statoTracciamento = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  8316.        
  8317.         boolean isCorrelazioneApplicativaAbilitataReq = false;
  8318.         if (paAssociata.getCorrelazioneApplicativa() != null)
  8319.             isCorrelazioneApplicativaAbilitataReq = paAssociata.getCorrelazioneApplicativa().sizeElementoList() > 0;
  8320.            
  8321.         boolean isCorrelazioneApplicativaAbilitataRes = false;
  8322.         if (paAssociata.getCorrelazioneApplicativaRisposta() != null)
  8323.             isCorrelazioneApplicativaAbilitataRes = paAssociata.getCorrelazioneApplicativaRisposta().sizeElementoList() > 0;
  8324.            
  8325.         boolean tracciamento = false;
  8326.         if(paAssociata.getTracciamento()!=null &&
  8327.                 (
  8328.                     (
  8329.                             paAssociata.getTracciamento().getEsiti()!=null
  8330.                             &&
  8331.                             !(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(paAssociata.getTracciamento().getEsiti())
  8332.                     )
  8333.                     ||
  8334.                     paAssociata.getTracciamento().getSeverita()!=null)
  8335.                 ) {
  8336.             tracciamento = true;
  8337.         }
  8338.        
  8339.         if(tracciamento || isCorrelazioneApplicativaAbilitataReq || isCorrelazioneApplicativaAbilitataRes)
  8340.             statoTracciamento = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_ABILITATA;
  8341.         else
  8342.             statoTracciamento = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  8343.         return statoTracciamento;
  8344.     }
  8345.    
  8346.     public boolean isRidefinitoTransazioniRegistratePortaApplicativa(PortaApplicativa paAssociata) {
  8347.         return paAssociata.getTracciamento()!=null && paAssociata.getTracciamento().getEsiti()!=null;
  8348.     }
  8349.    
  8350.     public String getStatoTransazioniRegistratePortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8351.        
  8352.         if(paAssociata==null) {
  8353.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8354.         }
  8355.        
  8356.         if(paAssociata.getTracciamento()!=null && paAssociata.getTracciamento().getEsiti()!=null) {
  8357.             return CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  8358.         }
  8359.         else {
  8360.             return CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  8361.         }
  8362.     }
  8363.    
  8364.     public boolean isRidefinitoMessaggiDiagnosticiPortaApplicativa(PortaApplicativa paAssociata) {
  8365.         return paAssociata.getTracciamento()!=null && paAssociata.getTracciamento().getSeverita()!=null;
  8366.     }
  8367.    
  8368.     public String getStatoMessaggiDiagnosticiPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8369.        
  8370.         if(paAssociata==null) {
  8371.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8372.         }
  8373.        
  8374.         if(paAssociata.getTracciamento()!=null && paAssociata.getTracciamento().getSeverita()!=null) {
  8375.             return paAssociata.getTracciamento().getSeverita().getValue();
  8376.         }
  8377.         else {
  8378.             return CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  8379.         }
  8380.     }

  8381.     public boolean isEnabledCorrelazioneApplicativaPortaApplicativa(PortaApplicativa paAssociata) {
  8382.         boolean isCorrelazioneApplicativaAbilitataReq = false;
  8383.         if (paAssociata.getCorrelazioneApplicativa() != null)
  8384.             isCorrelazioneApplicativaAbilitataReq = paAssociata.getCorrelazioneApplicativa().sizeElementoList() > 0;
  8385.            
  8386.         boolean isCorrelazioneApplicativaAbilitataRes = false;
  8387.         if (paAssociata.getCorrelazioneApplicativaRisposta() != null)
  8388.             isCorrelazioneApplicativaAbilitataRes = paAssociata.getCorrelazioneApplicativaRisposta().sizeElementoList() > 0;
  8389.            
  8390.         return  isCorrelazioneApplicativaAbilitataReq || isCorrelazioneApplicativaAbilitataRes;
  8391.     }
  8392.    
  8393.     public String getStatoCorrelazioneApplicativaPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8394.        
  8395.         if(paAssociata==null) {
  8396.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8397.         }
  8398.        
  8399.         boolean isCorrelazioneApplicativaAbilitataReq = false;
  8400.         if (paAssociata.getCorrelazioneApplicativa() != null)
  8401.             isCorrelazioneApplicativaAbilitataReq = paAssociata.getCorrelazioneApplicativa().sizeElementoList() > 0;
  8402.            
  8403.         boolean isCorrelazioneApplicativaAbilitataRes = false;
  8404.             if (paAssociata.getCorrelazioneApplicativaRisposta() != null)
  8405.                 isCorrelazioneApplicativaAbilitataRes = paAssociata.getCorrelazioneApplicativaRisposta().sizeElementoList() > 0;
  8406.                
  8407.         if(isCorrelazioneApplicativaAbilitataReq && isCorrelazioneApplicativaAbilitataRes)
  8408.             return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_ABILITATA;
  8409.        
  8410.         if(isCorrelazioneApplicativaAbilitataReq)
  8411.             return CostantiControlStation.VALUE_PARAMETRO_DUMP_SEZIONE_RICHIESTA;
  8412.        
  8413.         if(isCorrelazioneApplicativaAbilitataRes)
  8414.             return CostantiControlStation.VALUE_PARAMETRO_DUMP_SEZIONE_RISPOSTA;
  8415.            
  8416.         return PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  8417.     }


  8418.     public String getStatoMTOMPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8419.        
  8420.         if(paAssociata==null) {
  8421.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8422.         }
  8423.        
  8424.         String statoMTOM = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_DISABILITATO;
  8425.         boolean isMTOMAbilitatoReq = false;
  8426.         boolean isMTOMAbilitatoRes= false;
  8427.         if(paAssociata.getMtomProcessor()!= null){
  8428.             if(paAssociata.getMtomProcessor().getRequestFlow() != null){
  8429.                 if(paAssociata.getMtomProcessor().getRequestFlow().getMode() != null){
  8430.                     MTOMProcessorType mode = paAssociata.getMtomProcessor().getRequestFlow().getMode();
  8431.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  8432.                         isMTOMAbilitatoReq = true;
  8433.                 }
  8434.             }

  8435.             if(paAssociata.getMtomProcessor().getResponseFlow() != null){
  8436.                 if(paAssociata.getMtomProcessor().getResponseFlow().getMode() != null){
  8437.                     MTOMProcessorType mode = paAssociata.getMtomProcessor().getResponseFlow().getMode();
  8438.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  8439.                         isMTOMAbilitatoRes = true;
  8440.                 }
  8441.             }
  8442.         }

  8443.         if(isMTOMAbilitatoReq || isMTOMAbilitatoRes)
  8444.             statoMTOM = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_ABILITATO;
  8445.         else
  8446.             statoMTOM = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_MTOM_DISABILITATO;
  8447.         return statoMTOM;
  8448.     }

  8449.     public MTOMProcessorType getProcessorTypeRequestMTOMPortaApplicativa(PortaApplicativa paAssociata) {
  8450.         if(paAssociata.getMtomProcessor()!= null){
  8451.             if(paAssociata.getMtomProcessor().getRequestFlow() != null){
  8452.                 if(paAssociata.getMtomProcessor().getRequestFlow().getMode() != null){
  8453.                     MTOMProcessorType mode = paAssociata.getMtomProcessor().getRequestFlow().getMode();
  8454.                     return mode;
  8455.                 }
  8456.             }
  8457.         }
  8458.         return null;
  8459.     }
  8460.    
  8461.     public MTOMProcessorType getProcessorTypeResponseMTOMPortaApplicativa(PortaApplicativa paAssociata) {
  8462.         if(paAssociata.getMtomProcessor()!= null){
  8463.             if(paAssociata.getMtomProcessor().getResponseFlow() != null){
  8464.                 if(paAssociata.getMtomProcessor().getResponseFlow().getMode() != null){
  8465.                     MTOMProcessorType mode = paAssociata.getMtomProcessor().getResponseFlow().getMode();
  8466.                     return mode;
  8467.                 }
  8468.             }
  8469.         }
  8470.         return null;
  8471.     }

  8472.     public String getStatoValidazionePortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8473.        
  8474.         if(paAssociata==null) {
  8475.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8476.         }
  8477.        
  8478.         String statoValidazione = null;
  8479.        
  8480.         ValidazioneContenutiApplicativi vx = paAssociata.getValidazioneContenutiApplicativi();
  8481.         if (vx == null) {
  8482.             statoValidazione = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8483.         } else {
  8484.             if(vx.getStato()!=null)
  8485.                 statoValidazione = vx.getStato().toString();
  8486.             if ((statoValidazione == null) || "".equals(statoValidazione)) {
  8487.                 statoValidazione = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8488.             }
  8489.         }
  8490.         return statoValidazione;
  8491.     }

  8492.     public String getTipoValidazionePortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8493.        
  8494.         if(paAssociata==null) {
  8495.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8496.         }
  8497.        
  8498.         String tipoValidazione = null;
  8499.        
  8500.         ValidazioneContenutiApplicativi vx = paAssociata.getValidazioneContenutiApplicativi();
  8501.         if (vx != null) {
  8502.             if(vx.getTipo()!=null) {
  8503.                 tipoValidazione = vx.getTipo().getValue();
  8504.             }
  8505.         }
  8506.         return tipoValidazione;
  8507.     }

  8508.     public String getStatoResponseCachingPortaApplicativa(PortaApplicativa paAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8509.        
  8510.         if(paAssociata==null) {
  8511.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8512.         }
  8513.        
  8514.         String stato = null;
  8515.         ResponseCachingConfigurazione rc = paAssociata.getResponseCaching();
  8516.         if (rc == null) {
  8517.             stato = this.getResponseCachingLabelDefault(usePrefixDefault);
  8518.         } else {
  8519.             if(rc.getStato()!=null) {
  8520.                 stato = rc.getStato().getValue();
  8521.             }
  8522.             else {
  8523.                 stato = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8524.             }
  8525.         }
  8526.         return stato;
  8527.     }
  8528.    
  8529.     public String getStatoGestioneCorsPortaApplicativa(PortaApplicativa paAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8530.        
  8531.         if(paAssociata==null) {
  8532.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8533.         }
  8534.        
  8535.         String stato = null;
  8536.         CorsConfigurazione cc = paAssociata.getGestioneCors();
  8537.         if (cc == null) {
  8538.             stato = this.getGestioneCorsLabelDefault(usePrefixDefault);
  8539.         } else {
  8540.             if(cc.getStato()==null || StatoFunzionalita.DISABILITATO.equals(cc.getStato())) {
  8541.                 stato = StatoFunzionalita.DISABILITATO.getValue();
  8542.             }
  8543.             else {
  8544.                 stato = getLabelTipoGestioneCors(cc.getTipo());
  8545.             }
  8546.         }
  8547.         return stato;
  8548.     }
  8549.    
  8550.     public String getStatoOpzioniAvanzatePortaDelegataDefault(PortaDelegata pdAssociata) throws DriverControlStationException {
  8551.        
  8552.         if(pdAssociata==null) {
  8553.             throw new DriverControlStationException("Param pdAssociata is null");
  8554.         }
  8555.        
  8556.         return _getStatoOpzioniAvanzatePortaApplicativaDefault(pdAssociata.getOptions());
  8557.     }
  8558.     public String getStatoOpzioniAvanzatePortaApplicativaDefault(PortaApplicativa paAssociata) throws DriverControlStationException {
  8559.        
  8560.         if(paAssociata==null) {
  8561.             throw new DriverControlStationException("Param paAssociata is null");
  8562.         }
  8563.        
  8564.         return _getStatoOpzioniAvanzatePortaApplicativaDefault(paAssociata.getOptions());
  8565.     }
  8566.     private String _getStatoOpzioniAvanzatePortaApplicativaDefault(String options) throws DriverControlStationException {
  8567.         String stato = null;
  8568.        
  8569.         Map<String, List<String>> props = null;
  8570.         try {
  8571.             props = PropertiesSerializator.convertoFromDBColumnValue(options);
  8572.         }catch(Exception e) {
  8573.             throw new DriverControlStationException(e.getMessage(),e);
  8574.         }
  8575.         if(props==null || props.size()<=0) {
  8576.             stato = StatoFunzionalita.DISABILITATO.getValue();
  8577.         }
  8578.         else {
  8579.             stato = StatoFunzionalita.ABILITATO.getValue();
  8580.         }
  8581.        
  8582.         return stato;
  8583.     }
  8584.    
  8585.     public String getStatoControlloAccessiPortaApplicativa(String protocollo, PortaApplicativa paAssociata) throws DriverControlStationException, DriverControlStationNotFound {
  8586.         return this._getStatoControlloAccessiPortaApplicativa(protocollo, paAssociata, null);
  8587.     }
  8588.     public void setStatoControlloAccessiPortaApplicativa(String protocollo, PortaApplicativa paAssociata, DataElement de) throws DriverControlStationException, DriverControlStationNotFound {
  8589.         this._getStatoControlloAccessiPortaApplicativa(protocollo, paAssociata, de);
  8590.     }
  8591.     private String _getStatoControlloAccessiPortaApplicativa(String protocollo, PortaApplicativa paAssociata, DataElement de) throws DriverControlStationException, DriverControlStationNotFound {
  8592.        
  8593.         if(paAssociata==null) {
  8594.             throw new DriverControlStationException("Param paAssociata is null");
  8595.         }
  8596.        
  8597.         String gestioneToken = null;
  8598.         String gestioneTokenPolicy = null;
  8599.         String gestioneTokenOpzionale = "";
  8600.         GestioneToken gestioneTokenConfig = null;
  8601.         AutorizzazioneScope autorizzazioneScope = null;
  8602.         PortaDelegataAutorizzazioneToken autorizzazioneTokenPortaDelegata = null;
  8603.         PortaApplicativaAutorizzazioneToken autorizzazioneTokenPortaApplicativa = null;
  8604.         if(paAssociata.getGestioneToken()!=null && paAssociata.getGestioneToken().getPolicy()!=null &&
  8605.                 !"".equals(paAssociata.getGestioneToken().getPolicy()) &&
  8606.                 !"-".equals(paAssociata.getGestioneToken().getPolicy())) {
  8607.             gestioneToken = StatoFunzionalita.ABILITATO.getValue();
  8608.             gestioneTokenPolicy = paAssociata.getGestioneToken().getPolicy();
  8609.            
  8610.             if(paAssociata.getGestioneToken()!=null && paAssociata.getGestioneToken().getTokenOpzionale()!=null){
  8611.                 if (paAssociata.getGestioneToken().getTokenOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  8612.                     gestioneTokenOpzionale = Costanti.CHECK_BOX_ENABLED;
  8613.                 }
  8614.             }
  8615.            
  8616.             gestioneTokenConfig = paAssociata.getGestioneToken();
  8617.             autorizzazioneScope = paAssociata.getScope();
  8618.             autorizzazioneTokenPortaApplicativa = paAssociata.getAutorizzazioneToken();
  8619.         }
  8620.        
  8621.         boolean modipa = this.isProfiloModIPA(protocollo);
  8622.         if(modipa && autorizzazioneTokenPortaApplicativa==null) {
  8623.             autorizzazioneTokenPortaApplicativa = paAssociata.getAutorizzazioneToken();
  8624.         }

  8625.         String autenticazione = paAssociata.getAutenticazione();
  8626.         String autenticazioneCustom = null;
  8627.         if (autenticazione != null && !TipoAutenticazione.getValues().contains(autenticazione)) {
  8628.             autenticazioneCustom = autenticazione;
  8629.             autenticazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  8630.                    
  8631.             Plugin plugin = null;
  8632.             try {
  8633.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTENTICAZIONE,autenticazioneCustom, false);
  8634.             }catch(Throwable e) {
  8635.                 // ignore
  8636.             }
  8637.            
  8638.             if(plugin!=null && plugin.getLabel()!=null) {
  8639.                 autenticazioneCustom = plugin.getLabel();
  8640.             }
  8641.         }
  8642.         String autenticazioneOpzionale = "";
  8643.         if(paAssociata.getAutenticazioneOpzionale()!=null){
  8644.             if (paAssociata.getAutenticazioneOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  8645.                 autenticazioneOpzionale = Costanti.CHECK_BOX_ENABLED;
  8646.             }
  8647.         }
  8648.        
  8649.         String autorizzazione= null, autorizzazioneCustom = null;
  8650.         int sizeApplicativi = 0;
  8651.         int sizeSoggetti = 0;
  8652.         int sizeRuoli = 0;
  8653.         if (paAssociata.getAutorizzazione() != null &&
  8654.                 !TipoAutorizzazione.getAllValues().contains(paAssociata.getAutorizzazione())) {
  8655.             autorizzazioneCustom = paAssociata.getAutorizzazione();
  8656.             autorizzazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  8657.            
  8658.             Plugin plugin = null;
  8659.             try {
  8660.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTORIZZAZIONE,autorizzazioneCustom, false);
  8661.             }catch(Throwable e) {
  8662.                 // ignore
  8663.             }
  8664.            
  8665.             if(plugin!=null && plugin.getLabel()!=null) {
  8666.                 autorizzazioneCustom = plugin.getLabel();
  8667.             }
  8668.         }
  8669.         else{
  8670.             if(de!=null) {
  8671.                 autorizzazione = paAssociata.getAutorizzazione();
  8672.             }
  8673.             else {
  8674.                 autorizzazione = AutorizzazioneUtilities.convertToStato(paAssociata.getAutorizzazione());
  8675.             }
  8676.             autorizzazione = paAssociata.getAutorizzazione();
  8677.         }
  8678.         if(paAssociata.getServiziApplicativiAutorizzati()!=null) {
  8679.             sizeApplicativi = paAssociata.getServiziApplicativiAutorizzati().sizeServizioApplicativoList();
  8680.         }
  8681.         if(paAssociata.getSoggetti()!=null) {
  8682.             sizeSoggetti = paAssociata.getSoggetti().sizeSoggettoList();
  8683.         }
  8684.         if(paAssociata.getRuoli()!=null) {
  8685.             sizeRuoli = paAssociata.getRuoli().sizeRuoloList();
  8686.         }
  8687.        
  8688.         String autorizzazioneContenuti = paAssociata.getAutorizzazioneContenuto();
  8689.         if(StringUtils.isNotEmpty(autorizzazioneContenuti) && !CostantiAutorizzazione.AUTORIZZAZIONE_CONTENUTO_BUILT_IN.equals(autorizzazioneContenuti)) {
  8690.             Plugin plugin = null;
  8691.             try {
  8692.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTORIZZAZIONE_CONTENUTI,autorizzazioneContenuti, false);
  8693.             }catch(Throwable e) {
  8694.                 // ignore
  8695.             }
  8696.            
  8697.             if(plugin!=null && plugin.getLabel()!=null) {
  8698.                 autorizzazioneContenuti = plugin.getLabel();
  8699.             }
  8700.         }
  8701.        
  8702.         List<AttributeAuthority> aa = paAssociata.getAttributeAuthorityList();
  8703.         List<String> attributeAuthority = new ArrayList<>();
  8704.         if(aa!=null && !aa.isEmpty()) {
  8705.             for (AttributeAuthority a : aa) {
  8706.                 attributeAuthority.add(a.getNome());
  8707.             }
  8708.         }
  8709.        
  8710.         if(de!=null) {
  8711.             this.setStatoControlloAccessi(de, false,
  8712.                     gestioneToken, gestioneTokenOpzionale, gestioneTokenPolicy, gestioneTokenConfig,
  8713.                     autenticazione,  autenticazioneOpzionale, autenticazioneCustom,
  8714.                     autorizzazione, autorizzazioneCustom, sizeApplicativi, sizeSoggetti, sizeRuoli,
  8715.                     autorizzazioneTokenPortaDelegata, autorizzazioneTokenPortaApplicativa, autorizzazioneScope,
  8716.                     autorizzazioneContenuti,
  8717.                     protocollo,
  8718.                     attributeAuthority);
  8719.             return  null;
  8720.         }
  8721.         else {
  8722.             return this.getLabelStatoControlloAccessi(
  8723.                 false,
  8724.                 gestioneToken, gestioneTokenOpzionale, gestioneTokenPolicy, gestioneTokenConfig,
  8725.                 autenticazione,  autenticazioneOpzionale, autenticazioneCustom,
  8726.                 autorizzazione, autorizzazioneCustom, sizeApplicativi, sizeSoggetti, sizeRuoli,
  8727.                 autorizzazioneTokenPortaDelegata, autorizzazioneTokenPortaApplicativa, autorizzazioneScope,
  8728.                 autorizzazioneContenuti,
  8729.                 attributeAuthority);
  8730.         }
  8731.     }
  8732.    
  8733.     public String getStatoGestioneTokenPortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8734.        
  8735.         if(paAssociata==null) {
  8736.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8737.         }
  8738.        
  8739.         String gestioneToken = null;
  8740.         if(paAssociata.getGestioneToken()!=null && paAssociata.getGestioneToken().getPolicy()!=null &&
  8741.                 !"".equals(paAssociata.getGestioneToken().getPolicy()) &&
  8742.                 !"-".equals(paAssociata.getGestioneToken().getPolicy())) {
  8743.             gestioneToken = StatoFunzionalita.ABILITATO.getValue();
  8744.         }
  8745.        
  8746.         return this.getLabelStatoGestioneToken(gestioneToken);
  8747.     }
  8748.    
  8749.     public String getStatoAutenticazionePortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8750.        
  8751.         if(paAssociata==null) {
  8752.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8753.         }
  8754.        
  8755.         String autenticazione = paAssociata.getAutenticazione();
  8756.         String autenticazioneCustom = null;
  8757.         if (autenticazione != null && !TipoAutenticazione.getValues().contains(autenticazione)) {
  8758.             autenticazioneCustom = autenticazione;
  8759.             autenticazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  8760.         }
  8761.         String autenticazioneOpzionale = "";
  8762.         if(paAssociata.getAutenticazioneOpzionale()!=null){
  8763.             if (paAssociata.getAutenticazioneOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  8764.                 autenticazioneOpzionale = Costanti.CHECK_BOX_ENABLED;
  8765.             }
  8766.         }

  8767.         return this.getLabelStatoAutenticazione(autenticazione, autenticazioneOpzionale, autenticazioneCustom);
  8768.     }
  8769.    
  8770.     public String getStatoAutorizzazionePortaApplicativa(PortaApplicativa paAssociata) throws DriverConfigurazioneException {
  8771.        
  8772.         if(paAssociata==null) {
  8773.             throw new DriverConfigurazioneException("Param paAssociata is null");
  8774.         }
  8775.        
  8776.         String autorizzazioneContenuti = paAssociata.getAutorizzazioneContenuto();
  8777.        
  8778.         String autorizzazione= null, autorizzazioneCustom = null;
  8779.         if (paAssociata.getAutorizzazione() != null &&
  8780.                 !TipoAutorizzazione.getAllValues().contains(paAssociata.getAutorizzazione())) {
  8781.             autorizzazioneCustom = paAssociata.getAutorizzazione();
  8782.             autorizzazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  8783.         }
  8784.         else{
  8785.             autorizzazione = AutorizzazioneUtilities.convertToStato(paAssociata.getAutorizzazione());
  8786.         }
  8787.        
  8788.         return this.getLabelStatoAutorizzazione(autorizzazione, autorizzazioneContenuti, autorizzazioneCustom);
  8789.     }
  8790.    
  8791.    
  8792.    
  8793.     // Stato Porta Delegata
  8794.    
  8795.     public String getStatoDumpPortaDelegata(PortaDelegata pdAssociata, boolean usePrefixDefault)
  8796.             throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8797.        
  8798.         if(pdAssociata==null) {
  8799.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8800.         }
  8801.        
  8802.         DumpConfigurazione dumpConfigurazione = pdAssociata.getDump();
  8803.         String statoDump = dumpConfigurazione == null ? this.getDumpLabelDefault(usePrefixDefault, false) :
  8804.             (this.isDumpConfigurazioneAbilitato(dumpConfigurazione) ? CostantiControlStation.DEFAULT_VALUE_ABILITATO : CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  8805.         return statoDump;
  8806.     }


  8807.     public String getStatoTracciamentoPortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  8808.        
  8809.         if(pdAssociata==null) {
  8810.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8811.         }
  8812.        
  8813.         String statoTracciamento = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  8814.         boolean tracciamento = false;
  8815.         boolean isCorrelazioneApplicativaAbilitataReq = false;
  8816.         boolean isCorrelazioneApplicativaAbilitataRes = false;
  8817.        
  8818.         if (pdAssociata.getCorrelazioneApplicativa() != null)
  8819.             isCorrelazioneApplicativaAbilitataReq = pdAssociata.getCorrelazioneApplicativa().sizeElementoList() > 0;

  8820.         if (pdAssociata.getCorrelazioneApplicativaRisposta() != null)
  8821.             isCorrelazioneApplicativaAbilitataRes = pdAssociata.getCorrelazioneApplicativaRisposta().sizeElementoList() > 0;
  8822.        
  8823.         if(pdAssociata.getTracciamento()!=null &&
  8824.                 (
  8825.                     (
  8826.                             pdAssociata.getTracciamento().getEsiti()!=null
  8827.                             &&
  8828.                             !(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(pdAssociata.getTracciamento().getEsiti())
  8829.                     )
  8830.                     ||
  8831.                     pdAssociata.getTracciamento().getSeverita()!=null)
  8832.                 ) {
  8833.             tracciamento = true;
  8834.         }
  8835.        
  8836.         if(tracciamento || isCorrelazioneApplicativaAbilitataReq || isCorrelazioneApplicativaAbilitataRes)
  8837.             statoTracciamento = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA_ABILITATA;
  8838.         else
  8839.             statoTracciamento = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA_DISABILITATA;
  8840.         return statoTracciamento;
  8841.     }


  8842.     public String getStatoMTOMPortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  8843.        
  8844.         if(pdAssociata==null) {
  8845.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8846.         }
  8847.        
  8848.         String statoMTOM = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_MTOM_DISABILITATO;
  8849.        
  8850.         boolean isMTOMAbilitatoReq = false;
  8851.         boolean isMTOMAbilitatoRes= false;
  8852.         if(pdAssociata.getMtomProcessor()!= null){
  8853.             if(pdAssociata.getMtomProcessor().getRequestFlow() != null){
  8854.                 if(pdAssociata.getMtomProcessor().getRequestFlow().getMode() != null){
  8855.                     MTOMProcessorType mode = pdAssociata.getMtomProcessor().getRequestFlow().getMode();
  8856.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  8857.                         isMTOMAbilitatoReq = true;
  8858.                 }
  8859.             }

  8860.             if(pdAssociata.getMtomProcessor().getResponseFlow() != null){
  8861.                 if(pdAssociata.getMtomProcessor().getResponseFlow().getMode() != null){
  8862.                     MTOMProcessorType mode = pdAssociata.getMtomProcessor().getResponseFlow().getMode();
  8863.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  8864.                         isMTOMAbilitatoRes = true;
  8865.                 }
  8866.             }
  8867.         }

  8868.         if(isMTOMAbilitatoReq || isMTOMAbilitatoRes)
  8869.             statoMTOM = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_MTOM_ABILITATO;
  8870.         else
  8871.             statoMTOM = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_MTOM_DISABILITATO;
  8872.         return statoMTOM;
  8873.     }


  8874.     public String getStatoMessageSecurityPortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  8875.        
  8876.         if(pdAssociata==null) {
  8877.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8878.         }
  8879.        
  8880.         String statoMessageSecurity = pdAssociata.getStatoMessageSecurity();
  8881.         return statoMessageSecurity;
  8882.     }


  8883.     public String getStatoValidazionePortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  8884.        
  8885.         if(pdAssociata==null) {
  8886.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8887.         }
  8888.        
  8889.         String statoValidazione = null;
  8890.         ValidazioneContenutiApplicativi vx = pdAssociata.getValidazioneContenutiApplicativi();
  8891.         if (vx == null) {
  8892.             statoValidazione = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8893.         } else {
  8894.             if(vx.getStato()!=null)
  8895.                 statoValidazione = vx.getStato().toString();
  8896.             if ((statoValidazione == null) || "".equals(statoValidazione)) {
  8897.                 statoValidazione = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8898.             }
  8899.         }
  8900.         return statoValidazione;
  8901.     }

  8902.     public String getStatoResponseCachingPortaDelegata(PortaDelegata pdAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8903.        
  8904.         if(pdAssociata==null) {
  8905.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8906.         }
  8907.        
  8908.         String stato = null;
  8909.         ResponseCachingConfigurazione rc = pdAssociata.getResponseCaching();
  8910.         if (rc == null) {
  8911.             stato = this.getResponseCachingLabelDefault(usePrefixDefault);
  8912.         } else {
  8913.             if(rc.getStato()!=null) {
  8914.                 stato = rc.getStato().getValue();
  8915.             }
  8916.             else {
  8917.                 stato = PorteDelegateCostanti.DEFAULT_VALUE_PARAMETRO_PORTE_DELEGATE_VALIDAZIONE_DISABILITATO;
  8918.             }
  8919.         }
  8920.         return stato;
  8921.     }
  8922.    
  8923.     public String getStatoGestioneCorsPortaDelegata(PortaDelegata pdAssociata, boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  8924.        
  8925.         if(pdAssociata==null) {
  8926.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  8927.         }
  8928.        
  8929.         String stato = null;
  8930.         CorsConfigurazione cc = pdAssociata.getGestioneCors();
  8931.         if (cc == null) {
  8932.             stato = this.getGestioneCorsLabelDefault(usePrefixDefault);
  8933.         } else {
  8934.             if(cc.getStato()==null || StatoFunzionalita.DISABILITATO.equals(cc.getStato())) {
  8935.                 stato = StatoFunzionalita.DISABILITATO.getValue();
  8936.             }
  8937.             else {
  8938.                 stato = getLabelTipoGestioneCors(cc.getTipo());
  8939.             }
  8940.         }
  8941.         return stato;
  8942.     }

  8943.     public String getStatoControlloAccessiPortaDelegata(String protocollo, PortaDelegata pdAssociata) throws DriverControlStationException, DriverControlStationNotFound {
  8944.         return this._getStatoControlloAccessiPortaDelegata(protocollo, pdAssociata, null);
  8945.     }
  8946.     public void setStatoControlloAccessiPortaDelegata(String protocollo, PortaDelegata pdAssociata, DataElement de) throws DriverControlStationException, DriverControlStationNotFound {
  8947.         this._getStatoControlloAccessiPortaDelegata(protocollo, pdAssociata, de);
  8948.     }
  8949.     private String _getStatoControlloAccessiPortaDelegata(String protocollo, PortaDelegata pdAssociata, DataElement de) throws DriverControlStationException, DriverControlStationNotFound {
  8950.        
  8951.         if(pdAssociata==null) {
  8952.             throw new DriverControlStationException("Param pdAssociata is null");
  8953.         }
  8954.        
  8955.         String gestioneToken = null;
  8956.         String gestioneTokenPolicy = null;
  8957.         String gestioneTokenOpzionale = "";
  8958.         GestioneToken gestioneTokenConfig = null;
  8959.         AutorizzazioneScope autorizzazioneScope = null;
  8960.         PortaDelegataAutorizzazioneToken autorizzazioneTokenPortaDelegata = null;
  8961.         PortaApplicativaAutorizzazioneToken autorizzazioneTokenPortaApplicativa = null;
  8962.         if(pdAssociata.getGestioneToken()!=null && pdAssociata.getGestioneToken().getPolicy()!=null &&
  8963.                 !"".equals(pdAssociata.getGestioneToken().getPolicy()) &&
  8964.                 !"-".equals(pdAssociata.getGestioneToken().getPolicy())) {
  8965.             gestioneToken = StatoFunzionalita.ABILITATO.getValue();
  8966.             gestioneTokenPolicy = pdAssociata.getGestioneToken().getPolicy();
  8967.            
  8968.             if(pdAssociata.getGestioneToken()!=null && pdAssociata.getGestioneToken().getTokenOpzionale()!=null){
  8969.                 if (pdAssociata.getGestioneToken().getTokenOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  8970.                     gestioneTokenOpzionale = Costanti.CHECK_BOX_ENABLED;
  8971.                 }
  8972.             }
  8973.            
  8974.             gestioneTokenConfig = pdAssociata.getGestioneToken();
  8975.             autorizzazioneScope = pdAssociata.getScope();
  8976.             autorizzazioneTokenPortaDelegata = pdAssociata.getAutorizzazioneToken();
  8977.         }
  8978.        
  8979.         String autenticazione = pdAssociata.getAutenticazione();
  8980.         String autenticazioneCustom = null;
  8981.         if (autenticazione != null && !TipoAutenticazione.getValues().contains(autenticazione)) {
  8982.             autenticazioneCustom = autenticazione;
  8983.             autenticazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  8984.            
  8985.             Plugin plugin = null;
  8986.             try {
  8987.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTENTICAZIONE,autenticazioneCustom, false);
  8988.             }catch(Throwable e) {
  8989.                 // ignore
  8990.             }
  8991.            
  8992.             if(plugin!=null && plugin.getLabel()!=null) {
  8993.                 autenticazioneCustom = plugin.getLabel();
  8994.             }
  8995.         }
  8996.         String autenticazioneOpzionale = "";
  8997.         if(pdAssociata.getAutenticazioneOpzionale()!=null){
  8998.             if (pdAssociata.getAutenticazioneOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  8999.                 autenticazioneOpzionale = Costanti.CHECK_BOX_ENABLED;
  9000.             }
  9001.         }
  9002.        
  9003.         String autorizzazione= null, autorizzazioneCustom = null;
  9004.         int sizeApplicativi = 0;
  9005.         int sizeSoggetti = 0;
  9006.         int sizeRuoli = 0;
  9007.         if (pdAssociata.getAutorizzazione() != null &&
  9008.                 !TipoAutorizzazione.getAllValues().contains(pdAssociata.getAutorizzazione())) {
  9009.             autorizzazioneCustom = pdAssociata.getAutorizzazione();
  9010.             autorizzazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  9011.            
  9012.             Plugin plugin = null;
  9013.             try {
  9014.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTORIZZAZIONE,autorizzazioneCustom, false);
  9015.             }catch(Throwable e) {
  9016.                 // ignore
  9017.             }
  9018.            
  9019.             if(plugin!=null && plugin.getLabel()!=null) {
  9020.                 autorizzazioneCustom = plugin.getLabel();
  9021.             }
  9022.         }
  9023.         else{
  9024.             if(de!=null) {
  9025.                 autorizzazione = pdAssociata.getAutorizzazione();
  9026.             }
  9027.             else {
  9028.                 autorizzazione = AutorizzazioneUtilities.convertToStato(pdAssociata.getAutorizzazione());
  9029.             }
  9030.         }
  9031.         sizeApplicativi = pdAssociata.sizeServizioApplicativoList();
  9032.         if(pdAssociata.getRuoli()!=null) {
  9033.             sizeRuoli = pdAssociata.getRuoli().sizeRuoloList();
  9034.         }
  9035.        
  9036.         String autorizzazioneContenuti = pdAssociata.getAutorizzazioneContenuto();
  9037.         if(StringUtils.isNotEmpty(autorizzazioneContenuti) && !CostantiAutorizzazione.AUTORIZZAZIONE_CONTENUTO_BUILT_IN.equals(autorizzazioneContenuti)) {
  9038.             Plugin plugin = null;
  9039.             try {
  9040.                 plugin = this.confCore.getPlugin(TipoPlugin.AUTORIZZAZIONE_CONTENUTI,autorizzazioneContenuti, false);
  9041.             }catch(Throwable e) {
  9042.                 // ignore
  9043.             }
  9044.            
  9045.             if(plugin!=null && plugin.getLabel()!=null) {
  9046.                 autorizzazioneContenuti = plugin.getLabel();
  9047.             }
  9048.         }
  9049.        
  9050.         List<AttributeAuthority> aa = pdAssociata.getAttributeAuthorityList();
  9051.         List<String> attributeAuthority = new ArrayList<>();
  9052.         if(aa!=null && !aa.isEmpty()) {
  9053.             for (AttributeAuthority a : aa) {
  9054.                 attributeAuthority.add(a.getNome());
  9055.             }
  9056.         }
  9057.        
  9058.         if(de!=null) {
  9059.             this.setStatoControlloAccessi(de, true,
  9060.                     gestioneToken, gestioneTokenOpzionale, gestioneTokenPolicy, gestioneTokenConfig,
  9061.                     autenticazione,  autenticazioneOpzionale, autenticazioneCustom,
  9062.                     autorizzazione, autorizzazioneCustom, sizeApplicativi, sizeSoggetti, sizeRuoli,
  9063.                     autorizzazioneTokenPortaDelegata, autorizzazioneTokenPortaApplicativa, autorizzazioneScope,
  9064.                     autorizzazioneContenuti, protocollo,
  9065.                     attributeAuthority);
  9066.             return  null;
  9067.         }
  9068.         else {
  9069.             return this.getLabelStatoControlloAccessi(
  9070.                 true,
  9071.                 gestioneToken, gestioneTokenOpzionale, gestioneTokenPolicy, gestioneTokenConfig,
  9072.                 autenticazione,  autenticazioneOpzionale, autenticazioneCustom,
  9073.                 autorizzazione, autorizzazioneCustom, sizeApplicativi, sizeSoggetti, sizeRuoli,
  9074.                 autorizzazioneTokenPortaDelegata, autorizzazioneTokenPortaApplicativa, autorizzazioneScope,
  9075.                 autorizzazioneContenuti,
  9076.                 attributeAuthority);
  9077.         }
  9078.     }
  9079.    
  9080.     public String getStatoAutenticazionePortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  9081.        
  9082.         if(pdAssociata==null) {
  9083.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  9084.         }
  9085.        
  9086.         String autenticazione = pdAssociata.getAutenticazione();
  9087.         String autenticazioneCustom = null;
  9088.         if (autenticazione != null && !TipoAutenticazione.getValues().contains(autenticazione)) {
  9089.             autenticazioneCustom = autenticazione;
  9090.             autenticazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  9091.         }
  9092.         String autenticazioneOpzionale = "";
  9093.         if(pdAssociata.getAutenticazioneOpzionale()!=null){
  9094.             if (pdAssociata.getAutenticazioneOpzionale().equals(StatoFunzionalita.ABILITATO)) {
  9095.                 autenticazioneOpzionale = Costanti.CHECK_BOX_ENABLED;
  9096.             }
  9097.         }
  9098.         return this.getLabelStatoAutenticazione(autenticazione, autenticazioneOpzionale, autenticazioneCustom);
  9099.     }
  9100.    
  9101.     public String getStatoAutorizzazionePortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  9102.        
  9103.         if(pdAssociata==null) {
  9104.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  9105.         }
  9106.        
  9107.         String autorizzazioneContenuti = pdAssociata.getAutorizzazioneContenuto();
  9108.         String autorizzazione= null, autorizzazioneCustom = null;
  9109.         if (pdAssociata.getAutorizzazione() != null &&
  9110.                 !TipoAutorizzazione.getAllValues().contains(pdAssociata.getAutorizzazione())) {
  9111.             autorizzazioneCustom = pdAssociata.getAutorizzazione();
  9112.             autorizzazione = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM;
  9113.         }
  9114.         else{
  9115.             autorizzazione = AutorizzazioneUtilities.convertToStato(pdAssociata.getAutorizzazione());
  9116.         }
  9117.        
  9118.         return this.getLabelStatoAutorizzazione(autorizzazione, autorizzazioneContenuti, autorizzazioneCustom);
  9119.     }
  9120.    
  9121.     public String getStatoGestioneTokenPortaDelegata(PortaDelegata pdAssociata) throws DriverConfigurazioneException {
  9122.        
  9123.         if(pdAssociata==null) {
  9124.             throw new DriverConfigurazioneException("Param pdAssociata is null");
  9125.         }
  9126.        
  9127.         String gestioneToken = null;
  9128.         if(pdAssociata.getGestioneToken()!=null && pdAssociata.getGestioneToken().getPolicy()!=null &&
  9129.                 !"".equals(pdAssociata.getGestioneToken().getPolicy()) &&
  9130.                 !"-".equals(pdAssociata.getGestioneToken().getPolicy())) {
  9131.             gestioneToken = StatoFunzionalita.ABILITATO.getValue();
  9132.         }
  9133.          
  9134.         return this.getLabelStatoGestioneToken(gestioneToken);
  9135.     }
  9136.    
  9137.    
  9138.     // Stato Generico
  9139.    
  9140.     public String getLabelStatoControlloAccessi(
  9141.             boolean portaDelegata,
  9142.             String gestioneToken, String gestioneTokenOpzionale, String gestioneTokenPolicy, GestioneToken gestioneTokenConfig,
  9143.             String autenticazione, String autenticazioneOpzionale, String autenticazioneCustom,
  9144.             String autorizzazione, String autorizzazioneCustom, int sizeApplicativi, int sizeSoggetti, int sizeRuoli,
  9145.             PortaDelegataAutorizzazioneToken autorizzazioneTokenPortaDelegata, PortaApplicativaAutorizzazioneToken autorizzazioneTokenPortaApplicativa, AutorizzazioneScope autorizzazioneScope,
  9146.             String autorizzazioneContenuti,
  9147.             List<String> attributeAuthority
  9148.             ) {
  9149.        
  9150.         if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  9151.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9152.         }
  9153.        
  9154.         if(autenticazione != null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  9155.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9156.        
  9157.         if(autenticazioneOpzionale != null && ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale))
  9158.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9159.        
  9160.         if(attributeAuthority!=null && !attributeAuthority.isEmpty()) {
  9161.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9162.         }
  9163.        
  9164.         if(!AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione))
  9165.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9166.        
  9167.         if(StringUtils.isNotEmpty(autorizzazioneContenuti))
  9168.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9169.        
  9170.         return CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  9171.        
  9172.     }
  9173.    
  9174.     public void setStatoControlloAccessi(DataElement de,
  9175.             boolean portaDelegata,
  9176.             String gestioneToken, String gestioneTokenOpzionale, String gestioneTokenPolicy, GestioneToken gestioneTokenConfig,
  9177.             String autenticazione, String autenticazioneOpzionale, String autenticazioneCustom,
  9178.             String autorizzazione, String autorizzazioneCustom, int sizeApplicativi, int sizeSoggetti, int sizeRuoli,
  9179.             PortaDelegataAutorizzazioneToken autorizzazioneTokenPortaDelegata, PortaApplicativaAutorizzazioneToken autorizzazioneTokenPortaApplicativa, AutorizzazioneScope autorizzazioneScope,
  9180.             String autorizzazioneContenuti,
  9181.             String protocollo,
  9182.             List<String> attributeAuthority
  9183.             ) throws DriverControlStationException, DriverControlStationNotFound {
  9184.        
  9185.         boolean modipa = this.isProfiloModIPA(protocollo);
  9186.        
  9187.         de.setType(DataElementType.MULTI_SELECT);
  9188.        
  9189.         // gestione token
  9190.         if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  9191.            
  9192.             CheckboxStatusType statusGestioneToken = null;
  9193.            
  9194.             StringBuilder bf = new StringBuilder();
  9195.             StringBuilder bfToolTip = new StringBuilder();
  9196.             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_GESTIONE_TOKEN);
  9197.             bfToolTip.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_GESTIONE_TOKEN);
  9198.             if(ServletUtils.isCheckBoxEnabled(gestioneTokenOpzionale)) {
  9199.                 bfToolTip.append(" (").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_OPZIONALE).append(") ");
  9200.                 statusGestioneToken = CheckboxStatusType.CONFIG_WARNING;
  9201.             }
  9202.             else {
  9203.                 statusGestioneToken = CheckboxStatusType.CONFIG_ENABLE;
  9204.             }
  9205.             bfToolTip.append(": ").append(gestioneTokenPolicy);
  9206.            
  9207.             if(gestioneTokenConfig!=null && gestioneTokenConfig.getAutenticazione()!=null) {
  9208.                 StringBuilder bfTokenAuth = new StringBuilder();
  9209.                 if(StatoFunzionalita.ABILITATO.equals(gestioneTokenConfig.getAutenticazione().getIssuer())) {
  9210.                     if(bfTokenAuth.length()>0) {
  9211.                         bfTokenAuth.append(", ");
  9212.                     }
  9213.                     bfTokenAuth.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_ISSUER);
  9214.                 }
  9215.                 if(StatoFunzionalita.ABILITATO.equals(gestioneTokenConfig.getAutenticazione().getClientId())) {
  9216.                     if(bfTokenAuth.length()>0) {
  9217.                         bfTokenAuth.append(", ");
  9218.                     }
  9219.                     bfTokenAuth.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_CLIENT_ID);
  9220.                 }
  9221.                 if(StatoFunzionalita.ABILITATO.equals(gestioneTokenConfig.getAutenticazione().getSubject())) {
  9222.                     if(bfTokenAuth.length()>0) {
  9223.                         bfTokenAuth.append(", ");
  9224.                     }
  9225.                     bfTokenAuth.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_SUBJECT);
  9226.                 }
  9227.                 if(StatoFunzionalita.ABILITATO.equals(gestioneTokenConfig.getAutenticazione().getUsername())) {
  9228.                     if(bfTokenAuth.length()>0) {
  9229.                         bfTokenAuth.append(", ");
  9230.                     }
  9231.                     bfTokenAuth.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_USERNAME);
  9232.                 }
  9233.                 if(StatoFunzionalita.ABILITATO.equals(gestioneTokenConfig.getAutenticazione().getEmail())) {
  9234.                     if(bfTokenAuth.length()>0) {
  9235.                         bfTokenAuth.append(", ");
  9236.                     }
  9237.                     bfTokenAuth.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_TOKEN_MAIL);
  9238.                 }
  9239.                 if(bfTokenAuth.length()>0) {
  9240.                     bfToolTip.append("\n");
  9241.                 }
  9242.                 bfToolTip.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TOKEN_CLAIMS);
  9243.                 bfToolTip.append(": ").append(bfTokenAuth.toString());
  9244.             }
  9245.            
  9246.             de.addStatus(bfToolTip.toString(), bf.toString(), statusGestioneToken);
  9247.         }
  9248.        
  9249.         // autenticazione
  9250.         if(autenticazione != null && !TipoAutenticazione.DISABILITATO.equals(autenticazione)) {
  9251.             StringBuilder bf = new StringBuilder();
  9252.             StringBuilder bfToolTip = new StringBuilder();
  9253.             boolean opzionale = false;
  9254.             String authTrasporto = autenticazione;
  9255.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM.equals(autenticazione)) {
  9256.                 authTrasporto = autenticazioneCustom;
  9257.             }
  9258.             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE);
  9259.             bfToolTip.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE);
  9260.             if(modipa && !portaDelegata) {
  9261.                 bf.append(" ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_CANALE);
  9262.                 bfToolTip.append(" ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_CANALE);
  9263.             }
  9264.             else {
  9265.                 bf.append(" ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TRASPORTO);
  9266.                 bfToolTip.append(" ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTENTICAZIONE_TRASPORTO);
  9267.             }
  9268.             if(ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale)) {
  9269.                 bfToolTip.append(" (").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_OPZIONALE).append(") ");
  9270.                 opzionale = true;
  9271.             }
  9272.             bfToolTip.append(": ");
  9273.             if(TipoAutenticazione.contains(authTrasporto)) {
  9274.                 String labelAuth = TipoAutenticazione.toEnumConstant(authTrasporto).getLabel();
  9275.                 bf.append(" [ ").append(labelAuth).append(" ]");
  9276.                 bfToolTip.append(labelAuth);    
  9277.             }
  9278.             else {
  9279.                 //bf.append(" [ ").append(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM).append(" ]");
  9280.                 bf.append(" [ ").append(CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM).append(" '").append(authTrasporto).append("'").append(" ]");
  9281.                 bfToolTip.append(authTrasporto);
  9282.             }
  9283.            
  9284.             CheckboxStatusType statusAutenticazione = null;
  9285.             if(opzionale) {
  9286.                 statusAutenticazione =CheckboxStatusType.CONFIG_WARNING;
  9287.             }
  9288.             else {
  9289.                 statusAutenticazione = CheckboxStatusType.CONFIG_ENABLE;
  9290.             }
  9291.             de.addStatus(bfToolTip.toString(), bf.toString(), statusAutenticazione);
  9292.         }
  9293.        
  9294.         // attribute authority
  9295.         if(attributeAuthority!=null && !attributeAuthority.isEmpty()) {
  9296.             StringBuilder bf = new StringBuilder();
  9297.             StringBuilder bfToolTip = new StringBuilder();
  9298.             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY);
  9299.             bfToolTip.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_ATTRIBUTI_AUTHORITY);
  9300.             bfToolTip.append(": ").append(attributeAuthority.toString());
  9301.             de.addStatus(bfToolTip.toString(), bf.toString(), CheckboxStatusType.CONFIG_ENABLE);
  9302.         }
  9303.        
  9304.         // backward compatibility
  9305.         if(AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione) && modipa && !portaDelegata && sizeApplicativi>0) {
  9306.             // autorizzazione sicurezza messaggio
  9307.             autorizzazione = AutorizzazioneUtilities.STATO_ABILITATO;
  9308.         }
  9309.            
  9310.        
  9311.         // autorizzazione
  9312.         if(!AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione)) {
  9313.            
  9314.             StringBuilder bf = new StringBuilder();
  9315.             StringBuilder bfToolTip = new StringBuilder();
  9316.             StringBuilder bfToolTipNotValid = new StringBuilder();
  9317.             int rowsToolTip = 0;
  9318.            
  9319.             Boolean validPuntuale = null;
  9320.             if(TipoAutorizzazione.isAuthenticationRequired(autorizzazione)) {
  9321.                 if(bf.length()>0) {
  9322.                     bf.append(",");
  9323.                 }
  9324.                 if(bf.length()<=0) {
  9325.                     if(modipa && !portaDelegata) {
  9326.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE);
  9327.                     }
  9328.                     else {
  9329.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TRASPORTO);
  9330.                     }
  9331.                     bf.append(" [ ");
  9332.                 }
  9333.                 bf.append(" ");
  9334.                 bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SERVIZI_APPLICATIVI_SUFFIX);
  9335.            
  9336.                 if(modipa && !portaDelegata) {
  9337.                     validPuntuale = sizeSoggetti>0;
  9338.                 }
  9339.                 else {
  9340.                     validPuntuale = sizeApplicativi>0 || sizeSoggetti>0;
  9341.                 }
  9342.                
  9343.                 if(validPuntuale) {
  9344.                     rowsToolTip++;
  9345.                     if(bfToolTip.length()>0) {
  9346.                         bfToolTip.append("\n");
  9347.                     }
  9348.                     bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SERVIZI_APPLICATIVI_SUFFIX);
  9349.                     if(!portaDelegata) {
  9350.                         bfToolTip.append(" ").append(CostantiControlStation.LABEL_SOGGETTI).append(" (").append(sizeSoggetti).append(")");
  9351.                     }
  9352.                     if(!modipa || portaDelegata) {
  9353.                         if(!portaDelegata) {
  9354.                             bfToolTip.append(",");
  9355.                         }
  9356.                         bfToolTip.append(" ").append(CostantiControlStation.LABEL_APPLICATIVI).append(" (").append(sizeApplicativi).append(")");
  9357.                     }
  9358.                 }
  9359.                 else {
  9360.                     if(bfToolTipNotValid.length()>0) {
  9361.                         bfToolTipNotValid.append("\n");
  9362.                     }
  9363.                     if(!modipa || portaDelegata) {
  9364.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_TRASPORTO_NO_FRUITORI);
  9365.                     }
  9366.                     else {
  9367.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_CANALE_NO_FRUITORI);
  9368.                     }
  9369.                 }
  9370.             }
  9371.            
  9372.             Boolean validRuoli = null;
  9373.             if(TipoAutorizzazione.isRolesRequired(autorizzazione)) {
  9374.                 if(bf.length()>0) {
  9375.                     bf.append(",");
  9376.                 }
  9377.                 if(bf.length()<=0) {
  9378.                     if(modipa && !portaDelegata) {
  9379.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE);
  9380.                     }
  9381.                     else {
  9382.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TRASPORTO);
  9383.                     }
  9384.                     bf.append(" [ ");
  9385.                 }
  9386.                 bf.append(" ");
  9387.                 bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_SUFFIX);
  9388.                
  9389.                 validRuoli = sizeRuoli>0;
  9390.                
  9391.                 if(validRuoli) {
  9392.                     rowsToolTip++;
  9393.                     if(bfToolTip.length()>0) {
  9394.                         bfToolTip.append("\n");
  9395.                     }
  9396.                     bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_SUFFIX);
  9397.                     bfToolTip.append(" (").append(sizeRuoli).append(")");
  9398.                 }
  9399.                 else {
  9400.                     if(bfToolTipNotValid.length()>0) {
  9401.                         bfToolTipNotValid.append("\n");
  9402.                     }
  9403.                     if(!modipa || portaDelegata) {
  9404.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_TRASPORTO_NO_RUOLI);
  9405.                     }
  9406.                     else {
  9407.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_CANALE_NO_RUOLI);
  9408.                     }
  9409.                 }
  9410.             }
  9411.            
  9412.             if(bf.length()>0) {
  9413.                
  9414.                 bf.append(" ]");
  9415.                
  9416.                 CheckboxStatusType statusAutorizzazione = null;
  9417.                 String tooltip = null;
  9418.                
  9419.                 if(bfToolTipNotValid.length()>0) {
  9420.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ERROR;
  9421.                     tooltip = bfToolTipNotValid.toString();
  9422.                 }
  9423.                 else {
  9424.                     if(bfToolTip.length()>0) {
  9425.                         if(modipa && !portaDelegata) {
  9426.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE;
  9427.                         }
  9428.                         else {
  9429.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TRASPORTO;
  9430.                         }
  9431.                         if(rowsToolTip>0) {
  9432.                             tooltip+="\n";
  9433.                         }
  9434.                         tooltip+=bfToolTip.toString();
  9435.                     }
  9436.                    
  9437.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ENABLE;
  9438.                 }
  9439.                
  9440.                 de.addStatus(tooltip, bf.toString(), statusAutorizzazione);
  9441.             }
  9442.            
  9443.            
  9444.             bf = new StringBuilder();
  9445.             bfToolTip = new StringBuilder();
  9446.             bfToolTipNotValid = new StringBuilder();
  9447.             rowsToolTip = 0;
  9448.            
  9449.             validPuntuale = null;
  9450.             boolean richiedenteToken = false;
  9451.             if(modipa && !portaDelegata) {
  9452.                 richiedenteToken = (autorizzazioneTokenPortaApplicativa!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaApplicativa.getAutorizzazioneApplicativi()));
  9453.             }
  9454.             else if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  9455.                 richiedenteToken = portaDelegata ?
  9456.                         (autorizzazioneTokenPortaDelegata!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaDelegata.getAutorizzazioneApplicativi()))
  9457.                         :
  9458.                             (autorizzazioneTokenPortaApplicativa!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaApplicativa.getAutorizzazioneApplicativi()));
  9459.             }
  9460.             // backward compatibility
  9461.             if(!richiedenteToken && modipa && !portaDelegata && sizeApplicativi>0) {
  9462.                 richiedenteToken = true;
  9463.             }
  9464.             if(richiedenteToken) {
  9465.                 if(bf.length()>0) {
  9466.                     bf.append(",");
  9467.                 }
  9468.                 if(bf.length()<=0) {
  9469.                     if(modipa && !portaDelegata) {
  9470.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO);
  9471.                     }
  9472.                     else {
  9473.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN);
  9474.                     }
  9475.                     bf.append(" [ ");
  9476.                 }
  9477.                 bf.append(" ");
  9478.                 bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SERVIZI_APPLICATIVI_SUFFIX);
  9479.            
  9480.                 if(modipa && !portaDelegata) {
  9481.                     validPuntuale = sizeApplicativi>0;
  9482.                 }
  9483.                 else {
  9484.                     if(portaDelegata) {
  9485.                         validPuntuale = autorizzazioneTokenPortaDelegata.getServiziApplicativi()!=null && autorizzazioneTokenPortaDelegata.getServiziApplicativi().sizeServizioApplicativoList()>0;
  9486.                     }
  9487.                     else {
  9488.                         validPuntuale = autorizzazioneTokenPortaApplicativa.getServiziApplicativi()!=null && autorizzazioneTokenPortaApplicativa.getServiziApplicativi().sizeServizioApplicativoList()>0;
  9489.                     }
  9490.                 }
  9491.                 if(validPuntuale) {
  9492.                     rowsToolTip++;
  9493.                     if(bfToolTip.length()>0) {
  9494.                         bfToolTip.append("\n");
  9495.                     }
  9496.                     bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SERVIZI_APPLICATIVI_SUFFIX);
  9497.                     int size = 0;
  9498.                     if(modipa && !portaDelegata) {
  9499.                         size = sizeApplicativi;
  9500.                     }
  9501.                     else {
  9502.                         if(portaDelegata) {
  9503.                             size = autorizzazioneTokenPortaDelegata.getServiziApplicativi().sizeServizioApplicativoList();
  9504.                         }
  9505.                         else {
  9506.                             size = autorizzazioneTokenPortaApplicativa.getServiziApplicativi().sizeServizioApplicativoList();
  9507.                         }
  9508.                     }
  9509.                     bfToolTip.append(" ").append(CostantiControlStation.LABEL_APPLICATIVI).append(" (").append(size).append(")");
  9510.                 }
  9511.                 else {
  9512.                     if(bfToolTipNotValid.length()>0) {
  9513.                         bfToolTipNotValid.append("\n");
  9514.                     }
  9515.                     if(!modipa || portaDelegata) {
  9516.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_TOKEN_NO_FRUITORI);
  9517.                     }
  9518.                     else {
  9519.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_MESSAGGIO_NO_FRUITORI);
  9520.                     }
  9521.                 }
  9522.             }
  9523.            
  9524.             validRuoli = null;
  9525.             boolean ruoliToken = false;
  9526.             if(modipa && !portaDelegata) {
  9527.                 ruoliToken = (autorizzazioneTokenPortaApplicativa!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaApplicativa.getAutorizzazioneRuoli()));
  9528.             }
  9529.             else if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  9530.                 ruoliToken = portaDelegata ?
  9531.                         (autorizzazioneTokenPortaDelegata!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaDelegata.getAutorizzazioneRuoli()))
  9532.                         :
  9533.                         (autorizzazioneTokenPortaApplicativa!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneTokenPortaApplicativa.getAutorizzazioneRuoli()));
  9534.             }
  9535.             if(ruoliToken) {
  9536.                 if(bf.length()>0) {
  9537.                     bf.append(",");
  9538.                 }
  9539.                 if(bf.length()<=0) {
  9540.                     if(modipa && !portaDelegata) {
  9541.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO);
  9542.                     }
  9543.                     else {
  9544.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN);
  9545.                     }
  9546.                     bf.append(" [ ");
  9547.                 }
  9548.                 bf.append(" ");
  9549.                 bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_SUFFIX);
  9550.                
  9551.                 if(portaDelegata) {
  9552.                     validRuoli = autorizzazioneTokenPortaDelegata.getRuoli()!=null && autorizzazioneTokenPortaDelegata.getRuoli().sizeRuoloList()>0;
  9553.                 }
  9554.                 else {
  9555.                     validRuoli = autorizzazioneTokenPortaApplicativa.getRuoli()!=null && autorizzazioneTokenPortaApplicativa.getRuoli().sizeRuoloList()>0;
  9556.                 }
  9557.                
  9558.                 if(validRuoli) {
  9559.                     rowsToolTip++;
  9560.                     if(bfToolTip.length()>0) {
  9561.                         bfToolTip.append("\n");
  9562.                     }
  9563.                     bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_RUOLI_SUFFIX);
  9564.                     int size = 0;
  9565.                     if(portaDelegata) {
  9566.                         size = autorizzazioneTokenPortaDelegata.getRuoli().sizeRuoloList();
  9567.                     }
  9568.                     else {
  9569.                         size = autorizzazioneTokenPortaApplicativa.getRuoli().sizeRuoloList();
  9570.                     }
  9571.                     bfToolTip.append(" (").append(size).append(")");
  9572.                 }
  9573.                 else {
  9574.                     if(bfToolTipNotValid.length()>0) {
  9575.                         bfToolTipNotValid.append("\n");
  9576.                     }
  9577.                     if(!modipa || portaDelegata) {
  9578.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_TOKEN_NO_RUOLI);
  9579.                     }
  9580.                     else {
  9581.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_MESSAGGIO_NO_RUOLI);
  9582.                     }
  9583.                 }
  9584.             }
  9585.            
  9586.             Boolean validScopes = null;
  9587.             if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  9588.                 if(autorizzazioneScope!=null && StatoFunzionalita.ABILITATO.equals(autorizzazioneScope.getStato())) {
  9589.                     if(bf.length()>0) {
  9590.                         bf.append(",");
  9591.                     }
  9592.                     if(bf.length()<=0) {
  9593.                         if(modipa && !portaDelegata) {
  9594.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO);
  9595.                         }
  9596.                         else {
  9597.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN);
  9598.                         }
  9599.                         bf.append(" [ ");
  9600.                     }
  9601.                     bf.append(" ");
  9602.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SCOPE_SUFFIX);
  9603.                    
  9604.                     validScopes = autorizzazioneScope.sizeScopeList()>0;
  9605.                    
  9606.                     if(validScopes) {
  9607.                         rowsToolTip++;
  9608.                         if(bfToolTip.length()>0) {
  9609.                             bfToolTip.append("\n");
  9610.                         }
  9611.                         bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_SCOPE_SUFFIX);
  9612.                         bfToolTip.append(" (").append(autorizzazioneScope.sizeScopeList()).append(")");
  9613.                     }
  9614.                     else {
  9615.                         if(bfToolTipNotValid.length()>0) {
  9616.                             bfToolTipNotValid.append("\n");
  9617.                         }
  9618.                         bfToolTipNotValid.append(ErogazioniCostanti.ASPS_EROGAZIONI_ICONA_STATO_CONFIGURAZIONI_CONTROLLO_ACCESSO_AUTORIZZAZIONE_TOKEN_NO_SCOPE);
  9619.                     }
  9620.                 }
  9621.                 if(gestioneTokenConfig!=null && gestioneTokenConfig.getOptions()!=null && !"".equals(gestioneTokenConfig.getOptions())) {
  9622.                     if(bf.length()>0) {
  9623.                         bf.append(",");
  9624.                     }
  9625.                     if(bf.length()<=0) {
  9626.                         if(modipa && !portaDelegata) {
  9627.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE);
  9628.                         }
  9629.                         else {
  9630.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN);
  9631.                         }
  9632.                         bf.append(" [ ");
  9633.                     }
  9634.                     bf.append(" ");
  9635.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_CLAIMS_SUBTITLE_SUFFIX);
  9636.                    
  9637.                     rowsToolTip++;
  9638.                     if(bfToolTip.length()>0) {
  9639.                         bfToolTip.append("\n");
  9640.                     }
  9641.                     String [] tmp = gestioneTokenConfig.getOptions().split("\n");
  9642.                     bfToolTip.append("- ").append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_TOKEN_CLAIMS_SUBTITLE_SUFFIX);
  9643.                     bfToolTip.append(" (").append(tmp!=null ? tmp.length : 0).append(")");
  9644.                 }
  9645.             }
  9646.            
  9647.             if(bf.length()>0) {
  9648.                
  9649.                 bf.append(" ]");
  9650.                
  9651.                 CheckboxStatusType statusAutorizzazione = null;
  9652.                 String tooltip = null;
  9653.                
  9654.                 if(bfToolTipNotValid.length()>0) {
  9655.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ERROR;
  9656.                     tooltip = bfToolTipNotValid.toString();
  9657.                 }
  9658.                 else {
  9659.                     if(bfToolTip.length()>0) {
  9660.                         if(modipa && !portaDelegata) {
  9661.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_MESSAGGIO;
  9662.                         }
  9663.                         else {
  9664.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_TOKEN;
  9665.                         }
  9666.                         if(rowsToolTip>0) {
  9667.                             tooltip+="\n";
  9668.                         }
  9669.                         tooltip+=bfToolTip.toString();
  9670.                     }
  9671.                    
  9672.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ENABLE;
  9673.                 }
  9674.                
  9675.                 de.addStatus(tooltip, bf.toString(), statusAutorizzazione);
  9676.             }
  9677.            
  9678.            
  9679.             bf = new StringBuilder();
  9680.             bfToolTip = new StringBuilder();
  9681.             bfToolTipNotValid = new StringBuilder();
  9682.             rowsToolTip = 0;
  9683.            
  9684.             if(TipoAutorizzazione.isXacmlPolicyRequired(autorizzazione)) {
  9685.                 if(bf.length()>0) {
  9686.                     bf.append(",");
  9687.                 }
  9688.                 if(bf.length()<=0) {
  9689.                     if(modipa && !portaDelegata) {
  9690.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE);
  9691.                     }
  9692.                     else {
  9693.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_DIFFERENTE_DA_TRASPORTO_E_TOKEN);
  9694.                     }
  9695.                     bf.append(" [ ");
  9696.                 }
  9697.                 bf.append(" ");
  9698.                 bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_XACML_SUFFIX);
  9699.             }
  9700.            
  9701.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM.equals(autorizzazione)) {
  9702.                 if(bf.length()>0) {
  9703.                     bf.append(",");
  9704.                 }
  9705.                 if(bf.length()<=0) {
  9706.                     if(modipa && !portaDelegata) {
  9707.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE);
  9708.                     }
  9709.                     else {
  9710.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_DIFFERENTE_DA_TRASPORTO_E_TOKEN);
  9711.                     }
  9712.                     bf.append(" [ ");
  9713.                 }
  9714.                 bf.append(" ");
  9715.                 bf.append(CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM).append(" '").append(autorizzazioneCustom).append("'");
  9716.                 //bf.append(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM);
  9717.                 bfToolTip.append(": ").append(autorizzazioneCustom);
  9718.             }
  9719.            
  9720.             if(bf.length()>0) {
  9721.                                
  9722.                 bf.append(" ]");
  9723.                
  9724.                 CheckboxStatusType statusAutorizzazione = null;
  9725.                 String tooltip = null;
  9726.                
  9727.                 if(bfToolTipNotValid.length()>0) {
  9728.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ERROR;
  9729.                     tooltip = bfToolTipNotValid.toString();
  9730.                 }
  9731.                 else {
  9732.                     if(bfToolTip.length()>0) {
  9733.                         if(modipa && !portaDelegata) {
  9734.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CANALE;
  9735.                         }
  9736.                         else {
  9737.                             tooltip = CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_DIFFERENTE_DA_TRASPORTO_E_TOKEN;
  9738.                         }
  9739.                         if(rowsToolTip>0) {
  9740.                             tooltip+="\n";
  9741.                         }
  9742.                         tooltip+=bfToolTip.toString();
  9743.                     }
  9744.                    
  9745.                     statusAutorizzazione = CheckboxStatusType.CONFIG_ENABLE;
  9746.                 }
  9747.                
  9748.                 de.addStatus(tooltip, bf.toString(), statusAutorizzazione);
  9749.             }
  9750.         }
  9751.                
  9752.         // autorizzazione contenuti
  9753.         if(StringUtils.isNotEmpty(autorizzazioneContenuti)) {
  9754.             StringBuilder bf = new StringBuilder();
  9755.             StringBuilder bfToolTip = new StringBuilder();
  9756.             bf.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI);
  9757.             bfToolTip.append(CostantiControlStation.LABEL_PARAMETRO_PORTE_CONTROLLO_ACCESSI_AUTORIZZAZIONE_CONTENUTI);
  9758.             if(!CostantiAutorizzazione.AUTORIZZAZIONE_CONTENUTO_BUILT_IN.equals(autorizzazioneContenuti)) {
  9759.                 //bf.append(" [ ").append(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM).append(" ]");
  9760.                 bf.append(" [ ").append(CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTORIZZAZIONE_CUSTOM).append(" '").append(autorizzazioneContenuti).append("'").append(" ]");
  9761.                 bfToolTip.append(": ").append(autorizzazioneContenuti);
  9762.             }
  9763.             de.addStatus(bfToolTip.toString(), bf.toString(), CheckboxStatusType.CONFIG_ENABLE);
  9764.         }
  9765.        
  9766.         if(de.getStatusValuesAsList()==null || de.getStatusValuesAsList().size()<=0) {
  9767.             de.addStatus(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO),CheckboxStatusType.CONFIG_DISABLE);
  9768.         }
  9769.        
  9770.     }
  9771.    
  9772.     public void setStatoRateLimiting(DataElement de, List<AttivazionePolicy> listaPolicy) throws DriverControlStationException, DriverControlStationNotFound {
  9773.         setStatoRateLimiting(de, listaPolicy, true);
  9774.     }
  9775.     public void setStatoRateLimiting(DataElement de, List<AttivazionePolicy> listaPolicy, boolean upperFirstChar) throws DriverControlStationException, DriverControlStationNotFound {
  9776.         de.setType(DataElementType.CHECKBOX);
  9777.         if(listaPolicy!=null && listaPolicy.size()>0) {
  9778.             Map<String, Integer> mapActive = new HashMap<>();
  9779.             Map<String, Integer> mapWarningOnly = new HashMap<>();
  9780.             for (AttivazionePolicy attivazionePolicy : listaPolicy) {
  9781.                 if(attivazionePolicy.getEnabled()==false) {
  9782.                     continue;
  9783.                 }
  9784.                 ConfigurazionePolicy policy = this.confCore.getConfigurazionePolicy(attivazionePolicy.getIdPolicy());
  9785.                 String risorsa = policy.getRisorsa();
  9786.                 boolean richiesteSimultanee = policy.isSimultanee();
  9787.                 if(richiesteSimultanee) {
  9788.                     risorsa = risorsa + "Simultanee";
  9789.                 }
  9790.                
  9791.                 Integer count = null;
  9792.                 if(attivazionePolicy.isWarningOnly()) {
  9793.                     if(mapWarningOnly.containsKey(risorsa)){
  9794.                         count = mapWarningOnly.remove(risorsa);
  9795.                     }
  9796.                     else {
  9797.                         count = 0;
  9798.                     }
  9799.                 }
  9800.                 else {
  9801.                     if(mapActive.containsKey(risorsa)){
  9802.                         count = mapActive.remove(risorsa);
  9803.                     }
  9804.                     else {
  9805.                         count = 0;
  9806.                     }
  9807.                 }
  9808.                 count ++;
  9809.                 if(attivazionePolicy.isWarningOnly()) {
  9810.                     mapWarningOnly.put(risorsa, count);
  9811.                 }
  9812.                 else {
  9813.                     mapActive.put(risorsa, count);  
  9814.                 }
  9815.             }
  9816.            
  9817.             if(mapActive.size()>0 && mapWarningOnly.size()>0) {
  9818.                 de.setType(DataElementType.MULTI_SELECT);
  9819.             }
  9820.            
  9821.             if(mapActive.size()>0 || mapWarningOnly.size()>0) {
  9822.                
  9823.                 if(mapActive.size()>0) {
  9824.                     StringBuilder bf = new StringBuilder();
  9825.                     for (String risorsa : mapActive.keySet()) {
  9826.                         Integer count = mapActive.get(risorsa);
  9827.                         if(bf.length()>0) {
  9828.                             bf.append(", ");
  9829.                         }
  9830.                         bf.append(risorsa);
  9831.                         if(count>1) {
  9832.                             bf.append("(").append(count).append(")");
  9833.                         }
  9834.                     }
  9835.                     String vAbilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO) : CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9836.                     if(bf.length()>0 && bf.length()<CostantiControlStation.MAX_LENGTH_VALORE_STATO_RATE_LIMITING) {
  9837.                         String value = vAbilitato+" [ "+bf.toString()+" ]";
  9838.                         de.addStatus(value, CheckboxStatusType.CONFIG_ENABLE);
  9839.                     }
  9840.                     else {
  9841.                         String value = vAbilitato;
  9842.                         de.addStatus(bf.toString(), value, CheckboxStatusType.CONFIG_ENABLE);
  9843.                     }
  9844.                 }
  9845.                
  9846.                 if(mapWarningOnly.size()>0) {
  9847.                     StringBuilder bf = new StringBuilder();
  9848.                     for (String risorsa : mapWarningOnly.keySet()) {
  9849.                         Integer count = mapWarningOnly.get(risorsa);
  9850.                         if(bf.length()>0) {
  9851.                             bf.append(", ");
  9852.                         }
  9853.                         bf.append(risorsa);
  9854.                         if(count>1) {
  9855.                             bf.append("(").append(count).append(")");
  9856.                         }
  9857.                     }
  9858.                     String vWarningOnly = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_WARNING_ONLY) : CostantiControlStation.DEFAULT_VALUE_WARNING_ONLY;
  9859.                     if(bf.length()>0 && bf.length()<CostantiControlStation.MAX_LENGTH_VALORE_STATO_RATE_LIMITING) {
  9860.                         String value = vWarningOnly+" [ "+bf.toString()+" ]";
  9861.                         de.addStatus(value, CheckboxStatusType.CONFIG_WARNING);
  9862.                     }
  9863.                     else {
  9864.                         String value = vWarningOnly;
  9865.                         de.addStatus(bf.toString(), value, CheckboxStatusType.CONFIG_WARNING);
  9866.                     }
  9867.                 }
  9868.                
  9869.             }
  9870.             else {
  9871.                 de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  9872.                 String vDisable = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) :  CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  9873.                 de.setStatusValue(vDisable);
  9874.                 de.setStatusToolTip("Sull'API sono registrate "+listaPolicy.size()+" politiche di Rate Limiting tutte con stato disabilitato");
  9875.             }
  9876.            
  9877.         }
  9878.         else {
  9879.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  9880.             String vDisable = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) :  CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  9881.             de.setStatusValue(vDisable);
  9882.         }
  9883.     }
  9884.    
  9885.     public void setStatoValidazioneContenuti(DataElement de, ValidazioneContenutiApplicativi val, FormatoSpecifica formatoSpecifica) throws DriverControlStationException, DriverControlStationNotFound {
  9886.         de.setType(DataElementType.CHECKBOX);
  9887.         if(val!=null && !StatoFunzionalitaConWarning.DISABILITATO.equals(val.getStato())) {
  9888.             String valore = null;
  9889.             if(StatoFunzionalitaConWarning.ABILITATO.equals(val.getStato())) {
  9890.                 de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
  9891.                 valore = CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  9892.             }
  9893.             else {
  9894.                 de.setStatusType(CheckboxStatusType.CONFIG_WARNING);
  9895.                 valore = CostantiControlStation.DEFAULT_VALUE_WARNING_ONLY;
  9896.             }
  9897.             String label = null;
  9898.             switch (val.getTipo()) {
  9899.             case INTERFACE:
  9900.                 switch (formatoSpecifica) {
  9901.                 case OPEN_API_3:
  9902.                     label=CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_OPEN_API_3;
  9903.                     break;
  9904.                 case SWAGGER_2:
  9905.                     label=CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_SWAGGER_2;
  9906.                     break;
  9907.                 case WADL:
  9908.                     label=CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WADL;
  9909.                     break;
  9910.                 case WSDL_11:
  9911.                     label=CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WSDL_11;
  9912.                     break;
  9913.                 }
  9914.                 break;
  9915.             case XSD:
  9916.                 label=CostantiControlStation.LABEL_PARAMETRO_SCHEMI_XSD;
  9917.                 break;
  9918.             case OPENSPCOOP:
  9919.                 label=CostantiControlStation.LABEL_PARAMETRO_REGISTRO_OPENSPCOOP;
  9920.                 break;
  9921.             }
  9922.             de.setStatusValue(this.getUpperFirstChar(valore)+" [ "+label+" ]");
  9923.         }
  9924.         else {
  9925.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  9926.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  9927.         }
  9928.     }
  9929.    
  9930.     public void setStatoGestioneCORS(DataElement de, CorsConfigurazione ccPorta, Configurazione configurazioneGenerale) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  9931.        
  9932.         de.setType(DataElementType.CHECKBOX);
  9933.        
  9934.         CheckboxStatusType statusType = null;
  9935.         String statusValue = null;
  9936.         String statusTooltip = null;
  9937.        
  9938.         if (ccPorta == null) {
  9939.            
  9940.             CorsConfigurazione cc = configurazioneGenerale.getGestioneCors();
  9941.             if(cc==null || cc.getStato()==null || StatoFunzionalita.DISABILITATO.equals(cc.getStato())) {
  9942.                 statusType = CheckboxStatusType.CONFIG_DISABLE;
  9943.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  9944.             }
  9945.             else {
  9946.                 statusType = CheckboxStatusType.CONFIG_ENABLE;
  9947.                 if(TipoGestioneCORS.GATEWAY.equals(cc.getTipo())) {
  9948.                     statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO);
  9949.                 }
  9950.                 else {
  9951.                     statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO)+" [ "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_TIPO_GESTITO_APPLICATIVO_DEMANDATO+" ]";
  9952.                 }
  9953.             }
  9954.            
  9955.             statusTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_DEFAULT;
  9956.            
  9957.         } else {
  9958.            
  9959.             if(ccPorta.getStato()==null || StatoFunzionalita.DISABILITATO.equals(ccPorta.getStato())) {
  9960.                 statusType = CheckboxStatusType.CONFIG_DISABLE;
  9961.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  9962.             }
  9963.             else {
  9964.                 statusType = CheckboxStatusType.CONFIG_ENABLE;
  9965.                 if(TipoGestioneCORS.GATEWAY.equals(ccPorta.getTipo())) {
  9966.                     statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO);
  9967.                 }
  9968.                 else {
  9969.                     statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO)+" [ "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_TIPO_GESTITO_APPLICATIVO_DEMANDATO+" ]";
  9970.                 }
  9971.             }
  9972.            
  9973.             statusTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_RIDEFINITA;
  9974.         }
  9975.        
  9976.         de.setStatusType(statusType);
  9977.         de.setStatusValue(statusValue);
  9978.         de.setStatusToolTip(statusTooltip);
  9979.     }

  9980.     public CanaleConfigurazione getCanaleDefault(List<CanaleConfigurazione> canaleList) throws DriverConfigurazioneNotFound {
  9981.         CanaleConfigurazione canaleConfigurazioneDefault = null;
  9982.         if(canaleList!=null && !canaleList.isEmpty()) {
  9983.             for (CanaleConfigurazione c : canaleList) {
  9984.                 if(c.isCanaleDefault()) {
  9985.                     canaleConfigurazioneDefault = c;
  9986.                     break;
  9987.                 }
  9988.             }
  9989.         }
  9990.         if(canaleConfigurazioneDefault==null) {
  9991.             throw new DriverConfigurazioneNotFound("Canale di default non trovato nella lista fornita '"+canaleList+"'");
  9992.         }
  9993.         return canaleConfigurazioneDefault;
  9994.     }
  9995.    
  9996.     public void setStatoCanale(DataElement de, String canaleNome, List<CanaleConfigurazione> canaleList) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  9997.         de.setType(DataElementType.TEXT);
  9998.        
  9999.         String canaleTooltip;
  10000.         if(canaleNome == null) { // default
  10001.             CanaleConfigurazione canaleConfigurazioneDefault = getCanaleDefault(canaleList);
  10002.             canaleNome =  canaleConfigurazioneDefault.getNome();
  10003.             canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_DEFAULT;
  10004.         } else {
  10005.             canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_RIDEFINITO_API;
  10006.         }
  10007.        
  10008.         de.setValue(canaleNome);
  10009.         de.setToolTip(canaleTooltip);
  10010.     }
  10011.     public void setStatoCanalePorta(DataElement de, String canaleNome, String canaleAPINome,  List<CanaleConfigurazione> canaleList, boolean erogazione) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10012.        
  10013.         de.setType(DataElementType.TEXT);
  10014.        
  10015.         String canaleTooltip;
  10016.         if(canaleNome == null) { // default
  10017.             if(canaleAPINome == null) { // default sistema
  10018.                 CanaleConfigurazione canaleConfigurazioneDefault = getCanaleDefault(canaleList);
  10019.                 canaleNome =  canaleConfigurazioneDefault.getNome();
  10020.                 canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_DEFAULT;
  10021.             } else { // default API
  10022.                 canaleNome = canaleAPINome;
  10023.                 canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_DEFAULT_API;
  10024.             }
  10025.         } else {
  10026.             if(erogazione) {
  10027.                 canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_RIDEFINITO_EROGAZIONE;
  10028.             }
  10029.             else {
  10030.                 canaleTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE_RIDEFINITO_FRUIZIONE;
  10031.             }
  10032.         }
  10033.        
  10034.         de.setValue(canaleNome);
  10035.         de.setToolTip(canaleTooltip);
  10036.     }
  10037.    
  10038.     public void setStatoAllarmi(DataElement de, List<ConfigurazioneAllarmeBean> listaAllarmi) throws DriverControlStationException, DriverControlStationNotFound, UtilsException {
  10039.         if(this.confCore.isShowAllarmiElenchiStatiAllarmi()) {
  10040.             setStatoAllarmi_showStati(de, listaAllarmi);
  10041.         }
  10042.         else {
  10043.             setStatoAllarmi_showTipi(de, listaAllarmi);
  10044.         }
  10045.     }
  10046.     public void setStatoAllarmi_showStati(DataElement de, List<ConfigurazioneAllarmeBean> listaAllarmi) throws DriverControlStationException, DriverControlStationNotFound {
  10047.        
  10048.         de.setType(DataElementType.CHECKBOX);
  10049.         if(listaAllarmi!=null && listaAllarmi.size()>0) {
  10050.             Integer countOk = 0;
  10051.             Integer countError = 0;
  10052.             Integer countWarn = 0;
  10053.            
  10054.             for (ConfigurazioneAllarmeBean allarme : listaAllarmi) {
  10055.                 if(allarme.getEnabled() == 0) {// skip dei disabilitati
  10056.                     continue;
  10057.                 }
  10058.                
  10059.                 StatoAllarme statoAllarme = AllarmiConverterUtils.toStatoAllarme(allarme.getStato());
  10060.                 switch (statoAllarme) {
  10061.                 case OK:
  10062.                     countOk ++;
  10063.                     break;
  10064.                 case WARNING:
  10065.                     countWarn ++;
  10066.                     break;
  10067.                 case ERROR:
  10068.                     countError ++;
  10069.                     break;
  10070.                 }
  10071.             }
  10072.            
  10073.             int multi = 0;
  10074.            
  10075.             if(countOk > 0)
  10076.                 multi++;
  10077.            
  10078.             if(countError > 0)
  10079.                 multi++;
  10080.            
  10081.             if(countWarn > 0)
  10082.                 multi++;
  10083.            
  10084.             if(multi > 1) {
  10085.                 de.setType(DataElementType.MULTI_SELECT);
  10086.             }
  10087.            
  10088.             if(countOk > 0 || countError > 0 || countWarn > 0) {
  10089.                
  10090.                 if(countOk > 0) {
  10091.                     StringBuilder bf = new StringBuilder();
  10092.                     bf.append(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
  10093.                     bf.append(" (").append(countOk).append(")");
  10094.                     de.addStatus(bf.toString(), CheckboxStatusType.CONFIG_ENABLE);
  10095.                 }
  10096.                
  10097.                 if(countWarn > 0) {
  10098.                     StringBuilder bf = new StringBuilder();
  10099.                     bf.append(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
  10100.                     bf.append(" (").append(countWarn).append(")");
  10101.                     de.addStatus(bf.toString(), CheckboxStatusType.CONFIG_WARNING);
  10102.                 }
  10103.                
  10104.                 if(countError > 0) {
  10105.                     StringBuilder bf = new StringBuilder();
  10106.                     bf.append(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
  10107.                     bf.append(" (").append(countError).append(")");
  10108.                     de.addStatus(bf.toString(), CheckboxStatusType.CONFIG_ERROR);
  10109.                 }
  10110.             }
  10111.             else {
  10112.                 de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10113.                 de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10114.                 de.setStatusToolTip("Sull'API sono registrati "+listaAllarmi.size()+" allarmi tutti con stato disabilitato");
  10115.             }
  10116.            
  10117.         }
  10118.         else {
  10119.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10120.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10121.         }
  10122.     }
  10123.     public void setStatoAllarmi_showTipi(DataElement de, List<ConfigurazioneAllarmeBean> listaAllarmi) throws DriverControlStationException, DriverControlStationNotFound {
  10124.         de.setType(DataElementType.CHECKBOX);
  10125.         if(listaAllarmi!=null && listaAllarmi.size()>0) {
  10126.             Map<String, Integer> mapActive = new HashMap<>();
  10127.             for (ConfigurazioneAllarmeBean allarme : listaAllarmi) {
  10128.                 if(allarme.getEnabled().intValue()==0) {
  10129.                     continue;
  10130.                 }
  10131.                 //String tipoPlugin = allarme.getPlugin().getLabel();
  10132.                 String tipoPlugin = allarme.getPlugin().getTipo(); // più compatto
  10133.                
  10134.                 Integer count = null;
  10135.                 if(mapActive.containsKey(tipoPlugin)){
  10136.                     count = mapActive.remove(tipoPlugin);
  10137.                 }
  10138.                 else {
  10139.                     count = 0;
  10140.                 }
  10141.                 count ++;
  10142.                 mapActive.put(tipoPlugin, count);  
  10143.             }
  10144.            
  10145.             if(mapActive.size()>0) {
  10146.                
  10147.                 if(mapActive.size()>0) {
  10148.                     StringBuilder bf = new StringBuilder();
  10149.                     for (String risorsa : mapActive.keySet()) {
  10150.                         Integer count = mapActive.get(risorsa);
  10151.                         if(bf.length()>0) {
  10152.                             bf.append(", ");
  10153.                         }
  10154.                         bf.append(risorsa);
  10155.                         if(count>1) {
  10156.                             bf.append("(").append(count).append(")");
  10157.                         }
  10158.                     }
  10159.                     if(bf.length()>0 && bf.length()<CostantiControlStation.MAX_LENGTH_VALORE_STATO_ALLARMI) {
  10160.                         String value = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO)+" [ "+bf.toString()+" ]";
  10161.                         de.addStatus(value, CheckboxStatusType.CONFIG_ENABLE);
  10162.                     }
  10163.                     else {
  10164.                         String value = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO);
  10165.                         de.addStatus(bf.toString(), value, CheckboxStatusType.CONFIG_ENABLE);
  10166.                     }
  10167.                 }
  10168.                
  10169.             }
  10170.             else {
  10171.                 de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10172.                 de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10173.                 de.setStatusToolTip("Sull'API sono registrati "+listaAllarmi.size()+" allarmi tutti con stato disabilitato");
  10174.             }
  10175.            
  10176.         }
  10177.         else {
  10178.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10179.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10180.         }
  10181.     }
  10182.    
  10183.    
  10184.     public void setStatoOpzioniAvanzatePortaDelegataDefault(DataElement de, String options) throws DriverControlStationException {
  10185.         this._setStatoOpzioniAvanzatePortaDefault(de, options);
  10186.     }
  10187.     public void setStatoOpzioniAvanzatePortaApplicativaDefault(DataElement de, String options) throws DriverControlStationException {
  10188.         this._setStatoOpzioniAvanzatePortaDefault(de, options);
  10189.     }
  10190.     private void _setStatoOpzioniAvanzatePortaDefault(DataElement de, String options) throws DriverControlStationException {
  10191.        
  10192.         de.setType(DataElementType.CHECKBOX);
  10193.        
  10194.         Map<String, List<String>> props = null;
  10195.         try {
  10196.             props = PropertiesSerializator.convertoFromDBColumnValue(options);
  10197.         }catch(Exception e) {
  10198.             throw new DriverControlStationException(e.getMessage(),e);
  10199.         }
  10200.         StringBuilder bf = new StringBuilder();
  10201.         StringBuilder bfTooltip = new StringBuilder();
  10202.         if(props!=null && props.size()>0) {
  10203.             for (String key : props.keySet()) {
  10204.                 List<String> values = props.get(key);
  10205.                 if(values!=null && !values.isEmpty()) {
  10206.                     for (String value : values) {
  10207.                         if(bf.length()>0) {
  10208.                             bf.append(", ");
  10209.                         }
  10210.                         bf.append(key);
  10211.                        
  10212.                         if(bfTooltip.length()>0) {
  10213.                             bfTooltip.append(", ");
  10214.                         }
  10215.                         bfTooltip.append(key);
  10216.                         bfTooltip.append(" '");
  10217.                         bfTooltip.append(value);
  10218.                         bfTooltip.append("'");      
  10219.                     }
  10220.                 }
  10221.             }
  10222.         }
  10223.        
  10224.        
  10225.         if(bf.length()>0) {
  10226.             de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
  10227.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO)+" [ "+bf.toString()+" ]");
  10228.             de.setStatusToolTip(bfTooltip.toString());
  10229.         }
  10230.         else {
  10231.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10232.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10233.         }
  10234.     }
  10235.    
  10236.     public void setStatoCachingRisposta(DataElement de, ResponseCachingConfigurazione rcPorta, Configurazione configurazioneGenerale) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10237.        
  10238.         de.setType(DataElementType.CHECKBOX);
  10239.        
  10240.         CheckboxStatusType statusType = null;
  10241.         String statusValue = null;
  10242.         String statusTooltip = null;
  10243.        
  10244.         if (rcPorta == null) {
  10245.            
  10246.             ResponseCachingConfigurazioneGenerale rg = configurazioneGenerale.getResponseCaching();
  10247.             if(rg==null || rg.getConfigurazione()==null || rg.getConfigurazione().getStato()==null ||
  10248.                     StatoFunzionalita.DISABILITATO.equals(rg.getConfigurazione().getStato())) {
  10249.                 statusType = CheckboxStatusType.CONFIG_DISABLE;
  10250.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  10251.             }
  10252.             else {
  10253.                 statusType = CheckboxStatusType.CONFIG_ENABLE;
  10254.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO);
  10255.             }
  10256.            
  10257.             statusTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_DEFAULT;
  10258.            
  10259.         } else {
  10260.            
  10261.             if(rcPorta.getStato()==null || StatoFunzionalita.DISABILITATO.equals(rcPorta.getStato()) ) {
  10262.                 statusType = CheckboxStatusType.CONFIG_DISABLE;
  10263.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO);
  10264.             }
  10265.             else {
  10266.                 statusType = CheckboxStatusType.CONFIG_ENABLE;
  10267.                 statusValue = this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO);
  10268.             }
  10269.            
  10270.             statusTooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_RIDEFINITA;
  10271.         }
  10272.        
  10273.         de.setStatusType(statusType);
  10274.         de.setStatusValue(statusValue);
  10275.         de.setStatusToolTip(statusTooltip);
  10276.     }
  10277.    
  10278.     public void setStatoSicurezzaMessaggio(DataElement de, MessageSecurity securityPorta,
  10279.             ConfigManager configManager, PropertiesSourceConfiguration propertiesSourceConfiguration) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10280.         setStatoSicurezzaMessaggio(de, securityPorta,
  10281.                 configManager, propertiesSourceConfiguration, true);
  10282.     }
  10283.     public void setStatoSicurezzaMessaggio(DataElement de, MessageSecurity securityPorta,
  10284.             ConfigManager configManager, PropertiesSourceConfiguration propertiesSourceConfiguration, boolean upperFirstChar) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10285.        
  10286.         boolean request = (
  10287.                 securityPorta!=null &&
  10288.                 securityPorta.getRequestFlow()!=null &&
  10289.                 securityPorta.getRequestFlow().getMode()!=null &&
  10290.                 !"".equals(securityPorta.getRequestFlow().getMode()) &&
  10291.                 !CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO.equals( securityPorta.getRequestFlow().getMode())
  10292.                 );
  10293.        
  10294.         boolean response = (
  10295.                 securityPorta!=null &&
  10296.                 securityPorta.getResponseFlow()!=null &&
  10297.                 securityPorta.getResponseFlow().getMode()!=null &&
  10298.                 !"".equals(securityPorta.getResponseFlow().getMode()) &&
  10299.                 !CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO.equals( securityPorta.getResponseFlow().getMode())
  10300.                 );
  10301.        
  10302.         if (securityPorta == null || (!request && !response) ) {
  10303.             de.setType(DataElementType.CHECKBOX);
  10304.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10305.             String value = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) : CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  10306.             de.setStatusValue(value);      
  10307.         } else {
  10308.            
  10309.             de.setType(DataElementType.MULTI_SELECT);
  10310.            
  10311.             if(request) {
  10312.                 CheckboxStatusType type = securityPorta.getRequestFlow().sizeParameterList()>0 ? CheckboxStatusType.CONFIG_ENABLE : CheckboxStatusType.CONFIG_ERROR;
  10313.                 String tooltip = securityPorta.getRequestFlow().sizeParameterList()>0 ? null : CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA;
  10314.                 String label = null;
  10315.                 if(CostantiControlStation.VALUE_PARAMETRO_PROPERTIES_MODE_DEFAULT.equals( securityPorta.getRequestFlow().getMode())) {
  10316.                     label = CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_CONFIGURAZIONE_MANUALE;
  10317.                 }
  10318.                 else {
  10319.                     List<String> nome =new ArrayList<>();
  10320.                     nome.add(securityPorta.getRequestFlow().getMode());
  10321.                     List<String> labelConfigurazione = configManager.convertToLabel(propertiesSourceConfiguration, nome);
  10322.                     label = labelConfigurazione.get(0);
  10323.                 }
  10324.                 String value = (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RICHIESTA : CostantiControlStation.LABEL_PARAMETRO_RICHIESTA.toLowerCase())+" [ "+label+" ]";
  10325.                 de.addStatus(tooltip, value, type);
  10326.             }
  10327.            
  10328.             if(response) {
  10329.                 CheckboxStatusType type = securityPorta.getResponseFlow().sizeParameterList()>0 ? CheckboxStatusType.CONFIG_ENABLE : CheckboxStatusType.CONFIG_ERROR;
  10330.                 String tooltip = securityPorta.getResponseFlow().sizeParameterList()>0 ? null : CostantiControlStation.LABEL_CONFIGURAZIONE_INCOMPLETA;
  10331.                 String label = null;
  10332.                 if(CostantiControlStation.VALUE_PARAMETRO_PROPERTIES_MODE_DEFAULT.equals( securityPorta.getResponseFlow().getMode())) {
  10333.                     label = CostantiControlStation.LABEL_CONFIGURAZIONE_PROPERTIES_CONFIGURAZIONE_MANUALE;
  10334.                 }
  10335.                 else {
  10336.                     List<String> nome =new ArrayList<>();
  10337.                     nome.add(securityPorta.getResponseFlow().getMode());
  10338.                     List<String> labelConfigurazione = configManager.convertToLabel(propertiesSourceConfiguration, nome);
  10339.                     label = labelConfigurazione.get(0);
  10340.                 }
  10341.                 String value = (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RISPOSTA : CostantiControlStation.LABEL_PARAMETRO_RISPOSTA.toLowerCase())+" [ "+label+" ]";
  10342.                 de.addStatus(tooltip, value, type);
  10343.             }
  10344.         }

  10345.     }
  10346.    
  10347.     public void setStatoMTOM(DataElement de, MtomProcessor mtomPorta) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10348.         setStatoMTOM(de, mtomPorta, true);
  10349.     }
  10350.     public void setStatoMTOM(DataElement de, MtomProcessor mtomPorta, boolean upperFirstChar) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10351.        
  10352.         boolean request = false;
  10353.         boolean response= false;
  10354.         if(mtomPorta!= null){
  10355.             if(mtomPorta.getRequestFlow() != null){
  10356.                 if(mtomPorta.getRequestFlow().getMode() != null){
  10357.                     MTOMProcessorType mode = mtomPorta.getRequestFlow().getMode();
  10358.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  10359.                         request = true;
  10360.                 }
  10361.             }

  10362.             if(mtomPorta.getResponseFlow() != null){
  10363.                 if(mtomPorta.getResponseFlow().getMode() != null){
  10364.                     MTOMProcessorType mode = mtomPorta.getResponseFlow().getMode();
  10365.                     if(!mode.equals(MTOMProcessorType.DISABLE))
  10366.                         response = true;
  10367.                 }
  10368.             }
  10369.         }
  10370.        
  10371.         if (mtomPorta == null || (!request && !response) ) {
  10372.             de.setType(DataElementType.CHECKBOX);
  10373.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10374.             String vUpper = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) :  CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  10375.             de.setStatusValue(vUpper);      
  10376.         } else {
  10377.            
  10378.             de.setType(DataElementType.MULTI_SELECT);
  10379.            
  10380.             if(request) {
  10381.                
  10382.                 CheckboxStatusType type = null;
  10383.                 String tooltip =  null;
  10384.                 switch (mtomPorta.getRequestFlow().getMode()) {
  10385.                 case PACKAGING:
  10386.                 case VERIFY:    
  10387.                     type = mtomPorta.getRequestFlow().sizeParameterList()>0 ? CheckboxStatusType.CONFIG_ENABLE : CheckboxStatusType.CONFIG_ERROR;
  10388.                     tooltip = mtomPorta.getRequestFlow().sizeParameterList()>0 ? null : CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INCOMPLETA;
  10389.                     break;
  10390.                 default:
  10391.                     type = CheckboxStatusType.CONFIG_ENABLE;
  10392.                     break;
  10393.                 }
  10394.                 String v = mtomPorta.getRequestFlow().getMode().getValue();
  10395.                 String value = (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RICHIESTA : CostantiControlStation.LABEL_PARAMETRO_RICHIESTA.toLowerCase())+" [ "+this.getUpperFirstChar(v)+" ]";
  10396.                 de.addStatus(tooltip, value, type);
  10397.             }
  10398.            
  10399.             if(response) {
  10400.                
  10401.                 CheckboxStatusType type = null;
  10402.                 String tooltip =  null;
  10403.                 switch (mtomPorta.getResponseFlow().getMode()) {
  10404.                 case PACKAGING:
  10405.                 case VERIFY:    
  10406.                     type = mtomPorta.getResponseFlow().sizeParameterList()>0 ? CheckboxStatusType.CONFIG_ENABLE : CheckboxStatusType.CONFIG_ERROR;
  10407.                     tooltip = mtomPorta.getResponseFlow().sizeParameterList()>0 ? null : CostantiControlStation.LABEL_CONFIGURAZIONE_MTOM_INCOMPLETA;
  10408.                     break;
  10409.                 default:
  10410.                     type = CheckboxStatusType.CONFIG_ENABLE;
  10411.                     break;
  10412.                 }
  10413.                 String v = mtomPorta.getResponseFlow().getMode().getValue();
  10414.                 String value = (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RISPOSTA : CostantiControlStation.LABEL_PARAMETRO_RISPOSTA.toLowerCase())+" [ "+this.getUpperFirstChar(v)+" ]";
  10415.                 de.addStatus(tooltip, value, type);
  10416.             }
  10417.            
  10418.         }
  10419.        
  10420.     }
  10421.    
  10422.     public void setStatoTrasformazioni(DataElement de, Trasformazioni trasformazioni, ServiceBinding serviceBindingMessage) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10423.         setStatoTrasformazioni(de, trasformazioni, serviceBindingMessage, true);
  10424.     }
  10425.     public void setStatoTrasformazioni(DataElement de, Trasformazioni trasformazioni, ServiceBinding serviceBindingMessage, boolean upperFirstChar) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  10426.        
  10427.         de.setType(DataElementType.CHECKBOX);
  10428.        
  10429.         List<TrasformazioneRegola> listaTrasformazioni = null;
  10430.         if(trasformazioni!=null) {
  10431.             listaTrasformazioni = trasformazioni.getRegolaList();
  10432.         }
  10433.         if(listaTrasformazioni==null || listaTrasformazioni.size()<=0) {
  10434.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10435.             String vDisabilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) :  CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  10436.             de.setStatusValue(vDisabilitato);      
  10437.         }
  10438.         else {
  10439.             StringBuilder bfToolTip = new StringBuilder();
  10440.             CheckboxStatusType type = null;
  10441.            
  10442.             int regoleAbilitate = 0;
  10443.             int regoleDisabilitate = 0;
  10444.            
  10445.             for (TrasformazioneRegola trasformazioneRegola : listaTrasformazioni) {
  10446.                                
  10447.                 if(trasformazioneRegola.getStato()!=null // backward compatibility
  10448.                         &&
  10449.                         StatoFunzionalita.DISABILITATO.equals(trasformazioneRegola.getStato())){
  10450.                     regoleDisabilitate++;
  10451.                     continue;
  10452.                 }
  10453.                 else {
  10454.                     regoleAbilitate++;
  10455.                 }
  10456.                
  10457.                 boolean richiestaDefinita = false;
  10458.                 if(trasformazioneRegola.getRichiesta()!=null) {
  10459.                     richiestaDefinita = trasformazioneRegola.getRichiesta().isConversione() ||
  10460.                             trasformazioneRegola.getRichiesta().sizeHeaderList()>0 ||
  10461.                             trasformazioneRegola.getRichiesta().sizeParametroUrlList()>0 ||
  10462.                             (
  10463.                                     ServiceBinding.REST.equals(serviceBindingMessage) &&
  10464.                                     trasformazioneRegola.getRichiesta().getTrasformazioneRest()!=null &&
  10465.                                     (
  10466.                                         StringUtils.isNotEmpty(trasformazioneRegola.getRichiesta().getTrasformazioneRest().getMetodo())
  10467.                                         ||
  10468.                                         StringUtils.isNotEmpty(trasformazioneRegola.getRichiesta().getTrasformazioneRest().getPath())
  10469.                                     )
  10470.                             )
  10471.                         ;
  10472.                 }
  10473.                
  10474.                 if(trasformazioneRegola.sizeRispostaList()>0) {
  10475.                     for (TrasformazioneRegolaRisposta trasformazioneRegolaRisposta : trasformazioneRegola.getRispostaList()) {
  10476.                         boolean rispostaDefinita = false;
  10477.                         if(trasformazioneRegolaRisposta!=null) {
  10478.                             rispostaDefinita = trasformazioneRegolaRisposta.isConversione() ||
  10479.                                     trasformazioneRegolaRisposta.sizeHeaderList()>0 ||
  10480.                                     (trasformazioneRegolaRisposta.getReturnCode()!=null && StringUtils.isNotEmpty(trasformazioneRegolaRisposta.getReturnCode()));
  10481.                         }
  10482.                         if(!rispostaDefinita) {
  10483.                             type = CheckboxStatusType.CONFIG_ERROR;
  10484.                             if(bfToolTip.length()>0) {
  10485.                                 bfToolTip.append("\n");
  10486.                             }
  10487.                             if(trasformazioneRegolaRisposta!=null) {
  10488.                                 bfToolTip.append("La regola '"+trasformazioneRegola.getNome()+"' possiede una configurazione per la risposta ('"+trasformazioneRegolaRisposta.getNome()+"') senza alcuna trasformazione attiva");
  10489.                             }
  10490.                             else {
  10491.                                 bfToolTip.append("La regola '"+trasformazioneRegola.getNome()+"' non possiede una configurazione per la risposta");
  10492.                             }
  10493.                             break;
  10494.                         }
  10495.                     }              
  10496.                 }
  10497.                 else if(!richiestaDefinita) {
  10498.                     type = CheckboxStatusType.CONFIG_ERROR;
  10499.                     if(bfToolTip.length()>0) {
  10500.                         bfToolTip.append("\n");
  10501.                     }  
  10502.                     bfToolTip.append("La regola '"+trasformazioneRegola.getNome()+"' non effettua trasformazioni nè della richiesta nè della risposta");
  10503.                 }
  10504.                
  10505.             }
  10506.            
  10507.             if(regoleAbilitate==0) {
  10508.                 de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10509.                 String vDisabilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) :  CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  10510.                 de.setStatusValue(vDisabilitato);  
  10511.                 if(regoleDisabilitate>0) {
  10512.                     de.setStatusToolTip("Sono registrate, con stato disabilitato, "+regoleDisabilitate+" regole di trasformazione dei messaggi");
  10513.                 }
  10514.             }
  10515.             else {
  10516.            
  10517.                 if(type==null) {
  10518.                     type = CheckboxStatusType.CONFIG_ENABLE;
  10519.                 }
  10520.                 de.setStatusType(type);
  10521.                 String vAbilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO) :  CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  10522.                 de.setStatusValue(vAbilitato);
  10523.                 if(bfToolTip.length()>0) {
  10524.                     de.setStatusToolTip(bfToolTip.toString());
  10525.                 }
  10526.                 else {
  10527.                     if(listaTrasformazioni.size()>1) {
  10528.                         de.setStatusToolTip("Sono attive "+regoleAbilitate+" regole di trasformazione dei messaggi");
  10529.                     }
  10530.                 }
  10531.                
  10532.             }
  10533.         }
  10534.     }
  10535.    
  10536.     public void setStatoTracciamento(DataElement de,
  10537.             CorrelazioneApplicativa correlazioneApplicativa,
  10538.             CorrelazioneApplicativaRisposta correlazioneApplicativaRisposta,
  10539.             PortaTracciamento tracciamentoConfig, ConfigurazioneTracciamentoPorta configurazioneTracciamento,
  10540.             List<Proprieta> proprietaPorta,
  10541.             Configurazione configurazioneGenerale) throws DriverControlStationException {
  10542.        
  10543.         de.setType(DataElementType.MULTI_SELECT);
  10544.                
  10545.         String tooltipTransazioni = null;
  10546.         boolean transazioniDB = false;
  10547.         boolean transazioniFiletrace = false;
  10548.         if(tracciamentoConfig!=null && tracciamentoConfig.getStato()!=null && org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.equals(tracciamentoConfig.getStato())) {
  10549.            
  10550.             tooltipTransazioni = CostantiControlStation.LABEL_CONFIGURAZIONE_RIDEFINITA;
  10551.            
  10552.             transazioniDB = tracciamentoConfig.getDatabase()==null || tracciamentoConfig.getDatabase().getStato()==null ||
  10553.                     !org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.DISABILITATO.equals(tracciamentoConfig.getDatabase().getStato());
  10554.             if(transazioniDB &&
  10555.                     (tracciamentoConfig.getDatabase()==null || tracciamentoConfig.getDatabase().getFiltroEsiti()==null ||
  10556.                             org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.equals(tracciamentoConfig.getDatabase().getFiltroEsiti()))
  10557.                     ) {
  10558.                 transazioniDB = tracciamentoConfig.getEsiti()!=null
  10559.                         &&!(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(tracciamentoConfig.getEsiti());
  10560.             }
  10561.            
  10562.             transazioniFiletrace = tracciamentoConfig.getFiletrace()!=null && tracciamentoConfig.getFiletrace().getStato()!=null &&
  10563.                     !org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.DISABILITATO.equals(tracciamentoConfig.getFiletrace().getStato());
  10564.             if(transazioniFiletrace &&
  10565.                     (tracciamentoConfig.getDatabase()!=null && tracciamentoConfig.getDatabase().getFiltroEsiti()!=null &&
  10566.                             org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.equals(tracciamentoConfig.getDatabase().getFiltroEsiti()))
  10567.                     ) {
  10568.                 transazioniFiletrace = tracciamentoConfig.getEsiti()!=null
  10569.                         &&!(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(tracciamentoConfig.getEsiti());
  10570.             }
  10571.         }
  10572.         else {
  10573.             tooltipTransazioni = CostantiControlStation.LABEL_CONFIGURAZIONE_DEFAULT;
  10574.             String esitiTransazioni = this.readConfigurazioneRegistrazioneEsitiFromHttpParameters((configurazioneTracciamento!=null) ? configurazioneTracciamento.getEsiti() : null , true);
  10575.            
  10576.             transazioniDB = configurazioneTracciamento==null || configurazioneTracciamento.getDatabase()==null || configurazioneTracciamento.getDatabase().getStato()==null ||
  10577.                     !org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.DISABILITATO.equals(configurazioneTracciamento.getDatabase().getStato());
  10578.             if(transazioniDB &&  
  10579.                     (configurazioneTracciamento==null || configurazioneTracciamento.getDatabase()==null || configurazioneTracciamento.getDatabase().getFiltroEsiti()==null ||
  10580.                             org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.equals(configurazioneTracciamento.getDatabase().getFiltroEsiti()))
  10581.                     ) {
  10582.                 transazioniDB = esitiTransazioni!=null
  10583.                         && !(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(esitiTransazioni);
  10584.             }  
  10585.            
  10586.             transazioniFiletrace = configurazioneTracciamento!=null && configurazioneTracciamento.getFiletrace()!=null && configurazioneTracciamento.getFiletrace().getStato()!=null &&
  10587.                     !org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.DISABILITATO.equals(configurazioneTracciamento.getFiletrace().getStato());
  10588.             if(configurazioneTracciamento!=null && configurazioneTracciamento.getFiletrace()!=null && org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.CONFIGURAZIONE_ESTERNA.equals(configurazioneTracciamento.getFiletrace().getStato())) {
  10589.                 transazioniFiletrace = (InitListener.getFileTraceGovWayState()!=null) ? InitListener.getFileTraceGovWayState().isEnabled() : transazioniFiletrace;
  10590.             }
  10591.             if(transazioniFiletrace && configurazioneTracciamento!=null && configurazioneTracciamento.getFiletrace()!=null && org.openspcoop2.core.config.constants.StatoFunzionalitaConPersonalizzazione.CONFIGURAZIONE_ESTERNA.equals(configurazioneTracciamento.getFiletrace().getStato())) {
  10592.                 transazioniFiletrace = CostantiProprieta.isFileTraceEnabled(proprietaPorta, transazioniFiletrace);
  10593.             }
  10594.             if(transazioniFiletrace &&
  10595.                     (configurazioneTracciamento!=null && configurazioneTracciamento.getFiletrace()!=null && configurazioneTracciamento.getFiletrace().getFiltroEsiti()!=null &&
  10596.                             org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.equals(configurazioneTracciamento.getFiletrace().getFiltroEsiti()))
  10597.                     ) {
  10598.                 transazioniFiletrace = esitiTransazioni!=null
  10599.                         && !(EsitiConfigUtils.TUTTI_ESITI_DISABILITATI+"").equals(esitiTransazioni);
  10600.             }  
  10601.         }
  10602.         StringBuilder sbTransazioni = new StringBuilder();
  10603.         if(
  10604.                 //transazioniDB se solo transazioni DB non aggiungo l'informazione
  10605.                 //||
  10606.                 transazioniFiletrace) {
  10607.             sbTransazioni.append(" [ ");
  10608.             if(transazioniDB) {
  10609.                 sbTransazioni.append("DB");
  10610.                 if(transazioniFiletrace) {
  10611.                     sbTransazioni.append(",");
  10612.                 }
  10613.             }
  10614.             if(transazioniFiletrace) {
  10615.                 sbTransazioni.append("FileTrace");
  10616.             }
  10617.             sbTransazioni.append(" ]");
  10618.         }
  10619.         String suffixTooltipTransazioni = sbTransazioni.length()>0 ? sbTransazioni.toString() : "";
  10620.         de.addStatus(tooltipTransazioni,
  10621.                 ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONI+suffixTooltipTransazioni,
  10622.                 transazioniDB || transazioniFiletrace? CheckboxStatusType.CONFIG_ENABLE :CheckboxStatusType.CONFIG_DISABLE);
  10623.        
  10624.        
  10625.         String tooltipSeverita = null;
  10626.         boolean tracciamentoSeverita = false;
  10627.         if(tracciamentoConfig!=null && tracciamentoConfig.getSeverita()!=null) {
  10628.             tooltipSeverita = CostantiControlStation.LABEL_CONFIGURAZIONE_RIDEFINITA+"\nLivello Severità: "+tracciamentoConfig.getSeverita().getValue();
  10629.             tracciamentoSeverita = (!LogLevels.LIVELLO_OFF.equals(tracciamentoConfig.getSeverita().getValue()));
  10630.         }
  10631.         else {
  10632.             tooltipSeverita = CostantiControlStation.LABEL_CONFIGURAZIONE_DEFAULT;
  10633.             if(configurazioneGenerale!=null && configurazioneGenerale.getMessaggiDiagnostici()!=null && configurazioneGenerale.getMessaggiDiagnostici().getSeverita()!=null) {
  10634.                 tooltipSeverita = tooltipSeverita+"\nLivello Severità: "+configurazioneGenerale.getMessaggiDiagnostici().getSeverita().getValue();
  10635.             }
  10636.             tracciamentoSeverita = (
  10637.                     configurazioneGenerale!=null && configurazioneGenerale.getMessaggiDiagnostici()!=null &&
  10638.                             configurazioneGenerale.getMessaggiDiagnostici().getSeverita()!=null
  10639.                     &&
  10640.                     !(LogLevels.LIVELLO_OFF.equals(configurazioneGenerale.getMessaggiDiagnostici().getSeverita().getValue()))
  10641.                     );
  10642.         }
  10643.         de.addStatus(tooltipSeverita,
  10644.                 ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DIAGNOSTICI,
  10645.                 tracciamentoSeverita? CheckboxStatusType.CONFIG_ENABLE :CheckboxStatusType.CONFIG_DISABLE);
  10646.            
  10647.         boolean isCorrelazioneApplicativaAbilitataReq = false;
  10648.         if (correlazioneApplicativa != null)
  10649.             isCorrelazioneApplicativaAbilitataReq = correlazioneApplicativa.sizeElementoList() > 0;
  10650.         if(isCorrelazioneApplicativaAbilitataReq) {
  10651.             de.addStatus(correlazioneApplicativa.sizeElementoList() > 1 ? "Sono attive "+correlazioneApplicativa.sizeElementoList()+" regole" : null,
  10652.                     CostantiControlStation.LABEL_PARAMETRO_RICHIESTA+" [ "+CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA+" ]",
  10653.                     CheckboxStatusType.CONFIG_ENABLE);
  10654.         }
  10655.            
  10656.         boolean isCorrelazioneApplicativaAbilitataRes = false;
  10657.         if (correlazioneApplicativaRisposta != null)
  10658.             isCorrelazioneApplicativaAbilitataRes = correlazioneApplicativaRisposta.sizeElementoList() > 0;
  10659.         if(isCorrelazioneApplicativaAbilitataRes) {
  10660.             de.addStatus(correlazioneApplicativaRisposta.sizeElementoList() > 1 ? "Sono attive "+correlazioneApplicativaRisposta.sizeElementoList()+" regole" : null,
  10661.                     CostantiControlStation.LABEL_PARAMETRO_RISPOSTA+" [ "+CostantiControlStation.LABEL_PARAMETRO_CORRELAZIONE_APPLICATIVA+" ]",
  10662.                     CheckboxStatusType.CONFIG_ENABLE);
  10663.         }
  10664.        
  10665.     }
  10666.    
  10667.     public void setStatoDump(DataElement de, DumpConfigurazione dumpConfigurazionePorta, Configurazione configurazioneGenerale, boolean portaApplicativa) {
  10668.         setStatoDump(de, dumpConfigurazionePorta, configurazioneGenerale, portaApplicativa, true);
  10669.     }
  10670.     public void setStatoDump(DataElement de, DumpConfigurazione dumpConfigurazionePorta, Configurazione configurazioneGenerale, boolean portaApplicativa, boolean upperFirstChar) {
  10671.        
  10672.         de.setType(DataElementType.MULTI_SELECT);
  10673.        
  10674.         DumpConfigurazione dumpConfigurazione = null;
  10675.        
  10676.         String tooltip = null;
  10677.         if(dumpConfigurazionePorta!=null) {
  10678.             tooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_RIDEFINITA;
  10679.             dumpConfigurazione = dumpConfigurazionePorta;
  10680.         }
  10681.         else {
  10682.             tooltip = CostantiControlStation.LABEL_CONFIGURAZIONE_DEFAULT;
  10683.             if(configurazioneGenerale!=null && configurazioneGenerale.getDump()!=null) {
  10684.                 if(portaApplicativa) {
  10685.                     dumpConfigurazione = configurazioneGenerale.getDump().getConfigurazionePortaApplicativa();
  10686.                 }
  10687.                 else {
  10688.                     dumpConfigurazione = configurazioneGenerale.getDump().getConfigurazionePortaDelegata();
  10689.                 }
  10690.             }
  10691.         }

  10692.         StringBuilder bfRichiesta = new StringBuilder();
  10693.         StringBuilder bfRichiestaOptions = new StringBuilder();
  10694.         StringBuilder bfRisposta = new StringBuilder();
  10695.         StringBuilder bfRispostaOptions = new StringBuilder();
  10696.        
  10697.         if(dumpConfigurazione!=null) {
  10698.                    
  10699.             if(dumpConfigurazione.getRichiestaIngresso()!=null) {
  10700.                 StringBuilder bf = new StringBuilder();
  10701.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getHeaders())) {
  10702.                     if(bf.length()>0) {
  10703.                         bf.append(", ");
  10704.                     }
  10705.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS);
  10706.                 }
  10707.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getPayload())) {
  10708.                     if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getPayloadParsing())) {
  10709.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getBody())) {
  10710.                             if(bf.length()>0) {
  10711.                                 bf.append(", ");
  10712.                             }
  10713.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY);
  10714.                         }
  10715.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getAttachments())) {
  10716.                             if(bf.length()>0) {
  10717.                                 bf.append(", ");
  10718.                             }
  10719.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS);
  10720.                         }      
  10721.                     }
  10722.                     else {
  10723.                         if(bf.length()>0) {
  10724.                             bf.append(", ");
  10725.                         }
  10726.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD);
  10727.                     }
  10728.                 }
  10729.                 if(bf.length()>0) {
  10730.                     if(bfRichiesta.length()>0) {
  10731.                         bfRichiesta.append("\n");
  10732.                     }
  10733.                     bfRichiesta.append(CostantiControlStation.LABEL_PARAMETRO_RICHIESTA+" "+CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO).append(": ").append(bf.toString());
  10734.                    
  10735.                     if(bfRichiestaOptions.length()>0) {
  10736.                         bfRichiestaOptions.append(", ");
  10737.                     }
  10738.                     bfRichiestaOptions.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO);
  10739.                 }
  10740.             }
  10741.            
  10742.             if(dumpConfigurazione.getRichiestaUscita()!=null) {
  10743.                 StringBuilder bf = new StringBuilder();
  10744.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getHeaders())) {
  10745.                     if(bf.length()>0) {
  10746.                         bf.append(", ");
  10747.                     }
  10748.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS);
  10749.                 }
  10750.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getPayload())) {
  10751.                     if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getPayloadParsing())) {
  10752.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getBody())) {
  10753.                             if(bf.length()>0) {
  10754.                                 bf.append(", ");
  10755.                             }
  10756.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_BODY);
  10757.                         }
  10758.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getAttachments())) {
  10759.                             if(bf.length()>0) {
  10760.                                 bf.append(", ");
  10761.                             }
  10762.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS);
  10763.                         }      
  10764.                     }
  10765.                     else {
  10766.                         if(bf.length()>0) {
  10767.                             bf.append(", ");
  10768.                         }
  10769.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD);
  10770.                     }
  10771.                 }
  10772.                 if(bf.length()>0) {
  10773.                     if(bfRichiesta.length()>0) {
  10774.                         bfRichiesta.append("\n");
  10775.                     }
  10776.                     bfRichiesta.append(CostantiControlStation.LABEL_PARAMETRO_RICHIESTA+" "+CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA).append(": ").append(bf.toString());
  10777.                    
  10778.                     if(bfRichiestaOptions.length()>0) {
  10779.                         bfRichiestaOptions.append(", ");
  10780.                     }
  10781.                     bfRichiestaOptions.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA);
  10782.                 }
  10783.             }
  10784.            
  10785.             if(dumpConfigurazione.getRispostaIngresso()!=null) {
  10786.                 StringBuilder bf = new StringBuilder();
  10787.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getHeaders())) {
  10788.                     if(bf.length()>0) {
  10789.                         bf.append(", ");
  10790.                     }
  10791.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS);
  10792.                 }
  10793.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getPayload())) {
  10794.                     if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getPayloadParsing())) {
  10795.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getBody())) {
  10796.                             if(bf.length()>0) {
  10797.                                 bf.append(", ");
  10798.                             }
  10799.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY);
  10800.                         }
  10801.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getAttachments())) {
  10802.                             if(bf.length()>0) {
  10803.                                 bf.append(", ");
  10804.                             }
  10805.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS);
  10806.                         }      
  10807.                     }
  10808.                     else {
  10809.                         if(bf.length()>0) {
  10810.                             bf.append(", ");
  10811.                         }
  10812.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD);
  10813.                     }
  10814.                 }
  10815.                 if(bf.length()>0) {
  10816.                     if(bfRisposta.length()>0) {
  10817.                         bfRisposta.append("\n");
  10818.                     }
  10819.                     bfRisposta.append(CostantiControlStation.LABEL_PARAMETRO_RISPOSTA+" "+CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO).append(": ").append(bf.toString());
  10820.                    
  10821.                     if(bfRispostaOptions.length()>0) {
  10822.                         bfRispostaOptions.append(", ");
  10823.                     }
  10824.                     bfRispostaOptions.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO);
  10825.                 }
  10826.             }
  10827.            
  10828.             if(dumpConfigurazione.getRispostaUscita()!=null) {
  10829.                 StringBuilder bf = new StringBuilder();
  10830.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getHeaders())) {
  10831.                     if(bf.length()>0) {
  10832.                         bf.append(", ");
  10833.                     }
  10834.                     bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS);
  10835.                 }
  10836.                 if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getPayload())) {
  10837.                     if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getPayloadParsing())) {
  10838.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getBody())) {
  10839.                             if(bf.length()>0) {
  10840.                                 bf.append(", ");
  10841.                             }
  10842.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_BODY);
  10843.                         }
  10844.                         if(StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getAttachments())) {
  10845.                             if(bf.length()>0) {
  10846.                                 bf.append(", ");
  10847.                             }
  10848.                             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS);
  10849.                         }      
  10850.                     }
  10851.                     else {
  10852.                         if(bf.length()>0) {
  10853.                             bf.append(", ");
  10854.                         }
  10855.                         bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD);
  10856.                     }
  10857.                 }
  10858.                 if(bf.length()>0) {
  10859.                     if(bfRisposta.length()>0) {
  10860.                         bfRisposta.append("\n");
  10861.                     }
  10862.                     bfRisposta.append(CostantiControlStation.LABEL_PARAMETRO_RISPOSTA+" "+CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA).append(": ").append(bf.toString());
  10863.                    
  10864.                     if(bfRispostaOptions.length()>0) {
  10865.                         bfRispostaOptions.append(", ");
  10866.                     }
  10867.                     bfRispostaOptions.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA);
  10868.                 }
  10869.             }
  10870.         }
  10871.        
  10872.         if(bfRichiesta.length()>0 || bfRisposta.length()>0) {
  10873.            
  10874.             if(bfRichiesta.length()>0) {
  10875.                 de.addStatus(tooltip+"\n"+bfRichiesta.toString(),
  10876.                         (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RICHIESTA : CostantiControlStation.LABEL_PARAMETRO_RICHIESTA.toLowerCase())+" [ "+bfRichiestaOptions.toString()+" ]",
  10877.                         CheckboxStatusType.CONFIG_ENABLE);
  10878.             }
  10879.            
  10880.             if(bfRisposta.length()>0) {
  10881.                 de.addStatus(tooltip+"\n"+bfRisposta.toString(),
  10882.                         (upperFirstChar ? CostantiControlStation.LABEL_PARAMETRO_RISPOSTA : CostantiControlStation.LABEL_PARAMETRO_RISPOSTA.toLowerCase())+" [ "+bfRispostaOptions.toString()+" ]",
  10883.                         CheckboxStatusType.CONFIG_ENABLE);
  10884.             }
  10885.            
  10886.         }
  10887.         else {
  10888.             de.addStatus(tooltip,
  10889.                     (upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) : CostantiControlStation.DEFAULT_VALUE_DISABILITATO),
  10890.                     CheckboxStatusType.CONFIG_DISABLE);
  10891.         }
  10892.     }
  10893.    
  10894.     public void setStatoProprieta(DataElement de, int size) {
  10895.        
  10896.         de.setType(DataElementType.CHECKBOX);
  10897.        
  10898.         if(size>0) {
  10899.             de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
  10900.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO));
  10901.             de.setStatusToolTip("Sono registrate "+size+" proprietà");
  10902.         }
  10903.         else {
  10904.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  10905.             de.setStatusValue(this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO));
  10906.         }
  10907.        
  10908.     }
  10909.    
  10910.     public void setStatoOpzioniAvanzate(DataElement de,
  10911.             String protocollo, ServiceBinding serviceBinding,
  10912.             StatoFunzionalita allegaBody, StatoFunzionalita scartaBody,
  10913.             String integrazione, String behaviour,
  10914.             List<Proprieta> proprietaRateLimiting,
  10915.             StatoFunzionalita stateless, PortaDelegataLocalForward localForward,
  10916.             StatoFunzionalita ricevutaAsincronaSimmetrica, StatoFunzionalita ricevutaAsincronaAsimmetrica,
  10917.             StatoFunzionalita gestioneManifest, ConfigurazionePortaHandler configPortaHandler) throws DriverRegistroServiziNotFound, DriverRegistroServiziException, DriverConfigurazioneException {
  10918.         setStatoOpzioniAvanzate(de,
  10919.                 protocollo, serviceBinding,
  10920.                 allegaBody, scartaBody,
  10921.                 integrazione, behaviour,
  10922.                 proprietaRateLimiting,
  10923.                 stateless, localForward,
  10924.                 ricevutaAsincronaSimmetrica, ricevutaAsincronaAsimmetrica,
  10925.                 gestioneManifest, configPortaHandler, true);
  10926.     }
  10927.     public void setStatoOpzioniAvanzate(DataElement de,
  10928.             String protocollo, ServiceBinding serviceBinding,
  10929.             StatoFunzionalita allegaBody, StatoFunzionalita scartaBody,
  10930.             String integrazione, String behaviour,
  10931.             List<Proprieta> proprietaRateLimiting,
  10932.             StatoFunzionalita stateless, PortaDelegataLocalForward localForward,
  10933.             StatoFunzionalita ricevutaAsincronaSimmetrica, StatoFunzionalita ricevutaAsincronaAsimmetrica,
  10934.             StatoFunzionalita gestioneManifest, ConfigurazionePortaHandler configPortaHandler, boolean upperFirstChar) throws DriverRegistroServiziNotFound, DriverRegistroServiziException, DriverConfigurazioneException {
  10935.        
  10936.         boolean supportoAsincroni = this.core.isProfiloDiCollaborazioneAsincronoSupportatoDalProtocollo(protocollo,serviceBinding);
  10937.         boolean supportoGestioneManifest = isFunzionalitaProtocolloSupportataDalProtocollo(protocollo, serviceBinding, FunzionalitaProtocollo.MANIFEST_ATTACHMENTS);
  10938.        
  10939.         de.setType(DataElementType.CHECKBOX);
  10940.        
  10941.         StringBuilder bf = new StringBuilder();
  10942.         StringBuilder bfTooltips = new StringBuilder();
  10943.         if(allegaBody!=null && StatoFunzionalita.ABILITATO.equals(allegaBody)) {
  10944.             if(bf.length()>0) {
  10945.                 bf.append(", ");
  10946.             }
  10947.             bf.append("Allega SOAPBody");
  10948.             if(bfTooltips.length()>0) {
  10949.                 bfTooltips.append("\n");
  10950.             }
  10951.             bfTooltips.append("Allega SOAP Body come Attachment");
  10952.         }
  10953.         if(scartaBody!=null && StatoFunzionalita.ABILITATO.equals(scartaBody)) {
  10954.             if(bf.length()>0) {
  10955.                 bf.append(", ");
  10956.             }
  10957.             bf.append("Scarta SOAPBody");
  10958.             if(bfTooltips.length()>0) {
  10959.                 bfTooltips.append("\n");
  10960.             }
  10961.             bfTooltips.append("Scarta SOAP Body");
  10962.         }
  10963.         if(integrazione!=null && !"".equals(integrazione)) {
  10964.             String [] tmp = integrazione.split(",");
  10965.             if(bf.length()>0) {
  10966.                 bf.append(", ");
  10967.             }
  10968.             bf.append(CostantiControlStation.LABEL_METADATI_INTEGRAZIONE);
  10969.             if(tmp.length>1) {
  10970.                 bf.append(" (").append(tmp.length).append(")");
  10971.             }
  10972.             if(bfTooltips.length()>0) {
  10973.                 bfTooltips.append("\n");
  10974.             }
  10975.            
  10976.             List<String> listGruppi = new ArrayList<>();
  10977.             List<String> listPlugins = new ArrayList<>();
  10978.             if(tmp.length>0) {
  10979.                 for (String tmpIntegrazione : tmp) {
  10980.                     if(tmpIntegrazione!=null) {
  10981.                         tmpIntegrazione = tmpIntegrazione.trim();
  10982.                         TipoIntegrazione tipo = TipoIntegrazione.toEnumConstant(tmpIntegrazione);
  10983.                         if(tipo!=null) {
  10984.                             String label = null;
  10985.                             if(tipo.getGroup()!=null) {
  10986.                                 label = tipo.getGroup().getCompactLabel();
  10987.                             }
  10988.                             else {
  10989.                                 label = tipo.getLabel();
  10990.                             }
  10991.                             if(!listGruppi.contains(label)) {
  10992.                                 listGruppi.add(label);
  10993.                             }
  10994.                         }
  10995.                         else {
  10996.                             listPlugins.add(tmpIntegrazione);
  10997.                             String label = GruppoIntegrazione.PLUGIN.getCompactLabel();
  10998.                             if(!listGruppi.contains(label)) {
  10999.                                 listGruppi.add(label);
  11000.                             }
  11001.                         }
  11002.                     }
  11003.                     else {
  11004.                         listPlugins.add(tmpIntegrazione);
  11005.                         String label = GruppoIntegrazione.PLUGIN.getCompactLabel();
  11006.                         if(!listGruppi.contains(label)) {
  11007.                             listGruppi.add(label);
  11008.                         }
  11009.                     }
  11010.                 }
  11011.             }
  11012.             StringBuilder integrazioneString = new StringBuilder("");
  11013.             if(!listGruppi.isEmpty()) {
  11014.                 for (String gruppo : listGruppi) {
  11015.                     if(integrazioneString.length()>0) {
  11016.                         integrazioneString.append(", ");
  11017.                     }
  11018.                     integrazioneString.append(gruppo);
  11019.                     if(GruppoIntegrazione.PLUGIN.getCompactLabel().equals(gruppo)) {
  11020.                         if(!listPlugins.isEmpty()) {
  11021.                             integrazioneString.append(" (");
  11022.                             for (int i = 0; i < listPlugins.size(); i++) {
  11023.                                 String plug = listPlugins.get(i);
  11024.                                 if(i>0) {
  11025.                                     integrazioneString.append(",");
  11026.                                 }
  11027.                                 integrazioneString.append(plug);
  11028.                             }
  11029.                             integrazioneString.append(")");
  11030.                         }
  11031.                     }
  11032.                 }
  11033.             }
  11034.            
  11035.             bfTooltips.append(CostantiControlStation.LABEL_METADATI_INTEGRAZIONE).append(": ").append(integrazioneString.toString());
  11036.         }
  11037.         if(proprietaRateLimiting!=null && !proprietaRateLimiting.isEmpty()) {
  11038.             try {
  11039.                 PolicyConfiguration config = new PolicyConfiguration(proprietaRateLimiting, this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(), false);
  11040.                 if(!org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DEFAULT.equals(config.getSyncMode()) || !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_DEFAULT.equals(config.getHttpMode())) {
  11041.                    
  11042.                     if(bf.length()>0) {
  11043.                         bf.append(", ");
  11044.                     }
  11045.                     bf.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING);
  11046.                    
  11047.                     if(bfTooltips.length()>0) {
  11048.                         bfTooltips.append("\n");
  11049.                     }
  11050.                     bfTooltips.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING).append(": ");
  11051.                     if(!org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DEFAULT.equals(config.getSyncMode())){
  11052.                         bfTooltips.append(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE).append(" ");
  11053.                         if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_LOCALE.equals(config.getSyncMode())){
  11054.                             bfTooltips.append(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE_LOCALE);
  11055.                         }
  11056.                         else if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_LOCALE_SUDDIVISA_TRA_NODI.equals(config.getSyncMode())){
  11057.                             bfTooltips.append(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE_LOCALE_SUDDIVISA_TRA_NODI);
  11058.                         }
  11059.                         else if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA.equals(config.getSyncMode())){
  11060.                             if(config.getType()!=null) {
  11061.                                 bfTooltips.append(config.getType().toLabel());
  11062.                             }
  11063.                             else {
  11064.                                 bfTooltips.append(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA);
  11065.                             }
  11066.                         }
  11067.                        
  11068.                         if(!org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_DEFAULT.equals(config.getHttpMode())){
  11069.                             bfTooltips.append(", ");
  11070.                         }
  11071.                     }
  11072.                     if(!org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_DEFAULT.equals(config.getHttpMode())){
  11073.                         bfTooltips.append(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP);
  11074.                         if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_DISABILITATO.equals(config.getHttpMode())){
  11075.                             bfTooltips.append(" ").append("disabilitati");
  11076.                         }
  11077.                         else if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(config.getHttpMode())){
  11078.                             bfTooltips.append(" ").append("gestione personalizzata");
  11079.                         }
  11080.                     }
  11081.                    
  11082.                 }
  11083.             }catch(Exception e) {
  11084.                 throw new DriverConfigurazioneException(e.getMessage(),e);
  11085.             }
  11086.         }
  11087.         if(behaviour!=null && !"".equals(behaviour)) {
  11088.             String [] tmp = behaviour.split(",");
  11089.             if(bf.length()>0) {
  11090.                 bf.append(", ");
  11091.             }
  11092.             bf.append(CostantiControlStation.LABEL_BEHAVIOUR);
  11093.             if(tmp.length>1) {
  11094.                 bf.append(" (").append(tmp.length).append(")");
  11095.             }
  11096.             if(bfTooltips.length()>0) {
  11097.                 bfTooltips.append("\n");
  11098.             }
  11099.             bfTooltips.append(CostantiControlStation.LABEL_BEHAVIOUR).append(": ").append(behaviour);
  11100.         }
  11101.         if(stateless!=null) {
  11102.             if(bf.length()>0) {
  11103.                 bf.append(", ");
  11104.             }
  11105.             if(bfTooltips.length()>0) {
  11106.                 bfTooltips.append("\n");
  11107.             }
  11108.             if(StatoFunzionalita.ABILITATO.equals(stateless)) {
  11109.                 bf.append(CostantiControlStation.LABEL_GESTIONE_STATELESS);
  11110.                 bfTooltips.append(CostantiControlStation.LABEL_GESTIONE_STATELESS);
  11111.             }
  11112.             else {
  11113.                 bf.append(CostantiControlStation.LABEL_GESTIONE_STATEFUL);
  11114.                 bfTooltips.append(CostantiControlStation.LABEL_GESTIONE_STATEFUL);
  11115.             }
  11116.         }
  11117.         if(localForward!=null && StatoFunzionalita.ABILITATO.equals(localForward.getStato())) {
  11118.             if(bf.length()>0) {
  11119.                 bf.append(", ");
  11120.             }
  11121.             bf.append(CostantiControlStation.LABEL_LOCAL_FORWARD);
  11122.             if(bfTooltips.length()>0) {
  11123.                 bfTooltips.append("\n");
  11124.             }
  11125.             bfTooltips.append(CostantiControlStation.LABEL_LOCAL_FORWARD);
  11126.             if(localForward.getPortaApplicativa()!=null) {
  11127.                 bfTooltips.append(", ").append(CostantiControlStation.LABEL_LOCAL_FORWARD_PA).append(": ").append(localForward.getPortaApplicativa());
  11128.             }
  11129.         }
  11130.         if(supportoAsincroni) {
  11131.             if(ricevutaAsincronaSimmetrica!=null && StatoFunzionalita.ABILITATO.equals(ricevutaAsincronaSimmetrica)) {
  11132.                 if(bf.length()>0) {
  11133.                     bf.append(", ");
  11134.                 }
  11135.                 bf.append(CostantiControlStation.LABEL_RICEVUTA_ASINCRONA_SIMMETRICA);
  11136.                 if(bfTooltips.length()>0) {
  11137.                     bfTooltips.append("\n");
  11138.                 }
  11139.                 bfTooltips.append(CostantiControlStation.LABEL_RICEVUTA_ASINCRONA_SIMMETRICA);
  11140.             }
  11141.             if(ricevutaAsincronaAsimmetrica!=null && StatoFunzionalita.ABILITATO.equals(ricevutaAsincronaAsimmetrica)) {
  11142.                 if(bf.length()>0) {
  11143.                     bf.append(", ");
  11144.                 }
  11145.                 bf.append(CostantiControlStation.LABEL_RICEVUTA_ASINCRONA_ASIMMETRICA);
  11146.                 if(bfTooltips.length()>0) {
  11147.                     bfTooltips.append("\n");
  11148.                 }
  11149.                 bfTooltips.append(CostantiControlStation.LABEL_RICEVUTA_ASINCRONA_ASIMMETRICA);
  11150.             }
  11151.         }
  11152.         if(supportoGestioneManifest) {
  11153.             if(gestioneManifest!=null && StatoFunzionalita.ABILITATO.equals(gestioneManifest)) {
  11154.                 if(bf.length()>0) {
  11155.                     bf.append(", ");
  11156.                 }
  11157.                 bf.append(CostantiControlStation.LABEL_GESTIONE_MANIFEST);
  11158.                 if(bfTooltips.length()>0) {
  11159.                     bfTooltips.append("\n");
  11160.                 }
  11161.                 bfTooltips.append(CostantiControlStation.LABEL_GESTIONE_MANIFEST);
  11162.             }
  11163.         }
  11164.         if(configPortaHandler!=null) {
  11165.             StringBuilder sbRequest = new StringBuilder();
  11166.             if(configPortaHandler.getRequest()!=null) {
  11167.                 if(configPortaHandler.getRequest().sizePreInList()>0) {
  11168.                     if(sbRequest.length()>0) {
  11169.                         sbRequest.append(", ");
  11170.                     }
  11171.                     sbRequest.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_PRE_IN_SHORT).append(" (").append(configPortaHandler.getRequest().sizePreInList()).append(")");
  11172.                 }
  11173.                 if(configPortaHandler.getRequest().sizeInList()>0) {
  11174.                     if(sbRequest.length()>0) {
  11175.                         sbRequest.append(", ");
  11176.                     }
  11177.                     sbRequest.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_SHORT).append(" (").append(configPortaHandler.getRequest().sizeInList()).append(")");
  11178.                 }
  11179.                 if(configPortaHandler.getRequest().sizeInProtocolInfoList()>0) {
  11180.                     if(sbRequest.length()>0) {
  11181.                         sbRequest.append(", ");
  11182.                     }
  11183.                     sbRequest.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_PROTOCOL_INFO_SHORT).append(" (").append(configPortaHandler.getRequest().sizeInProtocolInfoList()).append(")");
  11184.                 }
  11185.                 if(configPortaHandler.getRequest().sizeOutList()>0) {
  11186.                     if(sbRequest.length()>0) {
  11187.                         sbRequest.append(", ");
  11188.                     }
  11189.                     sbRequest.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_OUT_SHORT).append(" (").append(configPortaHandler.getRequest().sizeOutList()).append(")");
  11190.                 }  
  11191.                 if(configPortaHandler.getRequest().sizePostOutList()>0) {
  11192.                     if(sbRequest.length()>0) {
  11193.                         sbRequest.append(", ");
  11194.                     }
  11195.                     sbRequest.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_POST_OUT_SHORT).append(" (").append(configPortaHandler.getRequest().sizePostOutList()).append(")");
  11196.                 }  
  11197.             }
  11198.             StringBuilder sbResponse = new StringBuilder();
  11199.             if(configPortaHandler.getResponse()!=null) {
  11200.                 if(configPortaHandler.getResponse().sizePreInList()>0) {
  11201.                     if(sbResponse.length()>0) {
  11202.                         sbResponse.append(", ");
  11203.                     }
  11204.                     sbResponse.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_PRE_IN_SHORT).append(" (").append(configPortaHandler.getResponse().sizePreInList()).append(")");
  11205.                 }
  11206.                 if(configPortaHandler.getResponse().sizeInList()>0) {
  11207.                     if(sbResponse.length()>0) {
  11208.                         sbResponse.append(", ");
  11209.                     }
  11210.                     sbResponse.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_SHORT).append(" (").append(configPortaHandler.getResponse().sizeInList()).append(")");
  11211.                 }
  11212.                 if(configPortaHandler.getResponse().sizeInProtocolInfoList()>0) {
  11213.                     if(sbResponse.length()>0) {
  11214.                         sbResponse.append(", ");
  11215.                     }
  11216.                     sbResponse.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_PROTOCOL_INFO_SHORT).append(" (").append(configPortaHandler.getResponse().sizeInProtocolInfoList()).append(")");
  11217.                 }
  11218.                 if(configPortaHandler.getResponse().sizeOutList()>0) {
  11219.                     if(sbResponse.length()>0) {
  11220.                         sbResponse.append(", ");
  11221.                     }
  11222.                     sbResponse.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_OUT_SHORT).append(" (").append(configPortaHandler.getResponse().sizeOutList()).append(")");
  11223.                 }  
  11224.                 if(configPortaHandler.getResponse().sizePostOutList()>0) {
  11225.                     if(sbResponse.length()>0) {
  11226.                         sbResponse.append(", ");
  11227.                     }
  11228.                     sbResponse.append(PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_POST_OUT_SHORT).append(" (").append(configPortaHandler.getResponse().sizePostOutList()).append(")");
  11229.                 }  
  11230.             }
  11231.             if(sbRequest.length()>0 || sbResponse.length()>0) {
  11232.                 if(bf.length()>0) {
  11233.                     bf.append(", ");
  11234.                 }
  11235.                 bf.append(CostantiControlStation.LABEL_MESSAGE_HANDLER);
  11236.                 if(sbRequest.length()>0) {
  11237.                     if(bfTooltips.length()>0) {
  11238.                         bfTooltips.append("\n");
  11239.                     }
  11240.                     bfTooltips.append(CostantiControlStation.LABEL_REQUEST_MESSAGE_HANDLER).append(": ").append(sbRequest.toString());
  11241.                 }
  11242.                 if(sbResponse.length()>0) {
  11243.                     if(bfTooltips.length()>0) {
  11244.                         bfTooltips.append("\n");
  11245.                     }
  11246.                     bfTooltips.append(CostantiControlStation.LABEL_RESPONSE_MESSAGE_HANDLER).append(": ").append(sbResponse.toString());
  11247.                 }
  11248.             }
  11249.         }
  11250.        
  11251.         if(bf.length()>0) {
  11252.             de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
  11253.             String vAbilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO) : CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11254.             de.setStatusValue(vAbilitato+" [ "+bf.toString()+" ]");
  11255.             de.setStatusToolTip(bfTooltips.toString());
  11256.         }
  11257.         else {
  11258.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  11259.             String vDisabilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) : CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  11260.             de.setStatusValue(vDisabilitato);
  11261.         }
  11262.        
  11263.     }
  11264.    
  11265.     public void setStatoExtendedList(DataElement de, int size, String stato, String statoTooltip) {
  11266.         setStatoExtendedList(de, size, stato, statoTooltip, true);
  11267.     }
  11268.     public void setStatoExtendedList(DataElement de, int size, String stato, String statoTooltip, boolean upperFirstChar) {
  11269.        
  11270.         de.setType(DataElementType.CHECKBOX);
  11271.        
  11272.         if(size>0) {
  11273.             de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
  11274.             String vAbilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_ABILITATO) : CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11275.             if(stato!=null) {
  11276.                 de.setStatusValue(vAbilitato+" [" +stato+ " ]");
  11277.             }
  11278.             else {
  11279.                 de.setStatusValue(vAbilitato);
  11280.             }
  11281.             if(statoTooltip!=null) {
  11282.                 de.setStatusToolTip(statoTooltip);
  11283.             }
  11284.             else {
  11285.                 de.setStatusToolTip("Sono registrate "+size+" proprietà");
  11286.             }
  11287.         }
  11288.         else {
  11289.             de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
  11290.             String vDisabilitato = upperFirstChar ? this.getUpperFirstChar(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) : CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  11291.             de.setStatusValue(vDisabilitato);
  11292.         }
  11293.        
  11294.     }
  11295.    
  11296.     public String getLabelStatoGestioneToken(String gestioneToken) {
  11297.         String label = CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  11298.        
  11299.         if(gestioneToken!=null && StatoFunzionalita.ABILITATO.getValue().equals(gestioneToken)) {
  11300.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11301.         }
  11302.         return label;
  11303.     }
  11304.    
  11305.     public String getLabelStatoAutenticazione(String autenticazione, String autenticazioneOpzionale, String autenticazioneCustom) {
  11306.         String label = CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  11307.        
  11308.         if(autenticazione != null && !TipoAutenticazione.DISABILITATO.equals(autenticazione))
  11309.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11310.        
  11311.         if(autenticazioneOpzionale != null && ServletUtils.isCheckBoxEnabled(autenticazioneOpzionale))
  11312.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11313.        
  11314.         return label;
  11315.     }
  11316.    
  11317.     public String getLabelStatoAutorizzazione(String autorizzazione, String autorizzazioneContenuti,String autorizzazioneCustom) {
  11318.         String label = CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  11319.        
  11320.         if(!AutorizzazioneUtilities.STATO_DISABILITATO.equals(autorizzazione))
  11321.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11322.        
  11323.         if(StringUtils.isNotEmpty(autorizzazioneContenuti))
  11324.             return CostantiControlStation.DEFAULT_VALUE_ABILITATO;
  11325.        
  11326.         return label;
  11327.     }
  11328.    
  11329.    
  11330.     public DataElement getServiceBindingDataElement(ServiceBinding serviceBinding) throws DriverControlStationException{
  11331.         return getServiceBindingDataElement(null, false, serviceBinding, true);
  11332.     }
  11333.    
  11334.     public DataElement getServiceBindingDataElement(IProtocolFactory<?> protocolFactory, boolean used, ServiceBinding serviceBinding) throws DriverControlStationException{
  11335.         return getServiceBindingDataElement(protocolFactory, used, serviceBinding, false);
  11336.     }
  11337.    
  11338.     public DataElement getServiceBindingDataElement(IProtocolFactory<?> protocolFactory, boolean used, ServiceBinding serviceBinding, boolean forceHidden) throws DriverControlStationException{
  11339.         DataElement de = null;
  11340.         if(!forceHidden) {
  11341.             try {
  11342.                 List<ServiceBinding> serviceBindingList = this.core.getServiceBindingList(protocolFactory);
  11343.                
  11344.                 de = new DataElement();
  11345.                 de.setName(CostantiControlStation.PARAMETRO_SERVICE_BINDING);
  11346.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING);
  11347.                
  11348.                 if(serviceBindingList != null && serviceBindingList.size() > 1){
  11349.                     if(used){
  11350.                         de.setType(DataElementType.TEXT);
  11351.                         de.setValue(serviceBinding.toString());
  11352.                     }else {
  11353.                         de.setSelected(serviceBinding.toString());
  11354.                         de.setType(DataElementType.SELECT);
  11355.                         de.setPostBack(true);
  11356.    
  11357.                         String [] values = new String[serviceBindingList.size()];
  11358.                         String [] labels = new String[serviceBindingList.size()];
  11359.                         for (int i =0; i < serviceBindingList.size() ; i ++) {
  11360.                             ServiceBinding serviceBinding2 = serviceBindingList.get(i);
  11361.                             switch (serviceBinding2) {
  11362.                             case REST:
  11363.                                 labels[i] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_REST;
  11364.                                 values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST;
  11365.                                 break;
  11366.                             case SOAP:
  11367.                             default:
  11368.                                 labels[i] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_SOAP;
  11369.                                 values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP;
  11370.                                 break;
  11371.                             }
  11372.                         }
  11373.                        
  11374.                         de.setValues(values);
  11375.                         de.setLabels(labels);
  11376.                     }
  11377.                 } else {
  11378.                     de.setValue(serviceBinding.toString());
  11379.                     de.setType(DataElementType.HIDDEN);
  11380.                 }
  11381.                 de.setSize(this.getSize());
  11382.             } catch (Exception e) {
  11383.                 this.logError("Exception: " + e.getMessage(), e);
  11384.                 throw new DriverControlStationException(e);
  11385.             }
  11386.         } else {
  11387.             de = new DataElement();
  11388.             de.setName(CostantiControlStation.PARAMETRO_SERVICE_BINDING);
  11389.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING);
  11390.             de.setValue(serviceBinding !=null ? serviceBinding.toString() : null);
  11391.             de.setType(DataElementType.HIDDEN);
  11392.         }
  11393.         return de;
  11394.     }
  11395.     public DataElement getMessageTypeDataElement(String parametroMessageType, IProtocolFactory<?> protocolFactory, ServiceBinding serviceBinding,MessageType value) throws DriverControlStationException{
  11396.         return this.getMessageTypeDataElement(parametroMessageType, protocolFactory, serviceBinding, value, this.isModalitaStandard()); // per defaut viene visualizzato solo se siamo in interfaccia avanzata
  11397.     }
  11398.    
  11399.     public DataElement getMessageTypeDataElement(String parametroMessageType, IProtocolFactory<?> protocolFactory, ServiceBinding serviceBinding,MessageType value, boolean hidden) throws DriverControlStationException{
  11400.         DataElement de = null;
  11401.         try {
  11402.             List<MessageType> messageTypeList = this.core.getMessageTypeList(protocolFactory, serviceBinding);
  11403.            
  11404.             de = new DataElement();
  11405.             de.setName(parametroMessageType);
  11406.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE);
  11407.            
  11408.             if(!hidden && messageTypeList != null && messageTypeList.size() > 1){
  11409.                     de.setSelected(value != null ? value.toString() : null);
  11410.                     de.setType(DataElementType.SELECT);
  11411.                     //de.setPostBack(true);

  11412.                     String [] values = new String[messageTypeList.size()+ 1];
  11413.                     String [] labels = new String[messageTypeList.size()+ 1];
  11414.                     labels[0] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_DEFAULT;
  11415.                     values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_DEFAULT;
  11416.                     for (int i = 1 ; i <= messageTypeList.size() ; i ++) {
  11417.                         MessageType type = messageTypeList.get(i-1);
  11418.                         switch (type) {
  11419.                         case BINARY:
  11420.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_BINARY;
  11421.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_BINARY;
  11422.                             break;
  11423.                         case JSON:
  11424.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_JSON;
  11425.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_JSON;
  11426.                             break;
  11427.                         case MIME_MULTIPART:
  11428.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_MIME_MULTIPART;
  11429.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_MIME_MULTIPART;
  11430.                             break;
  11431.                         case SOAP_11:
  11432.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_SOAP_11;
  11433.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_SOAP_11;
  11434.                             break;
  11435.                         case SOAP_12:
  11436.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_SOAP_12;
  11437.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_SOAP_12;
  11438.                             break;
  11439.                         case XML:
  11440.                         default:
  11441.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_MESSAGE_TYPE_XML;
  11442.                             values[i] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_MESSAGE_TYPE_XML;
  11443.                             break;
  11444.                         }
  11445.                     }
  11446.                    
  11447.                     de.setValues(values);
  11448.                     de.setLabels(labels);
  11449.             } else {
  11450.                 de.setValue(value != null ? value.toString() : null);
  11451.                 de.setType(DataElementType.HIDDEN);
  11452.             }
  11453.             de.setSize(this.getSize());
  11454.         } catch (Exception e) {
  11455.             this.logError("Exception: " + e.getMessage(), e);
  11456.             throw new DriverControlStationException(e);
  11457.         }
  11458.         return de;
  11459.     }
  11460.    
  11461.     public DataElement getInterfaceTypeDataElement(TipoOperazione tipoOperazione, IProtocolFactory<?> protocolFactory, ServiceBinding serviceBinding,org.openspcoop2.protocol.manifest.constants.InterfaceType value) throws DriverControlStationException{
  11462.         DataElement de = null;
  11463.         try {
  11464.             List<org.openspcoop2.protocol.manifest.constants.InterfaceType> interfaceTypeList = this.core.getInterfaceTypeList(protocolFactory, serviceBinding);
  11465.            
  11466.             de = new DataElement();
  11467.             de.setName(CostantiControlStation.PARAMETRO_INTERFACE_TYPE);
  11468.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE);
  11469.            
  11470.             switch (tipoOperazione) {
  11471.             case ADD:
  11472.                 if(interfaceTypeList != null && interfaceTypeList.size() > 1){
  11473.                     de.setSelected(value != null ? value.toString() : null);
  11474.                     de.setType(DataElementType.SELECT);
  11475.                     de.setPostBack(true);

  11476.                     String [] values = new String[interfaceTypeList.size()];
  11477.                     String [] labels = new String[interfaceTypeList.size()];
  11478.                     for (int i =0; i < interfaceTypeList.size() ; i ++) {
  11479.                         org.openspcoop2.protocol.manifest.constants.InterfaceType type = interfaceTypeList.get(i);
  11480.                         switch (type) {
  11481.                         case OPEN_API_3:
  11482.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_OPEN_API_3;
  11483.                             values[i] = CostantiControlStation.VALUE_PARAMETRO_INTERFACE_TYPE_OPEN_API_3;
  11484.                             break;
  11485.                         case SWAGGER_2:
  11486.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_SWAGGER_2;
  11487.                             values[i] = CostantiControlStation.VALUE_PARAMETRO_INTERFACE_TYPE_SWAGGER_2;
  11488.                             break;
  11489.                         case WADL:
  11490.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WADL;
  11491.                             values[i] = CostantiControlStation.VALUE_PARAMETRO_INTERFACE_TYPE_WADL;
  11492.                             break;
  11493.                         case WSDL_11:
  11494.                         default:
  11495.                             labels[i] = CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WSDL_11;
  11496.                             values[i] = CostantiControlStation.VALUE_PARAMETRO_INTERFACE_TYPE_WSDL_11;
  11497.                             break;
  11498.                         }
  11499.                     }
  11500.                    
  11501.                     de.setValues(values);
  11502.                     de.setLabels(labels);
  11503.             } else {
  11504.                 de.setValue(value != null ? value.toString() : null);
  11505.                 de.setType(DataElementType.HIDDEN);
  11506.             }
  11507.                 break;
  11508.             case CHANGE:
  11509.             case DEL:
  11510.             case LIST:
  11511.             case LOGIN:
  11512.             case LOGOUT:
  11513.             case OTHER:
  11514.             default:
  11515.                 de.setValue(value != null ? value.toString() : null);
  11516.                 de.setType(DataElementType.HIDDEN);
  11517.                 break;
  11518.             }
  11519.            
  11520.             de.setSize(this.getSize());
  11521.         } catch (Exception e) {
  11522.             this.logError("Exception: " + e.getMessage(), e);
  11523.             throw new DriverControlStationException(e);
  11524.         }
  11525.         return de;
  11526.     }
  11527.    
  11528.     public boolean porteAppAzioneCheckData(TipoOperazione add, List<String> azioniOccupate, List<MappingErogazionePortaApplicativa> list) throws DriverControlStationException {
  11529.         String[] azionis = this.getParameterValues(CostantiControlStation.PARAMETRO_AZIONI);
  11530.        
  11531.         if(azionis == null || azionis.length == 0) {
  11532.             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_PORTA_NON_PUO_ESSERE_VUOTA);
  11533.             return false;
  11534.         }
  11535.        
  11536.         for (String azione : azionis) {
  11537.             if(azioniOccupate.contains(azione)) {
  11538.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_PORTA_GIA_PRESENTE);
  11539.                 return false;          
  11540.             }
  11541.         }
  11542.        
  11543.         if(checkAzioniUtilizzateErogazione(list, azionis)==false) {
  11544.             return false;
  11545.         }
  11546.        
  11547.         return true;
  11548.     }
  11549.    
  11550.     public boolean porteDelAzioneCheckData(TipoOperazione add, List<String> azioniOccupate, List<MappingFruizionePortaDelegata> list) throws DriverControlStationException {
  11551.         String[] azionis = this.getParameterValues(CostantiControlStation.PARAMETRO_AZIONI);
  11552.        
  11553.         if(azionis == null || azionis.length == 0) {
  11554.             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_PORTA_NON_PUO_ESSERE_VUOTA);
  11555.             return false;
  11556.         }
  11557.        
  11558.         for (String azione : azionis) {
  11559.             if(azioniOccupate.contains(azione)) {
  11560.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_PORTA_GIA_PRESENTE);
  11561.                 return false;          
  11562.             }
  11563.         }
  11564.        
  11565.         if(checkAzioniUtilizzateFruizione(list, azionis)==false) {
  11566.             return false;
  11567.         }
  11568.        
  11569.         return true;
  11570.     }

  11571.     public String getMessaggioConfermaModificaRegolaMapping(boolean fromAPI, boolean isDefault,List<String> listaAzioni,ServiceBinding serviceBinding, String gruppo,
  11572.             boolean abilitazione, boolean multiline,boolean listElement) throws DriverConfigurazioneException {
  11573.         String pre = Costanti.HTML_MODAL_SPAN_PREFIX;
  11574.         String post = Costanti.HTML_MODAL_SPAN_SUFFIX;
  11575.        
  11576.         if(fromAPI) {
  11577.             return pre + ( abilitazione ? CostantiControlStation.MESSAGGIO_CONFERMA_ABILITAZIONE_FROM_API : CostantiControlStation.MESSAGGIO_CONFERMA_DISABILITAZIONE_FROM_API)  + post;
  11578.         }
  11579.         else {
  11580.             return pre + ( abilitazione ? MessageFormat.format(CostantiControlStation.MESSAGGIO_CONFERMA_ABILITAZIONE_GRUPPO,gruppo) : MessageFormat.format(CostantiControlStation.MESSAGGIO_CONFERMA_DISABILITAZIONE_GRUPPO,gruppo) )  + post;
  11581.         }
  11582.     }

  11583.     public String getLabelAzione(ServiceBinding serviceBinding) {
  11584.         return ServiceBinding.REST.equals(serviceBinding) ? CostantiControlStation.LABEL_PARAMETRO_RISORSA : CostantiControlStation.LABEL_PARAMETRO_AZIONE;
  11585.     }
  11586.     public String getLabelAzioni(ServiceBinding serviceBinding) {
  11587.         return ServiceBinding.REST.equals(serviceBinding) ? CostantiControlStation.LABEL_PARAMETRO_RISORSE : CostantiControlStation.LABEL_PARAMETRO_AZIONI;
  11588.     }
  11589.     public String getLabelAzioniDi(ServiceBinding serviceBinding) {
  11590.         return ServiceBinding.REST.equals(serviceBinding) ? CostantiControlStation.LABEL_PARAMETRO_RISORSE_CONFIG_DI : CostantiControlStation.LABEL_PARAMETRO_AZIONI_CONFIG_DI;
  11591.     }
  11592.     public String getLabelAllAzioniRidefiniteTooltip(ServiceBinding serviceBinding) {
  11593.         return ServiceBinding.REST.equals(serviceBinding) ? CostantiControlStation.LABEL_PARAMETRO_DEFAULT_ALL_RISORSE_RIDEFINITE_TOOLTIP : CostantiControlStation.LABEL_PARAMETRO_DEFAULT_ALL_AZIONI_RIDEFINITE_TOOLTIP;
  11594.     }
  11595.     public String getLabelAllAzioniConfigurate(ServiceBinding serviceBinding) {
  11596.         return ServiceBinding.REST.equals(serviceBinding) ? CostantiControlStation.LABEL_AGGIUNTA_RISORSE_COMPLETATA : CostantiControlStation.LABEL_AGGIUNTA_AZIONI_COMPLETATA;
  11597.     }
  11598.    
  11599.     public List<DataElement> addPorteAzioneToDati(TipoOperazione add, List<DataElement> dati, String string,
  11600.             String[] azioniDisponibiliList, String[] azioniDisponibiliLabelList, String[] azioni, ServiceBinding serviceBinding) {
  11601.        
  11602.         String label = this.getLabelAzioni(serviceBinding);
  11603.        
  11604.         DataElement de = new DataElement();
  11605.         de.setLabel(label);
  11606.         de.setType(DataElementType.TITLE);
  11607.         dati.add(de);
  11608.        
  11609.         // Azione
  11610.         de = new DataElement();
  11611.         de.setLabel(label);
  11612.         de.setValues(azioniDisponibiliList);
  11613.         de.setLabels(azioniDisponibiliLabelList);
  11614.         de.setSelezionati(azioni);
  11615.         de.setType(DataElementType.MULTI_SELECT);
  11616.         de.setName(CostantiControlStation.PARAMETRO_AZIONI);
  11617.         de.setRows(15);
  11618.         de.setRequired(true);
  11619.         dati.add(de);
  11620.        
  11621.         return dati;
  11622.     }
  11623.    
  11624.     // Prepara la lista di azioni delle porte
  11625.     public void preparePorteAzioneList(ISearch ricerca,
  11626.             List<String> listaAzioniParamDaPaginare, String idPorta, Integer parentConfigurazione, List<Parameter> lstParametriBreadcrumbs,
  11627.             String nomePorta, String objectName, List<Parameter> listaParametriSessione,
  11628.             String labelPerPorta, ServiceBinding serviceBinding, AccordoServizioParteComuneSintetico aspc) throws DriverControlStationException {
  11629.         try {
  11630.             ServletUtils.addListElementIntoSession(this.request, this.session, objectName,listaParametriSessione);

  11631.             // setto la barra del titolo

  11632.             String label = this.getLabelAzione(serviceBinding);
  11633.                        
  11634.             int idLista = -1;
  11635.             if(PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_AZIONE.equals(objectName)) {
  11636.                 idLista = Liste.PORTE_DELEGATE_AZIONI;
  11637.             }
  11638.             else {
  11639.                 idLista = Liste.PORTE_APPLICATIVE_AZIONI;
  11640.             }
  11641.             int limit = ricerca.getPageSize(idLista);
  11642.             int offset = ricerca.getIndexIniziale(idLista);
  11643.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  11644.             org.openspcoop2.core.registry.constants.HttpMethod httpMethod = null;
  11645.             if(!ServiceBinding.SOAP.equals(serviceBinding)) {
  11646.                 String filterHttpMethod = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_HTTP_METHOD);
  11647.                 this.addFilterHttpMethod(filterHttpMethod, false);
  11648.                
  11649.                 if(filterHttpMethod!=null) {
  11650.                     httpMethod = org.openspcoop2.core.registry.constants.HttpMethod.toEnumConstant(filterHttpMethod);
  11651.                 }
  11652.             }
  11653.            
  11654.             HashMap<String, ResourceSintetica> mapIdResourceToMethodPath = new HashMap<String, ResourceSintetica>();
  11655.            
  11656.             List<String> listaAzioniPaginata = new ArrayList<>();
  11657.             if(listaAzioniParamDaPaginare!=null && !listaAzioniParamDaPaginare.isEmpty()) {
  11658.                 List<String> listaAzioniDopoSearch = new ArrayList<>();
  11659.                
  11660.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  11661.                     for (int i = 0; i < listaAzioniParamDaPaginare.size(); i++) {
  11662.                         String idRisorsa = listaAzioniParamDaPaginare.get(i);
  11663.                        
  11664.                         // verifico nome
  11665.                         if(search!=null && !"".equals(search)) {
  11666.                             if(!idRisorsa.toLowerCase().contains(search.toLowerCase())) {
  11667.                                 continue;
  11668.                             }
  11669.                         }
  11670.                        
  11671.                         // azione che ha un match
  11672.                         listaAzioniDopoSearch.add(idRisorsa);
  11673.                     }
  11674.                 }
  11675.                 else {
  11676.                     for (int i = 0; i < listaAzioniParamDaPaginare.size(); i++) {
  11677.                         String idRisorsa = listaAzioniParamDaPaginare.get(i);
  11678.                         ResourceSintetica risorsa = null;
  11679.                         for (ResourceSintetica resourceTmp : aspc.getResource()) {
  11680.                             if(resourceTmp.getNome().equals(idRisorsa)) {
  11681.                                 risorsa = resourceTmp;
  11682.                                 break;
  11683.                             }
  11684.                         }
  11685.                        
  11686.                         if(risorsa==null) {
  11687.                             throw new DriverControlStationException("Risorsa con id '"+idRisorsa+"' non esistente ?");
  11688.                         }
  11689.                        
  11690.                         // verifico path
  11691.                         if(search!=null && !"".equals(search)) {
  11692.                             if(risorsa.getPath()==null || !risorsa.getPath().toLowerCase().contains(search.toLowerCase())) {
  11693.                                 continue;
  11694.                             }
  11695.                         }
  11696.                        
  11697.                         // verifico metodo
  11698.                         if(httpMethod!=null) {
  11699.                             if(risorsa.getMethod()==null || !risorsa.getMethod().equals(httpMethod)) {
  11700.                                 continue;
  11701.                             }
  11702.                         }
  11703.                        
  11704.                         // azione che ha un match sia con path che con metodo
  11705.                         listaAzioniDopoSearch.add(idRisorsa);
  11706.                         if(risorsa!=null) {
  11707.                             mapIdResourceToMethodPath.put(idRisorsa, risorsa);
  11708.                         }
  11709.                     }
  11710.                 }
  11711.                
  11712.                 ricerca.setNumEntries(idLista, listaAzioniDopoSearch.size());
  11713.                
  11714.                 if(listaAzioniDopoSearch!=null && !listaAzioniDopoSearch.isEmpty()) {
  11715.                     for (int i = 0; i < listaAzioniDopoSearch.size(); i++) {
  11716.                         if(i>=offset && i<(offset+limit)) {
  11717.                             listaAzioniPaginata.add(listaAzioniDopoSearch.get(i));
  11718.                         }
  11719.                     }
  11720.                 }
  11721.             }
  11722.             else {
  11723.                 ricerca.setNumEntries(idLista, listaAzioniParamDaPaginare!=null ? listaAzioniParamDaPaginare.size() : 0);
  11724.             }
  11725.            
  11726.             this.pd.setIndex(offset);
  11727.             this.pd.setPageSize(limit);
  11728.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));
  11729.            
  11730.             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  11731.                 this.pd.setSearchLabel(this.getLabelAzione(serviceBinding));
  11732.             }
  11733.             else {
  11734.                 this.pd.setSearchLabel(AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_RESOURCES_PATH);
  11735.             }
  11736.            
  11737.             if (search!=null && !search.equals("")) {
  11738.                 ServletUtils.enabledPageDataSearch(this.pd, label, search);
  11739.             }
  11740.            
  11741.             List<String> listaAzioni = new ArrayList<>();
  11742.             HashMap<String, ResourceSintetica> mapToResource = new HashMap<>();
  11743.             for (String azione : listaAzioniPaginata) {
  11744.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  11745.                     listaAzioni.add(azione);
  11746.                 }
  11747.                 else {
  11748.                     ResourceSintetica risorsa = mapIdResourceToMethodPath.get(azione);
  11749.                     String nomeRisorsaConPathPerOrderBy =
  11750.                             (risorsa.getPath()==null ? "*" : risorsa.getPath())
  11751.                             +" " +
  11752.                             (risorsa.getMethod()==null ? "ALL" : risorsa.getMethod())   ;
  11753.                     listaAzioni.add(nomeRisorsaConPathPerOrderBy);
  11754.                     mapToResource.put(nomeRisorsaConPathPerOrderBy, risorsa);
  11755.                 }
  11756.             }
  11757.             Collections.sort(listaAzioni);
  11758.            
  11759.             lstParametriBreadcrumbs.add(new Parameter(labelPerPorta,null));

  11760.             // setto la barra del titolo
  11761.             ServletUtils.setPageDataTitle(this.pd, lstParametriBreadcrumbs.toArray(new Parameter[lstParametriBreadcrumbs.size()]));

  11762.             // setto le label delle colonne
  11763.             String[] labels = null;
  11764.             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  11765.                 labels = new String[1];
  11766.                 labels[0] = label;
  11767.             }
  11768.             else {
  11769.                 labels = new String[2];
  11770.                 //labels[0] = label;
  11771.                 //labels[0] = AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_RESOURCES_HTTP_METHOD;
  11772.                 labels[0] = CostantiControlStation.LABEL_PARAMETRO_HTTP_METHOD_COMPACT;
  11773.                 labels[1] = AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_RESOURCES_PATH;
  11774.             }
  11775.             this.pd.setLabels(labels);

  11776.             // preparo i dati
  11777.             List<List<DataElement>> dati = new ArrayList<>();

  11778.             if (listaAzioni != null) {
  11779.                
  11780.                 Iterator<String> it = listaAzioni.iterator();
  11781.                 while (it.hasNext()) {
  11782.                     String nomeAzione = it.next();

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

  11784.                     if(ServiceBinding.SOAP.equals(serviceBinding)) {
  11785.                         DataElement de = new DataElement();
  11786.                         de.setValue(nomeAzione);
  11787.                         de.setIdToRemove(nomeAzione);
  11788.                         e.add(de);
  11789.                     }
  11790.                     else {
  11791.                         ResourceSintetica risorsa = mapToResource.get(nomeAzione);
  11792.                         String labelParametroApcResourcesHttpMethodQualsiasi = AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_RESOURCES_HTTP_METHOD_QUALSIASI;
  11793.                         //HTTP Method
  11794.                         DataElement de = getDataElementHTTPMethodResource(risorsa, labelParametroApcResourcesHttpMethodQualsiasi);  
  11795.                         e.add(de);
  11796.                        
  11797.                         de = new DataElement();
  11798.                         if(risorsa.getPath()==null || "".equals(risorsa.getPath())) {
  11799.                             de.setValue(AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_RESOURCES_PATH_QUALSIASI);
  11800.                         }
  11801.                         else {
  11802.                             de.setValue(risorsa.getPath());
  11803.                         }
  11804.                         de.setToolTip(risorsa.getNome());
  11805.                         de.setIdToRemove(risorsa.getNome());
  11806.                         e.add(de);
  11807.                     }

  11808.                     dati.add(e);
  11809.                 }
  11810.             }

  11811.            
  11812.             this.pd.setDati(dati);
  11813.             this.pd.setAddButton(true);

  11814.         } catch (Exception e) {
  11815.             this.logError("Exception: " + e.getMessage(), e);
  11816.             throw new DriverControlStationException(e);
  11817.         }
  11818.     }
  11819.    
  11820.     public DataElement getDataElementHTTPMethodResource(org.openspcoop2.core.registry.beans.ResourceSintetica risorsa,  String labelParametroApcResourcesHttpMethodQualsiasi) {
  11821.         return getDataElementHTTPMethodResource(risorsa.getMethod(), labelParametroApcResourcesHttpMethodQualsiasi, null);
  11822.     }
  11823.     public DataElement getDataElementHTTPMethodResource(org.openspcoop2.core.registry.Resource risorsa, String labelParametroApcResourcesHttpMethodQualsiasi, String detailURL) {
  11824.         return getDataElementHTTPMethodResource(risorsa.getMethod(), labelParametroApcResourcesHttpMethodQualsiasi, detailURL);
  11825.     }
  11826.     public DataElement getDataElementHTTPMethodResource(HttpMethod httpMethod,  String labelParametroApcResourcesHttpMethodQualsiasi, String detailUrl) {
  11827.        
  11828.         DataElement de = new DataElement();

  11829.         String styleClass = "resource-method-block resource-method-default";
  11830.         if(httpMethod==null) {
  11831.             de.setValue(labelParametroApcResourcesHttpMethodQualsiasi);
  11832.         }
  11833.         else {
  11834.             de.setValue(httpMethod.toString());
  11835.            
  11836.             switch (httpMethod) {
  11837.             case DELETE:
  11838.                 styleClass = "resource-method-block resource-method-delete";
  11839.                 break;
  11840.             case GET:
  11841.                 styleClass = "resource-method-block resource-method-get";
  11842.                 break;
  11843.             case HEAD:
  11844.                 styleClass = "resource-method-block resource-method-head";
  11845.                 break;
  11846.             case LINK:
  11847.                 styleClass = "resource-method-block resource-method-link";
  11848.                 break;
  11849.             case OPTIONS:
  11850.                 styleClass = "resource-method-block resource-method-options";
  11851.                 break;
  11852.             case PATCH:
  11853.                 styleClass = "resource-method-block resource-method-patch";
  11854.                 break;
  11855.             case POST:
  11856.                 styleClass = "resource-method-block resource-method-post";
  11857.                 break;
  11858.             case PUT:
  11859.                 styleClass = "resource-method-block resource-method-put";
  11860.                 break;
  11861.             case TRACE:
  11862.                 styleClass = "resource-method-block resource-method-trace";
  11863.                 break;
  11864.             case UNLINK:
  11865.                 styleClass = "resource-method-block resource-method-unlink";
  11866.                 break;
  11867.             default:
  11868.                 styleClass = "resource-method-block resource-method-default";
  11869.                 break;
  11870.             }
  11871.         }
  11872.         if(StringUtils.isNotEmpty(detailUrl)) {
  11873.             StringBuilder onClickFunction = new StringBuilder();
  11874.             onClickFunction.append(Costanti.JS_FUNCTION_GO_TO_PREFIX);
  11875.             onClickFunction.append(detailUrl);
  11876.             onClickFunction.append(Costanti.JS_FUNCTION_GO_TO_SUFFIX);
  11877.             de.setOnClick(onClickFunction.toString());
  11878.             styleClass += " resource-method-block-pointer";
  11879.         }
  11880.        
  11881.         de.setLabelStyleClass(styleClass);
  11882.         de.setWidthPx(75);
  11883.         return de;
  11884.     }
  11885.    
  11886.    
  11887.     public void addFilterServiceBinding(String serviceBinding, boolean postBack, boolean showAPISuffix) throws DriverControlStationException{
  11888.         try {
  11889.             ServiceBinding[] serviceBindings = ServiceBinding.values();
  11890.            
  11891.             String [] values = new String[serviceBindings.length + 1];
  11892.             String [] labels = new String[serviceBindings.length + 1];
  11893.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11894.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11895.             for (int i =0; i < serviceBindings.length ; i ++) {
  11896.                 ServiceBinding serviceBinding2 = serviceBindings[i];
  11897.                 switch (serviceBinding2) {
  11898.                 case REST:
  11899.                     labels[i+1] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_REST;
  11900.                     values[i+1] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST.toLowerCase();
  11901.                     break;
  11902.                 case SOAP:
  11903.                 default:
  11904.                     labels[i+1] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_SOAP;
  11905.                     values[i+1] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP.toLowerCase();
  11906.                     break;
  11907.                 }
  11908.             }
  11909.            
  11910.             String selectedValue = serviceBinding != null ? serviceBinding : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11911.            
  11912.             String label = null;
  11913.             if(showAPISuffix) {
  11914.                 label = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_API;
  11915.             }
  11916.             else {
  11917.                 label = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING;
  11918.             }
  11919.            
  11920.             this.pd.addFilter(Filtri.FILTRO_SERVICE_BINDING, label, selectedValue, values, labels, postBack, this.getSize());
  11921.            
  11922.         } catch (Exception e) {
  11923.             this.logError("Exception: " + e.getMessage(), e);
  11924.             throw new DriverControlStationException(e);
  11925.         }
  11926.     }
  11927.    
  11928.     public void addFilterStatoAccordo(String statoAccordo, boolean postBack) throws DriverControlStationException{
  11929.         try {
  11930.             String [] stati = StatiAccordo.toArray();
  11931.             String [] statiLabel = StatiAccordo.toLabel();
  11932.             String [] values = new String[stati.length + 1];
  11933.             String [] labels = new String[stati.length + 1];
  11934.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11935.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11936.             for (int i =0; i < stati.length ; i ++) {
  11937.                 labels[i+1] = statiLabel[i];
  11938.                 values[i+1] = stati[i];
  11939.             }
  11940.            
  11941.             String selectedValue = statoAccordo != null ? statoAccordo : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  11942.            
  11943.             String label = CostantiControlStation.LABEL_PARAMETRO_STATO_PACKAGE;
  11944.            
  11945.             this.pd.addFilter(Filtri.FILTRO_STATO_ACCORDO, label, selectedValue, values, labels, postBack, this.getSize());
  11946.            
  11947.         } catch (Exception e) {
  11948.             this.logError("Exception: " + e.getMessage(), e);
  11949.             throw new DriverControlStationException(e);
  11950.         }
  11951.     }
  11952.    
  11953.     public void addFilterHttpMethod(String httpMethod, boolean postBack) throws DriverControlStationException{
  11954.         try {
  11955.             String [] metodi = org.openspcoop2.core.registry.constants.HttpMethod.toArray();
  11956.             String [] metodiLabel = metodi;
  11957.             String [] values = new String[metodi.length + 1];
  11958.             String [] labels = new String[metodi.length + 1];
  11959.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_HTTP_METHOD_QUALSIASI;
  11960.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_HTTP_METHOD_QUALSIASI;
  11961.             for (int i =0; i < metodi.length ; i ++) {
  11962.                 labels[i+1] = metodiLabel[i];
  11963.                 values[i+1] = metodi[i];
  11964.             }
  11965.            
  11966.             String selectedValue = httpMethod != null ? httpMethod : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_HTTP_METHOD_QUALSIASI;
  11967.            
  11968.             String label = CostantiControlStation.LABEL_PARAMETRO_HTTP_METHOD;
  11969.            
  11970.             this.pd.addFilter(Filtri.FILTRO_HTTP_METHOD, label, selectedValue, values, labels, postBack, this.getSize());
  11971.            
  11972.         } catch (Exception e) {
  11973.             this.logError("Exception: " + e.getMessage(), e);
  11974.             throw new DriverControlStationException(e);
  11975.         }
  11976.     }
  11977.    
  11978.     public void addFilterRuoloTipologia(String ruoloTipologia, boolean postBack) throws DriverControlStationException{
  11979.         try {
  11980.             String [] metodi = new String[2];
  11981.             metodi[0] = RuoloTipologia.INTERNO.getValue();
  11982.             metodi[1] = RuoloTipologia.ESTERNO.getValue();
  11983.             String [] metodiLabel = new String[2];
  11984.             metodiLabel[0] = CostantiControlStation.RUOLI_TIPOLOGIA_LABEL_INTERNO;
  11985.             metodiLabel[1] = CostantiControlStation.RUOLI_TIPOLOGIA_LABEL_ESTERNO;
  11986.             String [] values = new String[metodi.length + 1];
  11987.             String [] labels = new String[metodi.length + 1];
  11988.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_RUOLO_TIPOLOGIA_QUALSIASI;
  11989.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_TIPOLOGIA_QUALSIASI;
  11990.             for (int i =0; i < metodi.length ; i ++) {
  11991.                 labels[i+1] = metodiLabel[i];
  11992.                 values[i+1] = metodi[i];
  11993.             }
  11994.            
  11995.             String selectedValue = ruoloTipologia != null ? ruoloTipologia : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_TIPOLOGIA_QUALSIASI;
  11996.            
  11997.             String label = CostantiControlStation.LABEL_PARAMETRO_RUOLO_TIPOLOGIA;
  11998.            
  11999.             this.pd.addFilter(Filtri.FILTRO_RUOLO_TIPOLOGIA, label, selectedValue, values, labels, postBack, this.getSize());
  12000.            
  12001.         } catch (Exception e) {
  12002.             this.logError("Exception: " + e.getMessage(), e);
  12003.             throw new DriverControlStationException(e);
  12004.         }
  12005.     }
  12006.    
  12007.     public void addFilterRuoloContesto(String ruoloContesto, boolean postBack) throws DriverControlStationException{
  12008.         try {
  12009.             String [] metodi = new String[2];
  12010.             metodi[0] = RuoloContesto.PORTA_APPLICATIVA.getValue();
  12011.             metodi[1] = RuoloContesto.PORTA_DELEGATA.getValue();
  12012.             String [] metodiLabel = new String[2];
  12013.             metodiLabel[0] = CostantiControlStation.RUOLI_CONTESTO_UTILIZZO_LABEL_EROGAZIONE;
  12014.             metodiLabel[1] = CostantiControlStation.RUOLI_CONTESTO_UTILIZZO_LABEL_FRUIZIONE;
  12015.             String [] values = new String[metodi.length + 1];
  12016.             String [] labels = new String[metodi.length + 1];
  12017.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_RUOLO_CONTESTO_QUALSIASI;
  12018.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_CONTESTO_QUALSIASI;
  12019.             for (int i =0; i < metodi.length ; i ++) {
  12020.                 labels[i+1] = metodiLabel[i];
  12021.                 values[i+1] = metodi[i];
  12022.             }
  12023.            
  12024.             String selectedValue = ruoloContesto != null ? ruoloContesto : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_CONTESTO_QUALSIASI;
  12025.            
  12026.             String label = CostantiControlStation.LABEL_PARAMETRO_RUOLO_CONTESTO;
  12027.            
  12028.             this.pd.addFilter(Filtri.FILTRO_RUOLO_CONTESTO, label, selectedValue, values, labels, postBack, this.getSize());
  12029.            
  12030.         } catch (Exception e) {
  12031.             this.logError("Exception: " + e.getMessage(), e);
  12032.             throw new DriverControlStationException(e);
  12033.         }
  12034.     }
  12035.    
  12036.     public void addFilterScopeTipologia(String scopeTipologia, boolean postBack) throws DriverControlStationException{
  12037.         try {
  12038.             String [] metodi = new String[2];
  12039.             metodi[0] = "interno"; //RuoloTipologia.INTERNO.getValue();
  12040.             metodi[1] = "esterno"; //RuoloTipologia.ESTERNO.getValue();
  12041.             String [] metodiLabel = new String[2];
  12042.             metodiLabel[0] = CostantiControlStation.SCOPE_TIPOLOGIA_LABEL_INTERNO;
  12043.             metodiLabel[1] = CostantiControlStation.SCOPE_TIPOLOGIA_LABEL_ESTERNO;
  12044.             String [] values = new String[metodi.length + 1];
  12045.             String [] labels = new String[metodi.length + 1];
  12046.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SCOPE_TIPOLOGIA_QUALSIASI;
  12047.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SCOPE_TIPOLOGIA_QUALSIASI;
  12048.             for (int i =0; i < metodi.length ; i ++) {
  12049.                 labels[i+1] = metodiLabel[i];
  12050.                 values[i+1] = metodi[i];
  12051.             }
  12052.            
  12053.             String selectedValue = scopeTipologia != null ? scopeTipologia : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SCOPE_TIPOLOGIA_QUALSIASI;
  12054.            
  12055.             String label = CostantiControlStation.LABEL_PARAMETRO_SCOPE_TIPOLOGIA;
  12056.            
  12057.             this.pd.addFilter(Filtri.FILTRO_SCOPE_TIPOLOGIA, label, selectedValue, values, labels, postBack, this.getSize());
  12058.            
  12059.         } catch (Exception e) {
  12060.             this.logError("Exception: " + e.getMessage(), e);
  12061.             throw new DriverControlStationException(e);
  12062.         }
  12063.     }
  12064.    
  12065.     public void addFilterScopeContesto(String scopeContesto, boolean postBack) throws DriverControlStationException{
  12066.         try {
  12067.             String [] metodi = new String[2];
  12068.             metodi[0] = ScopeContesto.PORTA_APPLICATIVA.getValue();
  12069.             metodi[1] = ScopeContesto.PORTA_DELEGATA.getValue();
  12070.             String [] metodiLabel = new String[2];
  12071.             metodiLabel[0] = CostantiControlStation.SCOPE_CONTESTO_UTILIZZO_LABEL_EROGAZIONE;
  12072.             metodiLabel[1] = CostantiControlStation.SCOPE_CONTESTO_UTILIZZO_LABEL_FRUIZIONE;
  12073.             String [] values = new String[metodi.length + 1];
  12074.             String [] labels = new String[metodi.length + 1];
  12075.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SCOPE_CONTESTO_QUALSIASI;
  12076.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SCOPE_CONTESTO_QUALSIASI;
  12077.             for (int i =0; i < metodi.length ; i ++) {
  12078.                 labels[i+1] = metodiLabel[i];
  12079.                 values[i+1] = metodi[i];
  12080.             }
  12081.            
  12082.             String selectedValue = scopeContesto != null ? scopeContesto : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SCOPE_CONTESTO_QUALSIASI;
  12083.            
  12084.             String label = CostantiControlStation.LABEL_PARAMETRO_SCOPE_CONTESTO;
  12085.            
  12086.             this.pd.addFilter(Filtri.FILTRO_SCOPE_CONTESTO, label, selectedValue, values, labels, postBack, this.getSize());
  12087.            
  12088.         } catch (Exception e) {
  12089.             this.logError("Exception: " + e.getMessage(), e);
  12090.             throw new DriverControlStationException(e);
  12091.         }
  12092.     }
  12093.    
  12094.     public void addFilterDominio(String dominio, boolean postBack) throws DriverControlStationException{
  12095.         try {
  12096.            
  12097.             String [] sdValues = SoggettiCostanti.getSoggettiDominiValue();
  12098.             String [] sdLabels = SoggettiCostanti.getSoggettiDominiLabel();        
  12099.             String [] values = new String[sdValues.length + 1];
  12100.             String [] labels = new String[sdValues.length + 1];
  12101.             labels[0] = SoggettiCostanti.LABEL_PARAMETRO_SOGGETTO_DOMINIO_QUALSIASI;
  12102.             values[0] = SoggettiCostanti.DEFAULT_VALUE_PARAMETRO_SOGGETTO_DOMINIO_QUALSIASI;
  12103.             for (int i =0; i < sdValues.length ; i ++) {
  12104.                 labels[i+1] = sdLabels[i];
  12105.                 values[i+1] = sdValues[i];
  12106.             }
  12107.            
  12108.             String selectedValue = dominio != null ? dominio : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI;
  12109.            
  12110.             this.pd.addFilter(Filtri.FILTRO_DOMINIO, SoggettiCostanti.LABEL_PARAMETRO_SOGGETTO_DOMINIO, selectedValue, values, labels, postBack, this.getSize());
  12111.            
  12112.         } catch (Exception e) {
  12113.             this.logError("Exception: " + e.getMessage(), e);
  12114.             throw new DriverControlStationException(e);
  12115.         }

  12116.     }
  12117.    
  12118.     public void addFilterRuolo(String ruolo, boolean postBack) throws DriverControlStationException{
  12119.         try {
  12120.            
  12121.             FiltroRicercaRuoli filtroRuoli = new FiltroRicercaRuoli();
  12122.             filtroRuoli.setContesto(RuoloContesto.QUALSIASI);
  12123.             filtroRuoli.setTipologia(RuoloTipologia.INTERNO);
  12124.             List<IDRuolo> listRuoli = this.ruoliCore.getAllIdRuoli(filtroRuoli);
  12125.             int length = 1;
  12126.             if(listRuoli!=null && listRuoli.size()>0) {
  12127.                 length+=listRuoli.size();
  12128.             }
  12129.             String [] values = new String[length];
  12130.             String [] labels = new String[length];
  12131.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_RUOLO_QUALSIASI;
  12132.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_QUALSIASI;
  12133.             if(listRuoli!=null && listRuoli.size()>0) {
  12134.                 for (int i =0; i < listRuoli.size() ; i ++) {
  12135.                     labels[i+1] = listRuoli.get(i).getNome();
  12136.                     values[i+1] = listRuoli.get(i).getNome();
  12137.                 }
  12138.             }
  12139.            
  12140.             this.pd.addFilter(Filtri.FILTRO_RUOLO, RuoliCostanti.LABEL_RUOLO, ruolo, values, labels, postBack, this.getSize());
  12141.            
  12142.         } catch (Exception e) {
  12143.             this.logError("Exception: " + e.getMessage(), e);
  12144.             throw new DriverControlStationException(e);
  12145.         }
  12146.     }
  12147.        
  12148.     public void addFilterTipoPolicy(String tipoPolicy, boolean postBack) throws DriverControlStationException{
  12149.         try {

  12150.             String selectedValue = tipoPolicy != null ? tipoPolicy : CostantiControlStation.DEFAULT_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPO;

  12151.             this.pd.addFilter(Filtri.FILTRO_TIPO_POLICY, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPO,
  12152.                     selectedValue,
  12153.                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_VALORI,
  12154.                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_LABELS,
  12155.                     postBack, this.getSize());
  12156.            
  12157.         } catch (Exception e) {
  12158.             this.logError("Exception: " + e.getMessage(), e);
  12159.             throw new DriverControlStationException(e);
  12160.         }
  12161.     }
  12162.    
  12163.     public void addFilterGruppo(String filterProtocollo, String gruppo, boolean postBack) throws DriverControlStationException{
  12164.         try {
  12165.            
  12166.             boolean isFilterProtocollo = filterProtocollo!=null &&
  12167.                     //!"".equals(filterProtocollo) &&
  12168.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(filterProtocollo);
  12169.            
  12170.             List<String> protocolli = this.core.getProtocolli(this.request, this.session);
  12171.             if(isFilterProtocollo) {
  12172.                 protocolli.clear();
  12173.                 protocolli.add(filterProtocollo);
  12174.             }
  12175.            
  12176.             FiltroRicercaGruppi filtroGruppi = new FiltroRicercaGruppi();
  12177.             filtroGruppi.setProtocolli(protocolli);
  12178.             List<IDGruppo> listGruppi = this.gruppiCore.getAllIdGruppi(filtroGruppi);
  12179.             int length = 1;
  12180.             if(listGruppi!=null && listGruppi.size()>0) {
  12181.                 length+=listGruppi.size();
  12182.             }
  12183.             String [] values = new String[length];
  12184.             String [] labels = new String[length];
  12185.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_GRUPPO_QUALSIASI;
  12186.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_GRUPPO_QUALSIASI;
  12187.             if(listGruppi!=null && listGruppi.size()>0) {
  12188.                 for (int i =0; i < listGruppi.size() ; i ++) {
  12189.                     labels[i+1] = listGruppi.get(i).getNome();
  12190.                     values[i+1] = listGruppi.get(i).getNome();
  12191.                 }
  12192.             }
  12193.            
  12194.             this.pd.addFilter(Filtri.FILTRO_GRUPPO, GruppiCostanti.LABEL_GRUPPO, gruppo, values, labels, postBack, this.getSize());
  12195.            
  12196.         } catch (Exception e) {
  12197.             this.logError("Exception: " + e.getMessage(), e);
  12198.             throw new DriverControlStationException(e);
  12199.         }
  12200.     }
  12201.    
  12202.     public void addFilterApi(String filterProtocollo, String filterTipoAccordo, String gruppo, String api, boolean postBack) throws DriverControlStationException{
  12203.         try {
  12204.            
  12205.             boolean isFilterProtocollo = filterProtocollo!=null &&
  12206.                     //!"".equals(filterProtocollo) &&
  12207.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(filterProtocollo);
  12208.            
  12209.             List<String> protocolli = this.core.getProtocolli(this.request, this.session);
  12210.             if(isFilterProtocollo) {
  12211.                 protocolli.clear();
  12212.                 protocolli.add(filterProtocollo);
  12213.             }
  12214.            
  12215.             FiltroRicercaAccordi filtroRicerca = new FiltroRicercaAccordi();
  12216.            
  12217.             filtroRicerca.setOrder(true);
  12218.            
  12219.             filtroRicerca.setProtocolli(protocolli);
  12220.            
  12221.             if(gruppo!=null && !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_GRUPPO_QUALSIASI.equals(gruppo)) {
  12222.                 IDGruppo idGruppo = new IDGruppo(gruppo);
  12223.                 filtroRicerca.setIdGruppo(idGruppo);
  12224.             }
  12225.            
  12226.             if(filterTipoAccordo!=null && !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI.equals(filterTipoAccordo)) {
  12227.                 filtroRicerca.setServiceBinding(org.openspcoop2.core.registry.constants.ServiceBinding.toEnumConstant(filterTipoAccordo));
  12228.             }
  12229.            
  12230.             List<IDAccordo> listAccordi = null;
  12231.             try {
  12232.                 listAccordi = this.apcCore.getAllIdAccordiServizio(filtroRicerca);
  12233.             }catch(DriverRegistroServiziNotFound notFound) {
  12234.                 listAccordi = new ArrayList<IDAccordo>();
  12235.             }
  12236.             int length = 1;
  12237.             if(listAccordi!=null && listAccordi.size()>0) {
  12238.                 length+=listAccordi.size();
  12239.             }
  12240.             String [] values = new String[length];
  12241.             String [] labels = new String[length];
  12242.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_API_QUALSIASI;
  12243.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_QUALSIASI;
  12244.             if(listAccordi!=null && listAccordi.size()>0) {
  12245.                 for (int i =0; i < listAccordi.size() ; i ++) {
  12246.                     labels[i+1] = this.getLabelIdAccordo(listAccordi.get(i));
  12247.                     values[i+1] = IDAccordoFactory.getInstance().getUriFromIDAccordo(listAccordi.get(i));
  12248.                 }
  12249.             }
  12250.            
  12251.             this.pd.addFilter(Filtri.FILTRO_API, AccordiServizioParteComuneCostanti.LABEL_APC, api, values, labels, postBack, this.getSize());
  12252.            
  12253.         } catch (Exception e) {
  12254.             this.logError("Exception: " + e.getMessage(), e);
  12255.             throw new DriverControlStationException(e);
  12256.         }
  12257.     }
  12258.    
  12259.     public void addFilterCanale(CanaliConfigurazione canali, String canale, boolean postBack) throws DriverControlStationException{
  12260.         try {
  12261.            
  12262.             int length = 1;
  12263.             if(canali!=null && canali.sizeCanaleList()>0) {
  12264.                 length+=canali.sizeCanaleList();
  12265.             }
  12266.             String [] values = new String[length];
  12267.             String [] labels = new String[length];
  12268.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CANALE_QUALSIASI;
  12269.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CANALE_QUALSIASI;
  12270.             if(canali!=null && canali.sizeCanaleList()>0) {
  12271.                 for (int i =0; i < canali.sizeCanaleList() ; i ++) {
  12272.                     labels[i+1] = canali.getCanale(i).getNome();
  12273.                     if(canali.getCanale(i).isCanaleDefault()) {
  12274.                         values[i+1] = CostantiControlStation.PREFIX_VALUE_PARAMETRO_CANALE_DEFAULT+canali.getCanale(i).getNome();
  12275.                     }
  12276.                     else {
  12277.                         values[i+1] = canali.getCanale(i).getNome();
  12278.                     }
  12279.                 }
  12280.             }
  12281.            
  12282.             this.pd.addFilter(Filtri.FILTRO_CANALE, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALE, canale, values, labels, postBack, this.getSize());
  12283.            
  12284.         } catch (Exception e) {
  12285.             this.logError("Exception: " + e.getMessage(), e);
  12286.             throw new DriverControlStationException(e);
  12287.         }
  12288.     }
  12289.    
  12290.     public void addFilterApiContesto(String apiContesto, boolean postBack) throws DriverControlStationException{
  12291.         this._addFilterApiContesto(false, false, false, apiContesto, postBack);
  12292.     }
  12293.     public void addFilterApiContestoRuoli(String apiContesto, boolean postBack) throws DriverControlStationException{
  12294.         this._addFilterApiContesto(true, true, false, apiContesto, postBack);
  12295.     }
  12296.     private void _addFilterApiContesto(boolean soggetti, boolean applicativi, boolean erogazioneFruizione, String apiContesto, boolean postBack) throws DriverControlStationException{
  12297.         try {
  12298.             int size = 2;
  12299.             if(soggetti) {
  12300.                 size++;
  12301.             }
  12302.             if(applicativi) {
  12303.                 size++;
  12304.             }
  12305.             if(erogazioneFruizione) {
  12306.                 size++;
  12307.             }
  12308.            
  12309.             String [] metodi = new String[size];
  12310.             int index = 0;
  12311.             if(soggetti) {
  12312.                 metodi[index++] = Filtri.FILTRO_API_CONTESTO_VALUE_SOGGETTI;
  12313.             }
  12314.             if(applicativi) {
  12315.                 metodi[index++] = Filtri.FILTRO_API_CONTESTO_VALUE_APPLICATIVI;
  12316.             }
  12317.             metodi[index++] = TipoPdD.APPLICATIVA.getTipo();
  12318.             metodi[index++] = TipoPdD.DELEGATA.getTipo();
  12319.             if(erogazioneFruizione) {
  12320.                 metodi[index++] = Filtri.FILTRO_API_CONTESTO_VALUE_EROGAZIONE_FRUIZIONE;
  12321.             }
  12322.             String [] metodiLabel = new String[size];
  12323.             index = 0;
  12324.             if(soggetti) {
  12325.                 metodiLabel[index++] = CostantiControlStation.API_CONTESTO_UTILIZZO_LABEL_SOGGETTI;
  12326.             }
  12327.             if(applicativi) {
  12328.                 metodiLabel[index++] = CostantiControlStation.API_CONTESTO_UTILIZZO_LABEL_APPLICATIVI;
  12329.             }
  12330.             metodiLabel[index++] = CostantiControlStation.API_CONTESTO_UTILIZZO_LABEL_EROGAZIONE;
  12331.             metodiLabel[index++] = CostantiControlStation.API_CONTESTO_UTILIZZO_LABEL_FRUIZIONE;
  12332.             if(erogazioneFruizione) {
  12333.                 metodi[index++] = CostantiControlStation.API_CONTESTO_UTILIZZO_LABEL_EROGAZIONE_FRUIZIONE;
  12334.             }
  12335.             String [] values = new String[metodi.length + 1];
  12336.             String [] labels = new String[metodi.length + 1];
  12337.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_API_CONTESTO_QUALSIASI;
  12338.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_CONTESTO_QUALSIASI;
  12339.             for (int i =0; i < metodi.length ; i ++) {
  12340.                 labels[i+1] = metodiLabel[i];
  12341.                 values[i+1] = metodi[i];
  12342.             }
  12343.            
  12344.             String selectedValue = apiContesto != null ? apiContesto : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_CONTESTO_QUALSIASI;
  12345.            
  12346.             String label = CostantiControlStation.LABEL_PARAMETRO_API_CONTESTO;
  12347.            
  12348.             this.pd.addFilter(Filtri.FILTRO_API_CONTESTO, label, selectedValue, values, labels, postBack, this.getSize());
  12349.            
  12350.         } catch (Exception e) {
  12351.             this.logError("Exception: " + e.getMessage(), e);
  12352.             throw new DriverControlStationException(e);
  12353.         }
  12354.     }
  12355.    
  12356.     public void addFilterApiImplementazione(String filterProtocollo, String filterSoggetto, String filterGruppo, String filterApiContesto, String apiImplementazione, boolean postBack) throws DriverControlStationException{
  12357.         try {
  12358.             boolean isFruizione = TipoPdD.DELEGATA.getTipo().equals(filterApiContesto);
  12359.             boolean isErogazione = TipoPdD.APPLICATIVA.getTipo().equals(filterApiContesto);
  12360.            
  12361.             if(!isErogazione && !isFruizione) {
  12362.                 return;
  12363.             }
  12364.            
  12365.             boolean isFilterProtocollo = filterProtocollo!=null &&
  12366.                     //!"".equals(filterProtocollo) &&
  12367.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(filterProtocollo);
  12368.             boolean isFilterSoggetto = filterSoggetto!=null &&
  12369.                     //!"".equals(filterSoggetto) &&
  12370.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI.equals(filterSoggetto);
  12371.             boolean isFilterGruppo = filterGruppo!=null &&
  12372.                     //!"".equals(filterGruppo) &&
  12373.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_GRUPPO_QUALSIASI.equals(filterGruppo);
  12374.            
  12375.             List<String> protocolli = this.core.getProtocolli(this.request, this.session);
  12376.             if(isFilterProtocollo) {
  12377.                 protocolli.clear();
  12378.                 protocolli.add(filterProtocollo);
  12379.             }
  12380.            
  12381.             String tipoSoggetto = null;
  12382.             String nomeSoggetto = null;
  12383.             String protocolloSelezionato = null;
  12384.             if(isFilterSoggetto) {
  12385.                 tipoSoggetto = filterSoggetto.split("/")[0];
  12386.                 nomeSoggetto = filterSoggetto.split("/")[1];
  12387.                 protocolloSelezionato = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(tipoSoggetto);
  12388.             }
  12389.             else {
  12390.                 protocolloSelezionato = protocolli.get(0);
  12391.             }
  12392.            
  12393.             String gruppo = null;
  12394.             if(isFilterGruppo) {
  12395.                 gruppo = filterGruppo;
  12396.             }
  12397.            
  12398.             List<String> valuesL = new ArrayList<>();
  12399.             List<String> labelsL = new ArrayList<>();
  12400.             if(isFruizione) {
  12401.                 List<IDFruizione> listFruizioni = this.apsCore.getFruizioni(protocolli, gruppo, tipoSoggetto, nomeSoggetto);
  12402.                 if(listFruizioni!=null && !listFruizioni.isEmpty()) {
  12403.                     for (IDFruizione idFruizione : listFruizioni) {
  12404.                         valuesL.add(idFruizione.toFormatString());
  12405.                         if(isFilterSoggetto) {
  12406.                             labelsL.add(this.getLabelIdServizio(idFruizione.getIdServizio()));
  12407.                         }
  12408.                         else {
  12409.                             labelsL.add(this.getLabelServizioFruizione(protocolloSelezionato, idFruizione.getIdFruitore(), idFruizione.getIdServizio()));
  12410.                         }
  12411.                     }
  12412.                 }
  12413.             }
  12414.             else {
  12415.                 List<IDServizio> listErogazioni = this.apsCore.getErogazioni(protocolli, gruppo, tipoSoggetto, nomeSoggetto);
  12416.                 if(listErogazioni!=null && !listErogazioni.isEmpty()) {
  12417.                     for (IDServizio idServizio : listErogazioni) {
  12418.                         valuesL.add(idServizio.toFormatString());
  12419.                         if(isFilterSoggetto) {
  12420.                             labelsL.add(this.getLabelIdServizioSenzaErogatore(idServizio));
  12421.                         }
  12422.                         else {
  12423.                             labelsL.add(this.getLabelIdServizio(idServizio));
  12424.                         }
  12425.                     }
  12426.                 }
  12427.             }
  12428.            
  12429.             String [] values = new String[valuesL.size() + 1];
  12430.             String [] labels = new String[labelsL.size() + 1];
  12431.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_API_IMPLEMENTAZIONE_QUALSIASI;
  12432.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_IMPLEMENTAZIONE_QUALSIASI;
  12433.             for (int i =0; i < valuesL.size() ; i ++) {
  12434.                 labels[i+1] = labelsL.get(i);
  12435.                 values[i+1] = valuesL.get(i);
  12436.             }
  12437.            
  12438.             String selectedValue = apiImplementazione != null ? apiImplementazione : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_IMPLEMENTAZIONE_QUALSIASI;
  12439.            
  12440.             String label = CostantiControlStation.LABEL_PARAMETRO_API_IMPLEMENTAZIONE;
  12441.            
  12442.             this.pd.addFilter(Filtri.FILTRO_API_IMPLEMENTAZIONE, label, selectedValue, values, labels, postBack, this.getSize());
  12443.            
  12444.         } catch (Exception e) {
  12445.             this.logError("Exception: " + e.getMessage(), e);
  12446.             throw new DriverControlStationException(e);
  12447.         }
  12448.     }
  12449.    
  12450.     public void addFilterApplicativo(String filterProtocollo, String filterSoggetto, String applicativo, boolean postBack) throws DriverControlStationException{
  12451.         try {
  12452.            
  12453.             boolean isFilterProtocollo = filterProtocollo!=null &&
  12454.                     //!"".equals(filterProtocollo) &&
  12455.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(filterProtocollo);
  12456.             boolean isFilterSoggetto = filterSoggetto!=null &&
  12457.                     //!"".equals(filterSoggetto) &&
  12458.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI.equals(filterSoggetto);
  12459.                        
  12460.             List<String> protocolli = this.core.getProtocolli(this.request, this.session);
  12461.             if(isFilterProtocollo) {
  12462.                 protocolli.clear();
  12463.                 protocolli.add(filterProtocollo);
  12464.             }
  12465.            
  12466.             String filterSoggettoTipo = null;
  12467.             String filterSoggettoNome = null;
  12468.             String protocolloSelezionato = null;
  12469.             if(isFilterSoggetto) {
  12470.                 filterSoggettoTipo = filterSoggetto.split("/")[0];
  12471.                 filterSoggettoNome = filterSoggetto.split("/")[1];
  12472.                 protocolloSelezionato = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(filterSoggettoTipo);
  12473.             }
  12474.             else {
  12475.                 protocolloSelezionato = protocolli.get(0);
  12476.             }
  12477.            
  12478.             List<String> valuesL = new ArrayList<>();
  12479.             List<String> labelsL = new ArrayList<>();
  12480.             List<IDServizioApplicativo> listApplicativi = this.confCore.getServiziApplicativi(null, protocolli, filterSoggettoTipo, filterSoggettoNome);
  12481.             if(listApplicativi!=null && !listApplicativi.isEmpty()) {
  12482.                 for (IDServizioApplicativo idApplicativo : listApplicativi) {
  12483.                     valuesL.add(idApplicativo.toFormatString());
  12484.                     if(isFilterSoggetto) {
  12485.                         labelsL.add(idApplicativo.getNome());
  12486.                     }
  12487.                     else {
  12488.                         labelsL.add(this.getLabelServizioApplicativo(protocolloSelezionato, idApplicativo));
  12489.                     }
  12490.                 }
  12491.             }
  12492.            
  12493.             String [] values = new String[valuesL.size() + 1];
  12494.             String [] labels = new String[labelsL.size() + 1];
  12495.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO_QUALSIASI;
  12496.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_APPLICATIVO_QUALSIASI;
  12497.             for (int i =0; i < valuesL.size() ; i ++) {
  12498.                 labels[i+1] = labelsL.get(i);
  12499.                 values[i+1] = valuesL.get(i);
  12500.             }
  12501.            
  12502.             String selectedValue = applicativo != null ? applicativo : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_APPLICATIVO_QUALSIASI;
  12503.            
  12504.             String label = CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO;
  12505.            
  12506.             this.pd.addFilter(Filtri.FILTRO_SERVIZIO_APPLICATIVO, label, selectedValue, values, labels, postBack, this.getSize());
  12507.            
  12508.         } catch (Exception e) {
  12509.             this.logError("Exception: " + e.getMessage(), e);
  12510.             throw new DriverControlStationException(e);
  12511.         }
  12512.     }
  12513.    
  12514.     public void addFilterTipoCredenziali(String tipo, boolean postBack, boolean autenticazioneToken) throws DriverControlStationException{
  12515.         try {
  12516.             String [] tmp_labels = autenticazioneToken ? ConnettoriCostanti.CREDENZIALI_CON_TOKEN_LABELS : ConnettoriCostanti.CREDENZIALI_LABELS;
  12517.             String [] tmp_values = autenticazioneToken ? ConnettoriCostanti.CREDENZIALI_CON_TOKEN_VALUES : ConnettoriCostanti.CREDENZIALI_VALUES;
  12518.            
  12519.             String [] values = new String[tmp_values.length + 1];
  12520.             String [] labels = new String[tmp_labels.length + 1];
  12521.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  12522.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  12523.             for (int i =0; i < tmp_labels.length ; i ++) {
  12524.                 labels[i+1] = tmp_labels[i];
  12525.                 values[i+1] = tmp_values[i];
  12526.             }
  12527.            
  12528.             String selectedValue = tipo != null ? tipo : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  12529.            
  12530.             String label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO;

  12531.             this.pd.addFilter(Filtri.FILTRO_TIPO_CREDENZIALI, label, selectedValue, values, labels, postBack, this.getSize());
  12532.            
  12533.         } catch (Exception e) {
  12534.             this.logError("Exception: " + e.getMessage(), e);
  12535.             throw new DriverControlStationException(e);
  12536.         }
  12537.     }
  12538.    
  12539.     public void addFilterCredenziale(String tipoCredenziale, String credenziale) throws DriverControlStationException{
  12540.         try {
  12541.             String label = null;
  12542.             if(ConnettoriCostanti.AUTENTICAZIONE_TIPO_SSL.equals(tipoCredenziale)) {
  12543.                 label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_HTTPS;
  12544.             }
  12545.             else if(ConnettoriCostanti.AUTENTICAZIONE_TIPO_BASIC.equals(tipoCredenziale)) {
  12546.                 label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_USERNAME;
  12547.             }
  12548.             else if(ConnettoriCostanti.AUTENTICAZIONE_TIPO_PRINCIPAL.equals(tipoCredenziale)) {
  12549.                 label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_PRINCIPAL;
  12550.             }
  12551.             else if(ConnettoriCostanti.AUTENTICAZIONE_TIPO_TOKEN.equals(tipoCredenziale)) {
  12552.                 label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_TOKEN_CLIENT_ID;
  12553.             }
  12554.            
  12555.             if(label!=null) {
  12556.                 this.pd.addTextFilter(Filtri.FILTRO_CREDENZIALE, label, credenziale, this.getSize());
  12557.             }
  12558.            
  12559.         } catch (Exception e) {
  12560.             this.logError("Exception: " + e.getMessage(), e);
  12561.             throw new DriverControlStationException(e);
  12562.         }
  12563.     }
  12564.    
  12565.     public void addFilterCredenzialeIssuer(String tipoCredenziale, String credenziale) throws DriverControlStationException{
  12566.         try {
  12567.             if(ConnettoriCostanti.AUTENTICAZIONE_TIPO_SSL.equals(tipoCredenziale)) {
  12568.                 String label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_HTTPS_ISSUER;
  12569.                 this.pd.addTextFilter(Filtri.FILTRO_CREDENZIALE_ISSUER, label, credenziale, this.getSize());
  12570.             }
  12571.            
  12572.         } catch (Exception e) {
  12573.             this.logError("Exception: " + e.getMessage(), e);
  12574.             throw new DriverControlStationException(e);
  12575.         }
  12576.     }

  12577.     public List<String> getTokenPolicyGestione(boolean forcePDND, boolean forceOAuth,
  12578.             boolean addElementNonSelezionatoSeMaggioreUno,
  12579.             String checkTokenPolicyConfigurataPresente, TipoOperazione tipoOperazione) throws DriverConfigurazioneException{
  12580.         return getTokenPolicy(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN, forcePDND, forceOAuth,
  12581.                 addElementNonSelezionatoSeMaggioreUno,
  12582.                 checkTokenPolicyConfigurataPresente, tipoOperazione);
  12583.     }
  12584.     public List<String> getTokenPolicyNegoziazione(boolean forcePDND, boolean forceOAuth,
  12585.             boolean addElementNonSelezionatoSeMaggioreUno,
  12586.             String checkTokenPolicyConfigurataPresente, TipoOperazione tipoOperazione) throws DriverConfigurazioneException{
  12587.         return getTokenPolicy(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_RETRIEVE_POLICY_TOKEN, forcePDND, forceOAuth,
  12588.                 addElementNonSelezionatoSeMaggioreUno,
  12589.                 checkTokenPolicyConfigurataPresente, tipoOperazione);
  12590.     }
  12591.     private List<String> getTokenPolicy(String tipologia, boolean forcePDND, boolean forceOAuth,
  12592.             boolean addElementNonSelezionatoSeMaggioreUno,
  12593.             String checkTokenPolicyConfigurataPresente, TipoOperazione tipoOperazione) throws DriverConfigurazioneException{
  12594.         List<GenericProperties> gestorePolicyTokenList = this.confCore.gestorePolicyTokenList(null, tipologia, null);
  12595.        
  12596.         boolean retrieve = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_RETRIEVE_POLICY_TOKEN.equals(tipologia);
  12597.         List<String> l = filterPolicy(retrieve, gestorePolicyTokenList, forcePDND, forceOAuth);
  12598.        
  12599.         List<String> returnList = new ArrayList<>();
  12600.         if(!l.isEmpty()) {
  12601.            
  12602.             boolean forceValueNonSelezionato = TipoOperazione.CHANGE.equals(tipoOperazione) &&
  12603.                     (
  12604.                             checkTokenPolicyConfigurataPresente==null
  12605.                             ||
  12606.                             StringUtils.isEmpty(checkTokenPolicyConfigurataPresente)
  12607.                             ||
  12608.                             (!l.contains(checkTokenPolicyConfigurataPresente))
  12609.                     );
  12610.             if(
  12611.                     (addElementNonSelezionatoSeMaggioreUno && l.size()>1)
  12612.                     ||
  12613.                     (forceValueNonSelezionato)
  12614.             ) {
  12615.                 returnList.add(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO);
  12616.             }
  12617.             returnList.addAll(l);
  12618.         }
  12619.         else if(addElementNonSelezionatoSeMaggioreUno) {
  12620.             returnList.add(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO);
  12621.         }
  12622.        
  12623.         return returnList;
  12624.     }
  12625.     private List<String> filterPolicy(boolean retrieve, List<GenericProperties> gestorePolicyTokenList, boolean forcePDND, boolean forceOAuth){
  12626.         List<String> policyFiltered = new ArrayList<>();
  12627.         for (int i = 0; i < gestorePolicyTokenList.size(); i++) {
  12628.             GenericProperties genericProperties = gestorePolicyTokenList.get(i);
  12629.             String nome = genericProperties.getNome();
  12630.             if(forcePDND || forceOAuth) {
  12631.                 if(retrieve) {
  12632.                     addFilteredPolicyNegoziazione(genericProperties.getPropertyList(), policyFiltered, nome, forcePDND, forceOAuth);
  12633.                 }
  12634.                 else {
  12635.                     addFilteredPolicyGestione(policyFiltered, nome, forcePDND, forceOAuth);
  12636.                 }
  12637.             }
  12638.             else {
  12639.                 policyFiltered.add(nome);
  12640.             }
  12641.         }
  12642.         return policyFiltered;
  12643.     }
  12644.     private void addFilteredPolicyGestione(List<String> policyFiltered, String nome, boolean forcePDND, boolean forceOAuth){
  12645.         if(this.connettoriCore.isPolicyGestioneTokenPDND(nome)) {
  12646.             if(forcePDND) {
  12647.                 policyFiltered.add(nome);
  12648.             }
  12649.         }
  12650.         else {
  12651.             if(forceOAuth) {
  12652.                 policyFiltered.add(nome);
  12653.             }
  12654.         }
  12655.     }
  12656.     private void addFilteredPolicyNegoziazione(List<Property> gp, List<String> policyFiltered, String nome, boolean forcePDND, boolean forceOAuth){
  12657.        
  12658.         boolean pdnd = false;
  12659.         if(gp!=null && !gp.isEmpty()) {
  12660.             for (Property p : gp) {
  12661.                 if(org.openspcoop2.pdd.core.token.Costanti.POLICY_RETRIEVE_TOKEN_MODE_PDND.equals(p.getNome())) {
  12662.                     pdnd = "true".equalsIgnoreCase(p.getValore());
  12663.                     break;
  12664.                 }
  12665.             }
  12666.         }
  12667.        
  12668.         if(pdnd) {
  12669.             if(forcePDND) {
  12670.                 policyFiltered.add(nome);
  12671.             }
  12672.         }
  12673.         else {
  12674.             if(forceOAuth) {
  12675.                 policyFiltered.add(nome);
  12676.             }
  12677.         }
  12678.     }
  12679.    
  12680.     public void addFilterCredenzialeTokenPolicy(String tokenPolicy, boolean postBack) throws DriverControlStationException{
  12681.         try {
  12682.             List<GenericProperties> gestorePolicyTokenList = this.confCore.gestorePolicyTokenList(null, ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN, null);
  12683.             String [] policyLabels = new String[gestorePolicyTokenList.size() + 1];
  12684.             String [] policyValues = new String[gestorePolicyTokenList.size() + 1];

  12685.             policyLabels[0] = CostantiControlStation.LABEL_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  12686.             policyValues[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;

  12687.             for (int i = 0; i < gestorePolicyTokenList.size(); i++) {
  12688.                 GenericProperties genericProperties = gestorePolicyTokenList.get(i);
  12689.                 policyLabels[(i+1)] = genericProperties.getNome();
  12690.                 policyValues[(i+1)] = genericProperties.getNome();
  12691.             }
  12692.                
  12693.             String selectedValue = tokenPolicy != null ? tokenPolicy : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  12694.            
  12695.             String label = ServiziApplicativiCostanti.LABEL_CREDENZIALE_ACCESSO_TOKEN_POLICY;

  12696.             this.pd.addFilter(Filtri.FILTRO_CREDENZIALE_TOKEN_POLICY, label, selectedValue, policyValues, policyLabels, postBack, this.getSize());
  12697.                
  12698.         } catch (Exception e) {
  12699.             this.logError("Exception: " + e.getMessage(), e);
  12700.             throw new DriverControlStationException(e);
  12701.         }
  12702.     }
  12703.    
  12704.     public void addFilterStato(String stato, boolean addStatiAllarme, boolean postBack) throws DriverControlStationException{
  12705.         try {
  12706.             String [] statiValues = new String[addStatiAllarme?5:2];
  12707.             statiValues[0] = Filtri.FILTRO_STATO_VALORE_ABILITATO;
  12708.             statiValues[1] = Filtri.FILTRO_STATO_VALORE_DISABILITATO;
  12709.             if(addStatiAllarme) {
  12710.                 statiValues[2] = Filtri.FILTRO_STATO_VALORE_OK;
  12711.                 statiValues[3] = Filtri.FILTRO_STATO_VALORE_WARNING;
  12712.                 statiValues[4] = Filtri.FILTRO_STATO_VALORE_ERROR;
  12713.             }
  12714.             String [] statiLabel = new String[addStatiAllarme?5:2];
  12715.             statiLabel[0] = Filtri.FILTRO_STATO_VALORE_ABILITATO;
  12716.             statiLabel[1] = Filtri.FILTRO_STATO_VALORE_DISABILITATO;
  12717.             if(addStatiAllarme) {
  12718.                 statiLabel[2] = Filtri.FILTRO_STATO_VALORE_OK;
  12719.                 statiLabel[3] = Filtri.FILTRO_STATO_VALORE_WARNING;
  12720.                 statiLabel[4] = Filtri.FILTRO_STATO_VALORE_ERROR;
  12721.             }
  12722.             String [] values = new String[statiValues.length + 1];
  12723.             String [] labels = new String[statiValues.length + 1];
  12724.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_STATO_QUALSIASI;
  12725.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_STATO_QUALSIASI;
  12726.             for (int i =0; i < statiValues.length ; i ++) {
  12727.                 labels[i+1] = statiLabel[i];
  12728.                 values[i+1] = statiValues[i];
  12729.             }
  12730.            
  12731.             String selectedValue = stato != null ? stato : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_STATO_QUALSIASI;
  12732.            
  12733.             String label = CostantiControlStation.LABEL_PARAMETRO_STATO;
  12734.            
  12735.             this.pd.addFilter(Filtri.FILTRO_STATO, label, selectedValue, values, labels, postBack, this.getSize());
  12736.            
  12737.         } catch (Exception e) {
  12738.             this.logError("Exception: " + e.getMessage(), e);
  12739.             throw new DriverControlStationException(e);
  12740.         }
  12741.     }
  12742.    
  12743.     public String getLabelTipoRisorsaPolicyAttiva(TipoRisorsaPolicyAttiva tipo) {
  12744.         return this.getLabelTipoRisorsaPolicyAttiva(tipo.getValue());
  12745.     }
  12746.     public String getLabelTipoRisorsaPolicyAttiva(String tipo) {
  12747.         String labelRisorsaPolicyAttiva = null;
  12748.         for (int j = 0; j < CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI.length; j++) {
  12749.             if(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI[j].equals(tipo)) {
  12750.                 labelRisorsaPolicyAttiva = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_LABELS[j];
  12751.                 break;
  12752.             }
  12753.         }
  12754.         return labelRisorsaPolicyAttiva;
  12755.     }
  12756.    
  12757.     public void addFilterTipoRisorsaPolicy(List<TipoRisorsaPolicyAttiva> listaTipoRisorsa, String tipoRisorsaPolicy, boolean postBack) throws DriverControlStationException{
  12758.         try {
  12759.             if(listaTipoRisorsa!=null && listaTipoRisorsa.size()>1) {
  12760.                 String selectedValue = null;
  12761.                 if(tipoRisorsaPolicy != null) {
  12762.                     selectedValue = tipoRisorsaPolicy;
  12763.                 }
  12764.                 else {
  12765.                     selectedValue =  CostantiControlStation.DEFAULT_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO_VALUE.getValue();
  12766.                 }
  12767.    
  12768.                 List<String> values = new ArrayList<>();
  12769.                 List<String> labels = new ArrayList<>();
  12770.                 for (int j = 0; j < CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI.length; j++) {
  12771.                     TipoRisorsaPolicyAttiva check = TipoRisorsaPolicyAttiva.toEnumConstant(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI[j]);
  12772.                     if(listaTipoRisorsa.contains(check)) {
  12773.                         values.add(check.getValue());
  12774.                         labels.add(this.getLabelTipoRisorsaPolicyAttiva(check));
  12775.                     }
  12776.                 }
  12777.                
  12778.                 this.pd.addFilter(Filtri.FILTRO_TIPO_RISORSA_POLICY, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO,
  12779.                         selectedValue,
  12780.                         values.toArray(new String[1]),
  12781.                         labels.toArray(new String[1]),
  12782.                         postBack, this.getSize());
  12783.             }
  12784.            
  12785.         } catch (Exception e) {
  12786.             this.logError("Exception: " + e.getMessage(), e);
  12787.             throw new DriverControlStationException(e);
  12788.         }
  12789.     }
  12790.     public void removeFilterTipoRisorsaPolicy() throws DriverControlStationException{
  12791.         try {
  12792.             this.pd.removeFilter(Filtri.FILTRO_TIPO_RISORSA_POLICY);
  12793.         } catch (Exception e) {
  12794.             this.logError("Exception: " + e.getMessage(), e);
  12795.             throw new DriverControlStationException(e);
  12796.         }
  12797.     }
  12798.    
  12799.     public void addFilterTipoTokenPolicy(String tipo, boolean postBack,
  12800.             List<String> nomiConfigurazioniPolicyGestioneToken, List<String> labelConfigurazioniPolicyGestioneToken) throws DriverControlStationException{
  12801.         try {
  12802.             if(nomiConfigurazioniPolicyGestioneToken!=null) {
  12803.                 int length = nomiConfigurazioniPolicyGestioneToken.size() +1;
  12804.                 String [] values = new String[length];
  12805.                 String [] labels = new String[length];
  12806.                 labels[0] = CostantiControlStation.LABEL_PARAMETRO_TIPO_TOKEN_POLICY_QUALSIASI;
  12807.                 values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_TOKEN_POLICY_QUALSIASI;
  12808.                 if(nomiConfigurazioniPolicyGestioneToken!=null && nomiConfigurazioniPolicyGestioneToken.size()>0) {
  12809.                     for (int i =0; i < nomiConfigurazioniPolicyGestioneToken.size() ; i ++) {
  12810.                         labels[i+1] = labelConfigurazioniPolicyGestioneToken.get(i);
  12811.                         values[i+1] = nomiConfigurazioniPolicyGestioneToken.get(i);
  12812.                     }
  12813.                 }
  12814.                
  12815.                 this.pd.addFilter(Filtri.FILTRO_TIPO_TOKEN_POLICY, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO, tipo, values, labels, postBack, this.getSize());
  12816.             }
  12817.         } catch (Exception e) {
  12818.             this.logError("Exception: " + e.getMessage(), e);
  12819.             throw new DriverControlStationException(e);
  12820.         }
  12821.     }
  12822.    
  12823.    
  12824.    
  12825.     public void setFilterRuoloServizioApplicativo(ISearch ricerca, int idLista) throws DriverControlStationException{
  12826.         if(this.core.isApplicativiServerEnabled(this)) {
  12827.             if(Liste.SERVIZIO_APPLICATIVO==idLista || Liste.SERVIZI_APPLICATIVI_BY_SOGGETTO==idLista) {
  12828.                 ricerca.addFilter(idLista, Filtri.FILTRO_TIPO_SERVIZIO_APPLICATIVO, CostantiConfigurazione.CLIENT_OR_SERVER);
  12829.             }
  12830.         } else {
  12831.             if( (this.isModalitaCompleta()==false) &&
  12832.                     (Liste.SERVIZIO_APPLICATIVO==idLista || Liste.SERVIZI_APPLICATIVI_BY_SOGGETTO==idLista)) {
  12833.                 ricerca.addFilter(idLista, Filtri.FILTRO_RUOLO_SERVIZIO_APPLICATIVO, Filtri.VALUE_FILTRO_RUOLO_SERVIZIO_APPLICATIVO_FRUITORE);
  12834.             }
  12835.         }
  12836.     }
  12837.    
  12838.     public void setFilterSelectedProtocol(ISearch ricerca, int idLista) throws DriverControlStationException{
  12839.         List<String> protocolli = null;
  12840.         try {
  12841.             if(this.core.isUsedByApi()) {
  12842.                 protocolli = ProtocolFactoryManager.getInstance().getProtocolNamesAsList();
  12843.             }else {
  12844.                 protocolli = this.core.getProtocolli(this.request, this.session);
  12845.             }
  12846.         }catch(Exception e) {
  12847.             throw new DriverControlStationException(e.getMessage(),e);
  12848.         }
  12849.         if(protocolli!=null && protocolli.size()>0) {
  12850.             if(protocolli.size()==1) {
  12851.                 ricerca.addFilter(idLista, Filtri.FILTRO_PROTOCOLLO, protocolli.get(0));
  12852.             }
  12853.             else {
  12854.                 ricerca.addFilter(idLista, Filtri.FILTRO_PROTOCOLLI, Filtri.convertToString(protocolli));
  12855.             }
  12856.         }      
  12857.     }
  12858.     public String addFilterProtocol(ISearch ricerca, int idLista) throws DriverControlStationException{
  12859.         return this.addFilterProtocol(ricerca, idLista, false);
  12860.     }
  12861.     public String addFilterProtocol(ISearch ricerca, int idLista, boolean postBack) throws DriverControlStationException{
  12862.         List<String> protocolli = null;
  12863.         try {
  12864.             protocolli = this.core.getProtocolli(this.request, this.session);
  12865.         }catch(Exception e) {
  12866.             throw new DriverControlStationException(e.getMessage(),e);
  12867.         }
  12868.         return _addFilterProtocol(ricerca, idLista, protocolli, postBack);
  12869.     }
  12870.    
  12871.     public String addFilterProtocol(ISearch ricerca, int idLista,List<String> protocolli) throws DriverControlStationException{
  12872.         return addFilterProtocol(ricerca, idLista, protocolli, false);
  12873.     }
  12874.     public String addFilterProtocol(ISearch ricerca, int idLista,List<String> protocolli, boolean postBack) throws DriverControlStationException{
  12875.         return _addFilterProtocol(ricerca, idLista, protocolli, postBack);
  12876.     }

  12877.     private String _addFilterProtocol(ISearch ricerca, int idLista, List<String> protocolli, boolean postBack) throws DriverControlStationException {
  12878.         if(protocolli!=null && protocolli.size()>1) {
  12879.             String filterProtocol = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_PROTOCOLLO);
  12880.             this.addFilterProtocollo(protocolli, filterProtocol, postBack);
  12881.             return filterProtocol;
  12882.         }
  12883.         return null;
  12884.     }
  12885.     private void addFilterProtocollo(List<String> protocolli, String protocolloSelected,boolean postBack) throws DriverControlStationException{
  12886.         try {
  12887.            
  12888.             if(protocolli!=null && protocolli.size()>1) {

  12889.                 String [] values = new String[protocolli.size() + 1];
  12890.                 String [] labels = new String[protocolli.size() + 1];
  12891.                 labels[0] = CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_QUALSIASI;
  12892.                 values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI;
  12893.                 for (int i =0; i < protocolli.size() ; i ++) {
  12894.                     String protocollo = protocolli.get(i);
  12895.                     labels[i+1] = getLabelProtocollo(protocollo);
  12896.                     values[i+1] = protocollo;
  12897.                 }
  12898.                
  12899.                 String selectedValue = protocolloSelected != null ? protocolloSelected : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI;
  12900.                
  12901.                 this.pd.addFilter(Filtri.FILTRO_PROTOCOLLO, CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO, selectedValue, values, labels, postBack, this.getSize());
  12902.                
  12903.             }
  12904.                
  12905.         } catch (Exception e) {
  12906.             this.logError("Exception: " + e.getMessage(), e);
  12907.             throw new DriverControlStationException(e);
  12908.         }
  12909.     }
  12910.    
  12911.     public void addFilterSoggetto(String soggetto, String protocollo, boolean soloSoggettiOperativi, boolean postBack) throws DriverControlStationException{
  12912.         try {
  12913.             String userLogin = ServletUtils.getUserLoginFromSession(this.session);
  12914.            
  12915.             ConsoleSearch searchSoggetti = new ConsoleSearch(true);
  12916.             searchSoggetti.addFilter(Liste.SOGGETTI, Filtri.FILTRO_PROTOCOLLO, protocollo);
  12917.             if(soloSoggettiOperativi) {
  12918.                 searchSoggetti.addFilter(Liste.SOGGETTI, Filtri.FILTRO_DOMINIO, SoggettiCostanti.SOGGETTO_DOMINIO_OPERATIVO_VALUE);
  12919.             }
  12920.             List<org.openspcoop2.core.registry.Soggetto> listSoggetti = null;
  12921.             if(this.apsCore.isVisioneOggettiGlobale(userLogin)){
  12922.                 listSoggetti = this.soggettiCore.soggettiRegistroList(null, searchSoggetti);
  12923.             }else{
  12924.                 listSoggetti = this.soggettiCore.soggettiRegistroList(userLogin, searchSoggetti);
  12925.             }
  12926.            
  12927.             int length = 1;
  12928.             if(listSoggetti!=null && listSoggetti.size()>0) {
  12929.                 length+=listSoggetti.size();
  12930.             }
  12931.             String [] values = new String[length];
  12932.             String [] labels = new String[length];
  12933.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  12934.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  12935.             if(listSoggetti!=null && listSoggetti.size()>0) {
  12936.                 for (int i =0; i < listSoggetti.size() ; i ++) {
  12937.                     IDSoggetto idSoggetto = new IDSoggetto(listSoggetti.get(i).getTipo(), listSoggetti.get(i).getNome());
  12938.                     labels[i+1] = this.getLabelNomeSoggetto(idSoggetto);
  12939.                     values[i+1] = idSoggetto.toString();
  12940.                 }
  12941.             }
  12942.            
  12943.             this.pd.addFilter(Filtri.FILTRO_SOGGETTO, SoggettiCostanti.LABEL_SOGGETTO, soggetto, values, labels, postBack, this.getSize());
  12944.            
  12945.         } catch (Exception e) {
  12946.             this.logError("Exception: " + e.getMessage(), e);
  12947.             throw new DriverControlStationException(e);
  12948.         }
  12949.     }
  12950.    
  12951.     public void addFilterSoggettoErogatoreStringaLiberaContains(ISearch ricerca, int idLista) throws DriverControlStationException{
  12952.         try {
  12953.             String soggettoErogatoreValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SOGGETTO_EROGATORE_CONTAINS);
  12954.                
  12955.             String filterLabel = SoggettiCostanti.LABEL_SOGGETTO_EROGATORE;
  12956.            
  12957.             this.pd.addTextFilter(Filtri.FILTRO_SOGGETTO_EROGATORE_CONTAINS, filterLabel, soggettoErogatoreValue, this.getSize());
  12958.            
  12959.         } catch (Exception e) {
  12960.             this.logError("Exception: " + e.getMessage(), e);
  12961.             throw new DriverControlStationException(e);
  12962.         }
  12963.     }
  12964.    
  12965.     public void addFilterSubtitle(String subtitleName, String subtitleLabel, boolean visualizzaSottosezioneAperta) throws DriverControlStationException{
  12966.         try {
  12967.             this.pd.addSubtitleFilter(subtitleName, subtitleLabel, visualizzaSottosezioneAperta);
  12968.         }catch(Exception e) {
  12969.             throw new DriverControlStationException(e.getMessage(),e);
  12970.         }
  12971.     }
  12972.    
  12973.     public void impostaAperturaSubtitle(String subtitleName) throws DriverControlStationException{
  12974.         try {
  12975.             this.pd.impostaAperturaSubtitle(subtitleName, null, this.getPostBackElementName());
  12976.         }catch(Exception e) {
  12977.             throw new DriverControlStationException(e.getMessage(),e);
  12978.         }
  12979.     }
  12980.    
  12981.     public void impostaAperturaSubtitle(String subtitleName, boolean visualizzaSottosezioneAperta) throws DriverControlStationException{
  12982.         try {
  12983.             this.pd.impostaAperturaSubtitle(subtitleName, visualizzaSottosezioneAperta, this.getPostBackElementName());
  12984.         }catch(Exception e) {
  12985.             throw new DriverControlStationException(e.getMessage(),e);
  12986.         }
  12987.     }
  12988.    
  12989.     public void addFilterHidden(String name, String value) throws DriverControlStationException{
  12990.         try {
  12991.             this.pd.addHiddenFilter(name, value, this.getSize());
  12992.         }catch(Exception e) {
  12993.             throw new DriverControlStationException(e.getMessage(),e);
  12994.         }
  12995.     }
  12996.    
  12997.    
  12998.    
  12999.     public void addFilterStatoImplementazioneAPI(ISearch ricerca, int idLista) throws DriverControlStationException{
  13000.         try {
  13001.            
  13002.             List<String> statoList = new ArrayList<>();
  13003.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_STATO_VALORE_ABILITATO);
  13004.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_STATO_VALORE_DISABILITATO);
  13005.            
  13006.             int length = statoList.size() + 1;
  13007.            
  13008.             String [] values = new String[length];
  13009.             String [] labels = new String[length];
  13010.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_QUALSIASI;
  13011.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_QUALSIASI;
  13012.             for (int i =0; i < statoList.size() ; i ++) {
  13013.                 labels[i+1] = statoList.get(i);
  13014.                 values[i+1] = statoList.get(i);
  13015.             }
  13016.            
  13017.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_STATO);
  13018.            
  13019.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_STATO, statoValue, values, labels, false, this.getSize());
  13020.            
  13021.         } catch (Exception e) {
  13022.             this.logError("Exception: " + e.getMessage(), e);
  13023.             throw new DriverControlStationException(e);
  13024.         }
  13025.     }
  13026.    
  13027.    
  13028.     public void addFilterTipoAutenticazioneToken(ISearch ricerca, int idLista) throws DriverControlStationException{
  13029.         try {
  13030.            
  13031.             // controllo esistenza token policy
  13032.             List<GenericProperties> gestorePolicyTokenList = this.confCore.gestorePolicyTokenList(null, ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN, null);
  13033.        
  13034.             if(gestorePolicyTokenList.size() > 0) {
  13035.                 int length = gestorePolicyTokenList.size() + 1;
  13036.                
  13037.                 String [] values = new String[length];
  13038.                 String [] labels = new String[length];
  13039.                 labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_TOKEN_QUALSIASI;
  13040.                 values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_TOKEN_QUALSIASI;
  13041.            
  13042.                 for (int i = 0; i < gestorePolicyTokenList.size(); i++) {
  13043.                     GenericProperties genericProperties = gestorePolicyTokenList.get(i);
  13044.                     labels[(i+1)] = genericProperties.getNome();
  13045.                     values[(i+1)] = genericProperties.getNome();
  13046.                 }
  13047.                
  13048.                 String tokenPolicyValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_AUTENTICAZIONE_TOKEN_TIPO);
  13049.                
  13050.                 this.pd.addFilter(Filtri.FILTRO_AUTENTICAZIONE_TOKEN_TIPO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_TOKEN, tokenPolicyValue, values, labels, false, this.getSize());
  13051.             }
  13052.            
  13053.         } catch (Exception e) {
  13054.             this.logError("Exception: " + e.getMessage(), e);
  13055.             throw new DriverControlStationException(e);
  13056.         }
  13057.     }
  13058.    
  13059.     public String addFilterTipoAutenticazioneTrasporto(ISearch ricerca, int idLista, boolean postBack, boolean modiErogazione, Boolean confPersParam) throws DriverControlStationException{
  13060.         String tipoAutenticazioneValue = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_TRASPORTO_QUALSIASI;
  13061.         try {
  13062.            
  13063.             List<String> autenticazioneValues = TipoAutenticazione.getValues();
  13064.             List<String> autenticazioneLabels = TipoAutenticazione.getLabels();
  13065.            
  13066.             boolean confPers = confPersParam!=null && confPersParam.booleanValue();
  13067.            
  13068.             int length = autenticazioneValues.size() + 1;
  13069.             if (confPers){
  13070.                 length++;
  13071.             }
  13072.            
  13073.             String [] values = new String[length];
  13074.             String [] labels = new String[length];
  13075.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13076.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13077.             int i =0;
  13078.             for (; i < autenticazioneValues.size() ; i ++) {
  13079.                 labels[i+1] = autenticazioneLabels.get(i);
  13080.                 values[i+1] = autenticazioneValues.get(i);
  13081.             }
  13082.             if (confPers){
  13083.                 values[i+1] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  13084.                 labels[i+1] = CostantiControlStation.DEFAULT_LABEL_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM;
  13085.             }
  13086.            
  13087.             tipoAutenticazioneValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO);
  13088.            
  13089.             String label = modiErogazione ? CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_CANALE : CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TIPO_AUTENTICAZIONE_TRASPORTO;
  13090.            
  13091.             this.pd.addFilter(Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO, label, tipoAutenticazioneValue, values, labels, postBack, this.getSize());
  13092.            
  13093.         } catch (Exception e) {
  13094.             this.logError("Exception: " + e.getMessage(), e);
  13095.             throw new DriverControlStationException(e);
  13096.         }
  13097.        
  13098.         return tipoAutenticazioneValue;
  13099.     }
  13100.    
  13101.     public void addFilterTipoAutenticazioneTrasportoPlugin(ISearch ricerca, int idLista, String tipoAutenticazione, boolean fruizioni) throws DriverControlStationException{
  13102.         try {
  13103.             if(tipoAutenticazione != null && tipoAutenticazione.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_AUTENTICAZIONE_CUSTOM)) {
  13104.                
  13105.                 String pluginValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO_PLUGIN);
  13106.                 String pluginLabel = "";
  13107.            
  13108.                 List<DataElement> dati = new ArrayList<>();
  13109.                
  13110.                 String tipoAutenticazioneCustom = fruizioni ? Filtri.FILTRO_RUOLO_VALORE_FRUIZIONE : Filtri.FILTRO_RUOLO_VALORE_EROGAZIONE;
  13111.                 this.addCustomFieldSearchForm(TipoPlugin.AUTENTICAZIONE,
  13112.                         tipoAutenticazioneCustom,
  13113.                         null,
  13114.                         Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO,
  13115.                         Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO_PLUGIN,
  13116.                         pluginLabel,
  13117.                         pluginValue, false, dati,
  13118.                         false);        
  13119.                
  13120.                 // dentro dati c'e' solo un elemento
  13121.                 DataElement dataElement = dati.get(0);
  13122.                
  13123.                 if(dataElement.getValues() != null && dataElement.getValues().length > 0) {
  13124.                     this.pd.addFilter(Filtri.FILTRO_AUTENTICAZIONE_TRASPORTO_TIPO_PLUGIN, pluginLabel, pluginValue, dataElement.getValues(), dataElement.getLabels(), false, this.getSize());
  13125.                 }
  13126.             }
  13127.         } catch (Exception e) {
  13128.             this.logError("Exception: " + e.getMessage(), e);
  13129.             throw new DriverControlStationException(e);
  13130.         }
  13131.     }
  13132.    
  13133.     public void addFilterConfigurazioneRateLimiting(ISearch ricerca, int idLista) throws DriverControlStationException{
  13134.         try {
  13135.            
  13136.             List<String> statoList = new ArrayList<>();
  13137.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_RATE_LIMITING_STATO_VALORE_ABILITATO);
  13138.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_RATE_LIMITING_STATO_VALORE_DISABILITATO);
  13139.            
  13140.             int length = statoList.size() + 1;
  13141.            
  13142.             String [] values = new String[length];
  13143.             String [] labels = new String[length];
  13144.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RATE_LIMITING_STATO_QUALSIASI;
  13145.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_RATE_LIMITING_STATO_QUALSIASI;
  13146.             for (int i =0; i < statoList.size() ; i ++) {
  13147.                 labels[i+1] = statoList.get(i);
  13148.                 values[i+1] = statoList.get(i);
  13149.             }
  13150.            
  13151.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_RATE_LIMITING_STATO);
  13152.            
  13153.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_RATE_LIMITING_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_RATE_LIMITING_STATO, statoValue, values, labels, false, this.getSize());
  13154.            
  13155.         } catch (Exception e) {
  13156.             this.logError("Exception: " + e.getMessage(), e);
  13157.             throw new DriverControlStationException(e);
  13158.         }
  13159.     }
  13160.    
  13161.     public void addFilterConfigurazioneValidazione(ISearch ricerca, int idLista) throws DriverControlStationException{
  13162.         try {
  13163.            
  13164.             List<String> statoList = new ArrayList<>();
  13165.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_VALIDAZIONE_STATO_VALORE_ABILITATO);
  13166.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_VALIDAZIONE_STATO_VALORE_DISABILITATO);
  13167.            
  13168.             int length = statoList.size() + 1;
  13169.            
  13170.             String [] values = new String[length];
  13171.             String [] labels = new String[length];
  13172.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_VALIDAZIONE_STATO_QUALSIASI;
  13173.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_VALIDAZIONE_STATO_QUALSIASI;
  13174.             for (int i =0; i < statoList.size() ; i ++) {
  13175.                 labels[i+1] = statoList.get(i);
  13176.                 values[i+1] = statoList.get(i);
  13177.             }
  13178.            
  13179.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_VALIDAZIONE_STATO);
  13180.            
  13181.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_VALIDAZIONE_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_VALIDAZIONE_STATO, statoValue, values, labels, false, this.getSize());
  13182.            
  13183.         } catch (Exception e) {
  13184.             this.logError("Exception: " + e.getMessage(), e);
  13185.             throw new DriverControlStationException(e);
  13186.         }
  13187.     }
  13188.    
  13189.     public void addFilterConfigurazioneCacheRisposta(ISearch ricerca, int idLista) throws DriverControlStationException{
  13190.         try {
  13191.            
  13192.             List<String> statoList = new ArrayList<>();
  13193.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO_VALORE_ABILITATO);
  13194.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO_VALORE_DISABILITATO);
  13195.            
  13196.             int length = statoList.size() + 1;
  13197.            
  13198.             String [] values = new String[length];
  13199.             String [] labels = new String[length];
  13200.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO_QUALSIASI;
  13201.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO_QUALSIASI;
  13202.             for (int i =0; i < statoList.size() ; i ++) {
  13203.                 labels[i+1] = statoList.get(i);
  13204.                 values[i+1] = statoList.get(i);
  13205.             }
  13206.            
  13207.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO);
  13208.            
  13209.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_CACHE_RISPOSTA_STATO, statoValue, values, labels, false, this.getSize());
  13210.            
  13211.         } catch (Exception e) {
  13212.             this.logError("Exception: " + e.getMessage(), e);
  13213.             throw new DriverControlStationException(e);
  13214.         }
  13215.     }
  13216.    
  13217.     public void addFilterConfigurazioneMessageSecurity(ISearch ricerca, int idLista) throws DriverControlStationException{
  13218.         try {
  13219.            
  13220.             List<String> statoList = new ArrayList<>();
  13221.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_VALORE_ABILITATO);
  13222.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO_VALORE_ABILITATO_RICHIESTA);
  13223.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO_VALORE_ABILITATO_RISPOSTA);
  13224.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_VALORE_DISABILITATO);
  13225.            
  13226.             int length = statoList.size() + 1;
  13227.            
  13228.             String [] values = new String[length];
  13229.             String [] labels = new String[length];
  13230.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO_QUALSIASI;
  13231.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO_QUALSIASI;
  13232.             for (int i =0; i < statoList.size() ; i ++) {
  13233.                 labels[i+1] = statoList.get(i);
  13234.                 values[i+1] = statoList.get(i);
  13235.             }
  13236.            
  13237.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO);
  13238.            
  13239.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_MESSAGE_SECURITY_STATO, statoValue, values, labels, false, this.getSize());
  13240.            
  13241.         } catch (Exception e) {
  13242.             this.logError("Exception: " + e.getMessage(), e);
  13243.             throw new DriverControlStationException(e);
  13244.         }
  13245.     }
  13246.    
  13247.     public void addFilterConfigurazioneMTOM(ISearch ricerca, int idLista, String filterTipoAccordo) throws DriverControlStationException{
  13248.         try {
  13249.            
  13250.             if(filterTipoAccordo==null ||
  13251.                     CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_QUALSIASI.equals(filterTipoAccordo) ||
  13252.                     CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP.toLowerCase().equals(filterTipoAccordo)) {
  13253.                
  13254.                 List<String> statoList = new ArrayList<>();
  13255.                 statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MTOM_VALORE_ABILITATO);
  13256.                 statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MTOM_STATO_VALORE_ABILITATO_RICHIESTA);
  13257.                 statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MTOM_STATO_VALORE_ABILITATO_RISPOSTA);
  13258.                 statoList.add(Filtri.FILTRO_CONFIGURAZIONE_MTOM_VALORE_DISABILITATO);
  13259.                
  13260.                 int length = statoList.size() + 1;
  13261.                
  13262.                 String [] values = new String[length];
  13263.                 String [] labels = new String[length];
  13264.                 labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_MTOM_STATO_QUALSIASI;
  13265.                 values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_MTOM_STATO_QUALSIASI;
  13266.                 for (int i =0; i < statoList.size() ; i ++) {
  13267.                     labels[i+1] = statoList.get(i);
  13268.                     values[i+1] = statoList.get(i);
  13269.                 }
  13270.                
  13271.                 String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_MTOM_STATO);
  13272.                
  13273.                 this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_MTOM_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_MTOM_STATO, statoValue, values, labels, false, this.getSize());
  13274.             }
  13275.            
  13276.         } catch (Exception e) {
  13277.             this.logError("Exception: " + e.getMessage(), e);
  13278.             throw new DriverControlStationException(e);
  13279.         }
  13280.     }
  13281.    
  13282.     public void addFilterConfigurazioneTrasformazione(ISearch ricerca, int idLista) throws DriverControlStationException{
  13283.         try {
  13284.            
  13285.             List<String> statoList = new ArrayList<>();
  13286.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO_VALORE_ABILITATO);
  13287.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO_VALORE_DISABILITATO);
  13288.            
  13289.             int length = statoList.size() + 1;
  13290.            
  13291.             String [] values = new String[length];
  13292.             String [] labels = new String[length];
  13293.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO_QUALSIASI;
  13294.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO_QUALSIASI;
  13295.             for (int i =0; i < statoList.size() ; i ++) {
  13296.                 labels[i+1] = statoList.get(i);
  13297.                 values[i+1] = statoList.get(i);
  13298.             }
  13299.            
  13300.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO);
  13301.            
  13302.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TRASFORMAZIONE_STATO, statoValue, values, labels, false, this.getSize());
  13303.            
  13304.         } catch (Exception e) {
  13305.             this.logError("Exception: " + e.getMessage(), e);
  13306.             throw new DriverControlStationException(e);
  13307.         }
  13308.     }
  13309.    
  13310.     public String addFilterConfigurazioneTransazioni(ISearch ricerca, int idLista, boolean postBack) throws DriverControlStationException{
  13311.         String configurazioneTransazioniTipoValue = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRANSAZIONI_QUALSIASI;
  13312.         try {
  13313.             List<String> tipoList = new ArrayList<>();
  13314.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_DEFAULT);
  13315.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_RIDEFINITO_ABILITATO_DATABASE_O_FILETRACE);
  13316.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_RIDEFINITO_ABILITATO_SOLO_DATABASE);
  13317.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_RIDEFINITO_ABILITATO_SOLO_FILETRACE);
  13318.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_RIDEFINITO_ABILITATO_DATABASE_E_FILETRACE);
  13319.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI_VALORE_RIDEFINITO_DISABILITATO);
  13320.            
  13321.            
  13322.             int length = tipoList.size() + 1;
  13323.            
  13324.             String [] values = new String[length];
  13325.             String [] labels = new String[length];
  13326.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSAZIONI_QUALSIASI;
  13327.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRANSAZIONI_QUALSIASI;
  13328.             for (int i =0; i < tipoList.size() ; i ++) {
  13329.                 labels[i+1] = tipoList.get(i);
  13330.                 values[i+1] = tipoList.get(i);
  13331.             }
  13332.            
  13333.             configurazioneTransazioniTipoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI);
  13334.            
  13335.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_TRANSAZIONI, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TRANSAZIONI, configurazioneTransazioniTipoValue, values, labels, postBack, this.getSize());
  13336.            
  13337.         } catch (Exception e) {
  13338.             this.logError("Exception: " + e.getMessage(), e);
  13339.             throw new DriverControlStationException(e);
  13340.         }
  13341.        
  13342.         return configurazioneTransazioniTipoValue;
  13343.     }
  13344.    
  13345.     public void addFilterConfigurazioneCorrelazioneApplicativa(ISearch ricerca, int idLista) throws DriverControlStationException{
  13346.         try {
  13347.            
  13348.             List<String> statoList = new ArrayList<>();
  13349.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_VALORE_ABILITATO);
  13350.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO_VALORE_ABILITATO_RICHIESTA);
  13351.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO_VALORE_ABILITATO_RISPOSTA);
  13352.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_VALORE_DISABILITATO);
  13353.            
  13354.             int length = statoList.size() + 1;
  13355.            
  13356.             String [] values = new String[length];
  13357.             String [] labels = new String[length];
  13358.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO_QUALSIASI;
  13359.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO_QUALSIASI;
  13360.             for (int i =0; i < statoList.size() ; i ++) {
  13361.                 labels[i+1] = statoList.get(i);
  13362.                 values[i+1] = statoList.get(i);
  13363.             }
  13364.            
  13365.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO);
  13366.            
  13367.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_CORRELAZIONE_APPLICATIVA_STATO, statoValue, values, labels, false, this.getSize());
  13368.            
  13369.         } catch (Exception e) {
  13370.             this.logError("Exception: " + e.getMessage(), e);
  13371.             throw new DriverControlStationException(e);
  13372.         }
  13373.     }
  13374.    
  13375.     public String addFilterConfigurazioneTipoDump(ISearch ricerca, int idLista, boolean postBack) throws DriverControlStationException{
  13376.         String configurazioneDumpTipoValue = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_DUMP_QUALSIASI;
  13377.         try {
  13378.             List<String> tipoList = new ArrayList<>();
  13379.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_DEFAULT);
  13380.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO);
  13381.            
  13382.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RICHIESTA);
  13383.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RISPOSTA);
  13384.            
  13385.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RICHIESTA_INGRESSO);
  13386.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RICHIESTA_USCITA);
  13387.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RISPOSTA_INGRESSO);
  13388.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_RISPOSTA_USCITA);
  13389.            
  13390.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER);
  13391.            
  13392.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RICHIESTA);
  13393.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RISPOSTA);
  13394.            
  13395.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RICHIESTA_INGRESSO);
  13396.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RICHIESTA_USCITA);

  13397.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RISPOSTA_INGRESSO);
  13398.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_ABILITATO_SOLO_HEADER_RISPOSTA_USCITA);

  13399.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_DISABILITATO);
  13400.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_DISABILITATO_RICHIESTA);
  13401.             tipoList.add(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO_VALORE_RIDEFINITO_DISABILITATO_RISPOSTA);
  13402.            
  13403.            
  13404.             int length = tipoList.size() + 1;
  13405.            
  13406.             String [] values = new String[length];
  13407.             String [] labels = new String[length];
  13408.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_DUMP_QUALSIASI;
  13409.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_DUMP_QUALSIASI;
  13410.             for (int i =0; i < tipoList.size() ; i ++) {
  13411.                 labels[i+1] = tipoList.get(i);
  13412.                 values[i+1] = tipoList.get(i);
  13413.             }
  13414.            
  13415.             configurazioneDumpTipoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO);
  13416.            
  13417.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_DUMP_TIPO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_TIPO_DUMP, configurazioneDumpTipoValue, values, labels, postBack, this.getSize());
  13418.            
  13419.         } catch (Exception e) {
  13420.             this.logError("Exception: " + e.getMessage(), e);
  13421.             throw new DriverControlStationException(e);
  13422.         }
  13423.        
  13424.         return configurazioneDumpTipoValue;
  13425.     }
  13426.    
  13427.     public String addFilterConfigurazioneCORS(ISearch ricerca, int idLista) throws DriverControlStationException{
  13428.         try {
  13429.            
  13430.             List<String> statoList = new ArrayList<>();
  13431.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO_VALORE_DEFAULT);
  13432.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO_VALORE_RIDEFINITO_ABILITATO);
  13433.             statoList.add(Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO_VALORE_RIDEFINITO_DISABILITATO);
  13434.            
  13435.             int length = statoList.size() + 1;
  13436.            
  13437.             String [] values = new String[length];
  13438.             String [] labels = new String[length];
  13439.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_STATO_QUALSIASI;
  13440.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CORS_STATO_QUALSIASI;
  13441.             for (int i =0; i < statoList.size() ; i ++) {
  13442.                 labels[i+1] = statoList.get(i);
  13443.                 values[i+1] = statoList.get(i);
  13444.             }
  13445.            
  13446.             String statoValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO);
  13447.            
  13448.             this.pd.addFilter(Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_CORS_STATO, statoValue, values, labels, true, this.getSize());
  13449.            
  13450.             return statoValue;
  13451.            
  13452.         } catch (Exception e) {
  13453.             this.logError("Exception: " + e.getMessage(), e);
  13454.             throw new DriverControlStationException(e);
  13455.         }
  13456.     }
  13457.    
  13458.     public void addFilterConfigurazioneCORSOrigin(ISearch ricerca, int idLista, String gestioneCORS) throws DriverControlStationException{
  13459.         try {
  13460.             if(gestioneCORS != null && Filtri.FILTRO_CONFIGURAZIONE_CORS_TIPO_VALORE_RIDEFINITO_ABILITATO.equals(gestioneCORS)) {
  13461.            
  13462.                 String corsOriginValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONFIGURAZIONE_CORS_ORIGIN);
  13463.                
  13464.                 this.pd.addTextFilter(Filtri.FILTRO_CONFIGURAZIONE_CORS_ORIGIN, CostantiControlStation.LABEL_FILTRO_CONFIGURAZIONE_CORS_ORIGIN, corsOriginValue, this.getSize());
  13465.             }
  13466.         } catch (Exception e) {
  13467.             this.logError("Exception: " + e.getMessage(), e);
  13468.             throw new DriverControlStationException(e);
  13469.         }
  13470.     }
  13471.    
  13472.     public String addFilterTipoConnettore(ISearch ricerca, int idLista, boolean visualizzaVoceIM) throws DriverControlStationException{
  13473.         return this.addFilterTipoConnettore(ricerca, idLista, visualizzaVoceIM, true);
  13474.     }
  13475.     public String addFilterTipoConnettore(ISearch ricerca, int idLista, boolean visualizzaVoceIM, boolean postBack) throws DriverControlStationException{
  13476.         String tipoConnettoreValue = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13477.         try {
  13478.            
  13479.            
  13480.             List<String> connettoriList = Connettori.getList();
  13481.             // rimozione disabilitato
  13482.             int indexDisabled = -1;
  13483.             for (int i = 0; i < connettoriList.size(); i++) {
  13484.                 if(TipiConnettore.DISABILITATO.getNome().equals(connettoriList.get(i))) {
  13485.                     indexDisabled = i;
  13486.                     break;
  13487.                 }
  13488.             }
  13489.             if(indexDisabled>=0) {
  13490.                 connettoriList.remove(indexDisabled);
  13491.             }
  13492.             if (!connettoriList.contains(TipiConnettore.HTTPS.toString())) {
  13493.                 connettoriList.add(TipiConnettore.HTTPS.toString());
  13494.             }
  13495.            
  13496.             Boolean confPers = ServletUtils.getObjectFromSession(this.request, this.session, Boolean.class, CostantiControlStation.SESSION_PARAMETRO_GESTIONE_CONFIGURAZIONI_PERSONALIZZATE);
  13497.             if(confPers==null) {
  13498.                 confPers = this.core!=null ? this.core.isShowConfigurazioniPersonalizzate() : true;
  13499.             }

  13500.             TipologiaConnettori tipologiaConnettori = null;
  13501.             try {
  13502.                 tipologiaConnettori = Utilities.getTipologiaConnettori(this.core);
  13503.             } catch (Exception e) {
  13504.                 // default
  13505.                 tipologiaConnettori = TipologiaConnettori.TIPOLOGIA_CONNETTORI_ALL;
  13506.             }
  13507.            
  13508.             // custom come da schermata configurazione connettore
  13509.             if (confPers && TipologiaConnettori.TIPOLOGIA_CONNETTORI_ALL.equals(tipologiaConnettori))
  13510.                 connettoriList.add(TipiConnettore.CUSTOM.toString());
  13511.            
  13512.             List<String> connettoriListLabels = new ArrayList<>();
  13513.             for (String tipoConnettore : connettoriList) {
  13514.                 TipiConnettore tipoC = TipiConnettore.toEnumFromName(tipoConnettore);
  13515.                 if(tipoC!=null) {
  13516.                     connettoriListLabels.add(tipoC.getLabel());
  13517.                 }
  13518.                 else {
  13519.                     connettoriListLabels.add(tipoConnettore);
  13520.                 }
  13521.             }
  13522.            
  13523.             // IM
  13524.             if(visualizzaVoceIM) {
  13525.                 if(this.core.isIntegrationManagerEnabled()) {
  13526.                     connettoriList.add(Filtri.FILTRO_CONNETTORE_TIPO_VALORE_IM);
  13527.                     connettoriListLabels.add(ConnettoriCostanti.LABEL_FILTRO_TIPO_CONNETTORE_IM);
  13528.                 }
  13529.             }
  13530.            
  13531.             int length = connettoriList.size() + 1;
  13532.            
  13533.             String [] values = new String[length];
  13534.             String [] labels = new String[length];
  13535.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13536.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13537.             for (int i =0; i < connettoriList.size() ; i ++) {
  13538.                 labels[i+1] = connettoriListLabels.get(i);
  13539.                 values[i+1] = connettoriList.get(i);
  13540.             }
  13541.            
  13542.             tipoConnettoreValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TIPO);
  13543.            
  13544.             this.pd.addFilter(Filtri.FILTRO_CONNETTORE_TIPO, ConnettoriCostanti.LABEL_FILTRO_TIPO_CONNETTORE, tipoConnettoreValue, values, labels, postBack, this.getSize());
  13545.            
  13546.         } catch (Exception e) {
  13547.             this.logError("Exception: " + e.getMessage(), e);
  13548.             throw new DriverControlStationException(e);
  13549.         }
  13550.        
  13551.         return tipoConnettoreValue;
  13552.     }
  13553.    
  13554.     public void addFilterConnettorePlugin(ISearch ricerca, int idLista, String tipoConnettore) throws DriverControlStationException{
  13555.         try {
  13556.             if(tipoConnettore != null && tipoConnettore.equals(TipiConnettore.CUSTOM.toString())) {
  13557.                
  13558.                 String pluginValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TIPO_PLUGIN);
  13559.                 String pluginLabel = "";
  13560.            
  13561.                 List<DataElement> dati = new ArrayList<>();
  13562.                
  13563.                 this.addCustomFieldSearchForm(TipoPlugin.CONNETTORE,
  13564.                         null,
  13565.                         null,
  13566.                         Filtri.FILTRO_CONNETTORE_TIPO,
  13567.                         Filtri.FILTRO_CONNETTORE_TIPO_PLUGIN,
  13568.                         pluginLabel,
  13569.                         pluginValue, false, dati,
  13570.                         false);
  13571.                
  13572.                 // dentro dati c'e' solo un elemento
  13573.                 DataElement dataElement = dati.get(0);
  13574.                
  13575.                 if(dataElement.getValues() != null && dataElement.getValues().length > 0) {
  13576.                     this.pd.addFilter(Filtri.FILTRO_CONNETTORE_TIPO_PLUGIN, pluginLabel, pluginValue, dataElement.getValues(), dataElement.getLabels(), false, this.getSize());
  13577.                 }
  13578.             }
  13579.         } catch (Exception e) {
  13580.             this.logError("Exception: " + e.getMessage(), e);
  13581.             throw new DriverControlStationException(e);
  13582.         }
  13583.     }
  13584.    
  13585.     public void addFilterConnettoreTokenPolicy(ISearch ricerca, int idLista, String tipoConnettore) throws DriverControlStationException{
  13586.         try {
  13587.             if(tipoConnettore != null &&
  13588.                 (tipoConnettore.equals("") ||
  13589.                         tipoConnettore.equals(TipiConnettore.HTTPS.toString())||
  13590.                         tipoConnettore.equals(TipiConnettore.HTTP.toString()))) {
  13591.            
  13592.                 // controllo esistenza token policy
  13593.                 List<GenericProperties> gestorePolicyTokenList = this.confCore.gestorePolicyTokenList(null, ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_RETRIEVE_POLICY_TOKEN, null);
  13594.            
  13595.                 if(gestorePolicyTokenList.size() > 0) {
  13596.                     int length = gestorePolicyTokenList.size() + 1;
  13597.                    
  13598.                     String [] values = new String[length];
  13599.                     String [] labels = new String[length];
  13600.                     labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13601.                     values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13602.                
  13603.                     for (int i = 0; i < gestorePolicyTokenList.size(); i++) {
  13604.                         GenericProperties genericProperties = gestorePolicyTokenList.get(i);
  13605.                         labels[(i+1)] = genericProperties.getNome();
  13606.                         values[(i+1)] = genericProperties.getNome();
  13607.                     }
  13608.                    
  13609.                     String tokenPolicyValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_TOKEN_POLICY);
  13610.                    
  13611.                     this.pd.addFilter(Filtri.FILTRO_CONNETTORE_TOKEN_POLICY, ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_TOKEN_POLICY, tokenPolicyValue, values, labels, false, this.getSize());
  13612.                 }
  13613.             }
  13614.         } catch (Exception e) {
  13615.             this.logError("Exception: " + e.getMessage(), e);
  13616.             throw new DriverControlStationException(e);
  13617.         }
  13618.     }
  13619.    
  13620.     public void addFilterConnettoreEndpoint(ISearch ricerca, int idLista, String tipoConnettore) throws DriverControlStationException{
  13621.         try {
  13622.             if(tipoConnettore != null &&
  13623.                 (tipoConnettore.equals("") ||
  13624.                         tipoConnettore.equals(TipiConnettore.HTTPS.toString())||
  13625.                         tipoConnettore.equals(TipiConnettore.HTTP.toString())||
  13626.                         tipoConnettore.equals(TipiConnettore.JMS.toString())||
  13627.                         tipoConnettore.equals(TipiConnettore.FILE.toString()))) {
  13628.            
  13629.                 String endpointValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_ENDPOINT);
  13630.                
  13631.                 String filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_ENDPOINT;
  13632.                
  13633.                 if(tipoConnettore.equals(TipiConnettore.JMS.toString())) {
  13634.                     filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_ENDPOINT_JMS;
  13635.                 }
  13636.                
  13637.                 if(tipoConnettore.equals(TipiConnettore.FILE.toString())) {
  13638.                     filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_ENDPOINT_FILE;
  13639.                 }
  13640.                    
  13641.                 this.pd.addTextFilter(Filtri.FILTRO_CONNETTORE_ENDPOINT, filterLabel, endpointValue, this.getSize());
  13642.             }
  13643.         } catch (Exception e) {
  13644.             this.logError("Exception: " + e.getMessage(), e);
  13645.             throw new DriverControlStationException(e);
  13646.         }
  13647.     }
  13648.    
  13649.     public void addFilterConnettoreKeystore(ISearch ricerca, int idLista, String tipoConnettore) throws DriverControlStationException{
  13650.         try {
  13651.             if(tipoConnettore != null &&
  13652.                 (tipoConnettore.equals(TipiConnettore.HTTPS.toString()))) {
  13653.            
  13654.                 String keystoreValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_KEYSTORE);
  13655.                
  13656.                 String filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_KEYSTORE;
  13657.                    
  13658.                 this.pd.addTextFilter(Filtri.FILTRO_CONNETTORE_KEYSTORE, filterLabel, keystoreValue, this.getSize());
  13659.             }
  13660.         } catch (Exception e) {
  13661.             this.logError("Exception: " + e.getMessage(), e);
  13662.             throw new DriverControlStationException(e);
  13663.         }
  13664.     }
  13665.    
  13666.     public void addFilterConnettoreDebug(ISearch ricerca, int idLista, String tipoConnettore) throws DriverControlStationException{
  13667.         try {
  13668.            
  13669.             List<String> connettoriList = new ArrayList<>();
  13670.             connettoriList.add(Filtri.FILTRO_CONNETTORE_DEBUG_VALORE_ABILITATO);
  13671.             connettoriList.add(Filtri.FILTRO_CONNETTORE_DEBUG_VALORE_DISABILITATO);
  13672.            
  13673.             int length = connettoriList.size() + 1;
  13674.            
  13675.             String [] values = new String[length];
  13676.             String [] labels = new String[length];
  13677.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13678.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13679.             for (int i =0; i < connettoriList.size() ; i ++) {
  13680.                 labels[i+1] = connettoriList.get(i);
  13681.                 values[i+1] = connettoriList.get(i);
  13682.             }
  13683.            
  13684.             String debugValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_DEBUG);
  13685.            
  13686.             this.pd.addFilter(Filtri.FILTRO_CONNETTORE_DEBUG, ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_DEBUG, debugValue, values, labels, false, this.getSize());
  13687.            
  13688.         } catch (Exception e) {
  13689.             this.logError("Exception: " + e.getMessage(), e);
  13690.             throw new DriverControlStationException(e);
  13691.         }
  13692.     }
  13693.    
  13694.     public String addFilterNomeConnettoreMultiplo(ISearch ricerca, int idLista) throws DriverControlStationException{
  13695.         try {
  13696.             String nomeValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_MULTIPLO_NOME);
  13697.            
  13698.             String filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_MULTIPLO_NOME;
  13699.                
  13700.             this.pd.addTextFilter(Filtri.FILTRO_CONNETTORE_MULTIPLO_NOME, filterLabel, nomeValue, this.getSize());
  13701.            
  13702.             return nomeValue;
  13703.         } catch (Exception e) {
  13704.             this.logError("Exception: " + e.getMessage(), e);
  13705.             throw new DriverControlStationException(e);
  13706.         }
  13707.     }
  13708.    
  13709.     public void addFilterFiltroConnettoreMultiplo(ISearch ricerca, int idLista, boolean behaviourConFiltri) throws DriverControlStationException{
  13710.         try {
  13711.             if(behaviourConFiltri) {
  13712.            
  13713.                 String filtroValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_CONNETTORE_MULTIPLO_FILTRO);
  13714.                
  13715.                 String filterLabel = ConnettoriCostanti.LABEL_FILTRO_CONNETTORE_MULTIPLO_FILTRO;
  13716.                    
  13717.                 this.pd.addTextFilter(Filtri.FILTRO_CONNETTORE_MULTIPLO_FILTRO, filterLabel, filtroValue, this.getSize());
  13718.             }
  13719.         } catch (Exception e) {
  13720.             this.logError("Exception: " + e.getMessage(), e);
  13721.             throw new DriverControlStationException(e);
  13722.         }
  13723.     }
  13724.    
  13725.     public void addFilterModIKeystorePath(ISearch ricerca, int idLista) throws DriverControlStationException{
  13726.         try {
  13727.            
  13728.             String keystorePathValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_KEYSTORE_PATH);
  13729.             String filterPathLabel = CostantiLabel.MODIPA_API_IMPL_PROFILO_SICUREZZA_MESSAGGIO_CERTIFICATI_KEYSTORE_PATH_MODE_LABEL;
  13730.             this.pd.addTextFilter(Filtri.FILTRO_MODI_KEYSTORE_PATH, filterPathLabel, keystorePathValue, this.getSize());
  13731.            
  13732.         } catch (Exception e) {
  13733.             this.logError("Exception: " + e.getMessage(), e);
  13734.             throw new DriverControlStationException(e);
  13735.         }
  13736.     }
  13737.    
  13738.     public void addFilterModIKeystoreSubject(ISearch ricerca, int idLista) throws DriverControlStationException{
  13739.         try {
  13740.            
  13741.             String keystoreSubjectValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_KEYSTORE_SUBJECT);
  13742.             String filterSubjectLabel = CostantiLabel.MODIPA_API_IMPL_PROFILO_SICUREZZA_MESSAGGIO_CERTIFICATI_X509_SUBJECT_MODE_LABEL;
  13743.             this.pd.addTextFilter(Filtri.FILTRO_MODI_KEYSTORE_SUBJECT, filterSubjectLabel, keystoreSubjectValue, this.getSize());
  13744.            
  13745.         } catch (Exception e) {
  13746.             this.logError("Exception: " + e.getMessage(), e);
  13747.             throw new DriverControlStationException(e);
  13748.         }
  13749.     }
  13750.    
  13751.     public void addFilterModIKeystoreIssuer(ISearch ricerca, int idLista) throws DriverControlStationException{
  13752.         try {
  13753.            
  13754.             String keystoreIssuerValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_KEYSTORE_ISSUER);
  13755.             String filterIssuerLabel = CostantiLabel.MODIPA_API_IMPL_PROFILO_SICUREZZA_MESSAGGIO_CERTIFICATI_X509_ISSUER_MODE_LABEL;
  13756.             this.pd.addTextFilter(Filtri.FILTRO_MODI_KEYSTORE_ISSUER, filterIssuerLabel, keystoreIssuerValue, this.getSize());
  13757.            
  13758.         } catch (Exception e) {
  13759.             this.logError("Exception: " + e.getMessage(), e);
  13760.             throw new DriverControlStationException(e);
  13761.         }
  13762.     }
  13763.    
  13764.     public void addFilterModITokenPolicy(ISearch ricerca, int idLista, boolean postBack) throws DriverControlStationException{
  13765.         try {
  13766.             List<GenericProperties> gestorePolicyTokenList = this.confCore.gestorePolicyTokenList(null, ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN, null);
  13767.             String [] policyLabels = new String[gestorePolicyTokenList.size() + 1];
  13768.             String [] policyValues = new String[gestorePolicyTokenList.size() + 1];

  13769.             policyLabels[0] = CostantiControlStation.LABEL_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  13770.             policyValues[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;

  13771.             for (int i = 0; i < gestorePolicyTokenList.size(); i++) {
  13772.                 GenericProperties genericProperties = gestorePolicyTokenList.get(i);
  13773.                 policyLabels[(i+1)] = genericProperties.getNome();
  13774.                 policyValues[(i+1)] = genericProperties.getNome();
  13775.             }
  13776.                
  13777.             String tokenPolicyValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_TOKEN_POLICY);
  13778.             String selectedValue = tokenPolicyValue != null ? tokenPolicyValue : CostantiControlStation.DEFAULT_VALUE_PARAMETRO_TIPO_CREDENZIALI_QUALSIASI;
  13779.            
  13780.             String label = CostantiLabel.LABEL_CREDENZIALI_AUTENTICAZIONE_TOKEN_POLICY;

  13781.             this.pd.addFilter(Filtri.FILTRO_MODI_SICUREZZA_TOKEN_POLICY, label, selectedValue, policyValues, policyLabels, postBack, this.getSize());
  13782.            
  13783.         } catch (Exception e) {
  13784.             this.logError("Exception: " + e.getMessage(), e);
  13785.             throw new DriverControlStationException(e);
  13786.         }
  13787.     }
  13788.    
  13789.     public void addFilterModITokenClientId(ISearch ricerca, int idLista) throws DriverControlStationException{
  13790.         try {
  13791.            
  13792.             String tokenClientIdValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_TOKEN_CLIENT_ID);
  13793.             String tokenClientIdLabel = CostantiLabel.LABEL_CREDENZIALI_AUTENTICAZIONE_TOKEN_CLIENT_ID_SEARCH;
  13794.             this.pd.addTextFilter(Filtri.FILTRO_MODI_SICUREZZA_TOKEN_CLIENT_ID, tokenClientIdLabel, tokenClientIdValue, this.getSize());
  13795.            
  13796.         } catch (Exception e) {
  13797.             this.logError("Exception: " + e.getMessage(), e);
  13798.             throw new DriverControlStationException(e);
  13799.         }
  13800.     }
  13801.    
  13802.     public void addFilterModIAudience(ISearch ricerca, int idLista, boolean applicativi, String filterTipoAccordo, String filterDominio) throws DriverControlStationException{
  13803.         try {
  13804.             String audienceValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_AUDIENCE);
  13805.            
  13806.             String filterLabel = null;
  13807.             if(applicativi) {
  13808.                 if(SoggettiCostanti.SOGGETTO_DOMINIO_ESTERNO_VALUE.equals(filterDominio)) {
  13809.                     filterLabel = CostantiLabel.MODIPA_APPLICATIVI_AUDIENCE_RISPOSTA_INFO_DOMINIO_ESTERNO_LABEL;
  13810.                 }
  13811.                 else {
  13812.                     filterLabel = CostantiLabel.MODIPA_APPLICATIVI_AUDIENCE_RISPOSTA_INFO_DOMINIO_INTERNO_LABEL_FILTRO_RICERCA;
  13813.                 }
  13814.             }
  13815.             else {
  13816.                 if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST.toLowerCase().equals(filterTipoAccordo)) {
  13817.                     filterLabel = CostantiLabel.MODIPA_API_IMPL_PROFILO_SICUREZZA_MESSAGGIO_AUDIENCE_RICHIESTA_REST_LABEL;
  13818.                 }
  13819.                 else if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP.toLowerCase().equals(filterTipoAccordo)) {
  13820.                     filterLabel = CostantiLabel.MODIPA_API_IMPL_PROFILO_SICUREZZA_MESSAGGIO_AUDIENCE_RICHIESTA_SOAP_LABEL;
  13821.                 }
  13822.                 else {
  13823.                     filterLabel = CostantiLabel.MODIPA_APPLICATIVI_AUDIENCE_WSATO_LABEL;
  13824.                 }
  13825.             }
  13826.                
  13827.             this.pd.addTextFilter(Filtri.FILTRO_MODI_AUDIENCE, filterLabel, audienceValue, this.getSize());
  13828.         } catch (Exception e) {
  13829.             this.logError("Exception: " + e.getMessage(), e);
  13830.             throw new DriverControlStationException(e);
  13831.         }
  13832.     }
  13833.    
  13834.     public void addFilterModISicurezzaCanale(ISearch ricerca, int idLista) throws DriverControlStationException{
  13835.         try {
  13836.             // controllo esistenza token policy
  13837.             List<String> labelsList = this.getProfiloModIPAFiltroSicurezzaCanaleLabels();
  13838.             List<String> valuesList = this.getProfiloModIPAFiltroSicurezzaCanaleValues();
  13839.             int length = valuesList.size() + 1;
  13840.                
  13841.             String [] values = new String[length];
  13842.             String [] labels = new String[length];
  13843.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13844.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13845.            
  13846.             for (int i = 0; i < valuesList.size(); i++) {
  13847.                 labels[(i+1)] = labelsList.get(i);
  13848.                 values[(i+1)] = valuesList.get(i);
  13849.             }
  13850.            
  13851.             String sicurezzaCanaleValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_CANALE);
  13852.            
  13853.             this.pd.addFilter(Filtri.FILTRO_MODI_SICUREZZA_CANALE, CostantiLabel.MODIPA_API_PROFILO_CANALE_LABEL, sicurezzaCanaleValue, values, labels, false, this.getSize());
  13854.         } catch (Exception e) {
  13855.             this.logError("Exception: " + e.getMessage(), e);
  13856.             throw new DriverControlStationException(e);
  13857.         }
  13858.     }
  13859.    
  13860.     public void addFilterModISicurezzaMessaggio(ISearch ricerca, int idLista, String serviceBindingValue) throws DriverControlStationException{
  13861.         try {
  13862.             // controllo esistenza token policy
  13863.             List<String> labelsList = this.getProfiloModIPAFiltroSicurezzaMessaggioLabels(serviceBindingValue);
  13864.             List<String> valuesList = this.getProfiloModIPAFiltroSicurezzaMessaggioValues(serviceBindingValue);
  13865.             int length = valuesList.size() + 1;
  13866.                
  13867.             String [] values = new String[length];
  13868.             String [] labels = new String[length];
  13869.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13870.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13871.            
  13872.             for (int i = 0; i < valuesList.size(); i++) {
  13873.                 labels[(i+1)] = labelsList.get(i);
  13874.                 values[(i+1)] = valuesList.get(i);
  13875.             }
  13876.            
  13877.             String sicurezzaCanaleValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_MESSAGGIO);
  13878.            
  13879.             this.pd.addFilter(Filtri.FILTRO_MODI_SICUREZZA_MESSAGGIO, CostantiLabel.MODIPA_API_PROFILO_SICUREZZA_MESSAGGIO_LABEL, sicurezzaCanaleValue, values, labels, false, this.getSize());
  13880.         } catch (Exception e) {
  13881.             this.logError("Exception: " + e.getMessage(), e);
  13882.             throw new DriverControlStationException(e);
  13883.         }
  13884.     }
  13885.    
  13886.     public void addFilterModIGenerazioneToken(ISearch ricerca, int idLista) throws DriverControlStationException{
  13887.         try {
  13888.             String [] v = {CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE,
  13889.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND,
  13890.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH};
  13891.             List<String> valuesList = Arrays.asList(v);
  13892.            
  13893.             String [] l = {CostantiLabel.MODIPA_SICUREZZA_CHOICE_MESSAGE_LABEL,
  13894.                     CostantiLabel.MODIPA_SICUREZZA_CHOICE_TOKEN_PDND_LABEL,
  13895.                     CostantiLabel.MODIPA_SICUREZZA_CHOICE_TOKEN_OAUTH_LABEL};
  13896.             List<String> labelsList = Arrays.asList(l);
  13897.            
  13898.             int length = valuesList.size() + 1;
  13899.                
  13900.             String [] values = new String[length];
  13901.             String [] labels = new String[length];
  13902.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13903.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13904.            
  13905.             for (int i = 0; i < valuesList.size(); i++) {
  13906.                 labels[(i+1)] = labelsList.get(i);
  13907.                 values[(i+1)] = valuesList.get(i);
  13908.             }
  13909.            
  13910.             String generazioneTokenValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SORGENTE_TOKEN);
  13911.            
  13912.             this.pd.addFilter(Filtri.FILTRO_MODI_SORGENTE_TOKEN, CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH, generazioneTokenValue, values, labels, false, this.getSize());
  13913.         } catch (Exception e) {
  13914.             this.logError("Exception: " + e.getMessage(), e);
  13915.             throw new DriverControlStationException(e);
  13916.         }
  13917.     }
  13918.    
  13919.     public String addFilterModISicurezzaMessaggioSA(ISearch ricerca, int idLista, boolean postback) throws DriverControlStationException{
  13920.         try {
  13921.             /**List<String> valuesList = Arrays.asList(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);*/
  13922.             // non ha senso in modi controllare quelli disabilitati
  13923.             String [] valueAbilitatoOnly = {StatoFunzionalita.ABILITATO.getValue()};
  13924.             List<String> valuesList = Arrays.asList(valueAbilitatoOnly);
  13925.             int length = valuesList.size() + 1;
  13926.                
  13927.             String [] values = new String[length];
  13928.             String [] labels = new String[length];
  13929.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13930.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13931.            
  13932.             for (int i = 0; i < valuesList.size(); i++) {
  13933.                 labels[(i+1)] = valuesList.get(i);
  13934.                 values[(i+1)] = valuesList.get(i);
  13935.             }
  13936.            
  13937.             String sicurezzaMessaggioValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_MESSAGGIO);
  13938.            
  13939.             this.pd.addFilter(Filtri.FILTRO_MODI_SICUREZZA_MESSAGGIO, CostantiLabel.MODIPA_SICUREZZA_MESSAGGIO_FIRMA_APPLICATIVO_SUBTITLE_LABEL, sicurezzaMessaggioValue, values, labels, postback, this.getSize());
  13940.            
  13941.             return sicurezzaMessaggioValue;
  13942.            
  13943.         } catch (Exception e) {
  13944.             this.logError("Exception: " + e.getMessage(), e);
  13945.             throw new DriverControlStationException(e);
  13946.         }
  13947.     }
  13948.    
  13949.     public String addFilterModISicurezzaTokenSA(ISearch ricerca, int idLista, boolean postback) throws DriverControlStationException{
  13950.         try {
  13951.             /**List<String> valuesList = Arrays.asList(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);*/
  13952.             // non ha senso in modi controllare quelli disabilitati
  13953.             String [] valueAbilitatoOnly = {StatoFunzionalita.ABILITATO.getValue()};
  13954.             List<String> valuesList = Arrays.asList(valueAbilitatoOnly);
  13955.             int length = valuesList.size() + 1;
  13956.                
  13957.             String [] values = new String[length];
  13958.             String [] labels = new String[length];
  13959.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13960.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13961.            
  13962.             for (int i = 0; i < valuesList.size(); i++) {
  13963.                 labels[(i+1)] = valuesList.get(i);
  13964.                 values[(i+1)] = valuesList.get(i);
  13965.             }
  13966.            
  13967.             String sicurezzaMessaggioValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_SICUREZZA_TOKEN);
  13968.            
  13969.             this.pd.addFilter(Filtri.FILTRO_MODI_SICUREZZA_TOKEN, CostantiLabel.MODIPA_SICUREZZA_TOKEN_SUBTITLE_LABEL, sicurezzaMessaggioValue, values, labels, postback, this.getSize());
  13970.            
  13971.             return sicurezzaMessaggioValue;
  13972.            
  13973.         } catch (Exception e) {
  13974.             this.logError("Exception: " + e.getMessage(), e);
  13975.             throw new DriverControlStationException(e);
  13976.         }
  13977.     }
  13978.    
  13979.     public void addFilterModIDigestRichiesta(ISearch ricerca, int idLista) throws DriverControlStationException{
  13980.         try {
  13981.             /**List<String> valuesList = Arrays.asList(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);*/
  13982.             // non ha senso in modi controllare quelli disabilitati
  13983.             String [] valueAbilitatoOnly = {StatoFunzionalita.ABILITATO.getValue()};
  13984.             List<String> valuesList = Arrays.asList(valueAbilitatoOnly);
  13985.             int length = valuesList.size() + 1;
  13986.                
  13987.             String [] values = new String[length];
  13988.             String [] labels = new String[length];
  13989.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  13990.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  13991.            
  13992.             for (int i = 0; i < valuesList.size(); i++) {
  13993.                 labels[(i+1)] = valuesList.get(i);
  13994.                 values[(i+1)] = valuesList.get(i);
  13995.             }
  13996.            
  13997.             String digestRichiestaValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_DIGEST_RICHIESTA);
  13998.            
  13999.             this.pd.addFilter(Filtri.FILTRO_MODI_DIGEST_RICHIESTA, CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_LABEL,
  14000.                     digestRichiestaValue, values, labels, false, this.getSize());
  14001.         } catch (Exception e) {
  14002.             this.logError("Exception: " + e.getMessage(), e);
  14003.             throw new DriverControlStationException(e);
  14004.         }
  14005.     }
  14006.    
  14007.     public void addFilterModIInfoUtente(ISearch ricerca, int idLista) throws DriverControlStationException{
  14008.         try {
  14009.             String [] v = {CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_AUDIT_REST_01,
  14010.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_AUDIT_REST_02,
  14011.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_OLD};
  14012.             List<String> valuesList = Arrays.asList(v);
  14013.            
  14014.             String [] l = {CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_AUDIT_REST_01,
  14015.                     CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_AUDIT_REST_02,
  14016.                     CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_OLD};
  14017.             List<String> labelsList = Arrays.asList(l);
  14018.            
  14019.             int length = valuesList.size() + 1;
  14020.                
  14021.             String [] values = new String[length];
  14022.             String [] labels = new String[length];
  14023.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  14024.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  14025.            
  14026.             for (int i = 0; i < valuesList.size(); i++) {
  14027.                 labels[(i+1)] = labelsList.get(i);
  14028.                 values[(i+1)] = valuesList.get(i);
  14029.             }
  14030.            
  14031.             String infoUtenteValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_MODI_INFORMAZIONI_UTENTE);
  14032.            
  14033.             this.pd.addFilter(Filtri.FILTRO_MODI_INFORMAZIONI_UTENTE, CostantiControlStation.LABEL_FILTRO_MODIPA_INFO_UTENTE, infoUtenteValue, values, labels, false, this.getSize());
  14034.         } catch (Exception e) {
  14035.             this.logError("Exception: " + e.getMessage(), e);
  14036.             throw new DriverControlStationException(e);
  14037.         }
  14038.     }

  14039.     public List<String> getProfiloModIPAFiltroSicurezzaCanaleValues() {
  14040.         try {
  14041.             List<String> values = new ArrayList<>();
  14042.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_CANALE_VALUE_IDAC01);
  14043.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_CANALE_VALUE_IDAC02);
  14044.             return values;
  14045.         }catch(Throwable t) {
  14046.             return null;
  14047.         }
  14048.     }
  14049.    
  14050.     public List<String> getProfiloModIPAFiltroSicurezzaCanaleLabels() {
  14051.         List<String> labels = null;
  14052.         try {
  14053.             labels = new ArrayList<>();
  14054.             labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_CANALE_LABEL_IDAC01);
  14055.             labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_CANALE_LABEL_IDAC02);
  14056.             return labels;
  14057.         }catch(Exception t) {
  14058.             return labels;
  14059.         }
  14060.     }
  14061.    
  14062.     public List<String> getProfiloModIPAFiltroSicurezzaMessaggioValues(String serviceBindingValue) {
  14063.         List<String> values = null;
  14064.         try {
  14065.             values = new ArrayList<>();
  14066.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01);
  14067.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02);
  14068.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301);
  14069.             values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302);
  14070.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST.toLowerCase().equals(serviceBindingValue)
  14071.                     ||
  14072.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP.toLowerCase().equals(serviceBindingValue)) {
  14073.                 values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401);
  14074.                 values.add(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402);
  14075.             }
  14076.             return values;
  14077.         }catch(Exception t) {
  14078.             return values;
  14079.         }
  14080.     }
  14081.    
  14082.     public List<String> getProfiloModIPAFiltroSicurezzaMessaggioLabels(String serviceBindingValue) {
  14083.         List<String> labels = null;
  14084.         try {
  14085.             labels = new ArrayList<>();
  14086.            
  14087.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST.toLowerCase().equals(serviceBindingValue) ) {
  14088.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_REST);
  14089.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_REST);
  14090.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_REST);
  14091.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_REST);
  14092.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0401_REST);
  14093.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0402_REST);
  14094.             }
  14095.             else if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP.toLowerCase().equals(serviceBindingValue) ) {
  14096.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_SOAP);
  14097.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_SOAP);
  14098.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_SOAP);
  14099.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_SOAP);
  14100.             }
  14101.             else {
  14102.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01);
  14103.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02);
  14104.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301);
  14105.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302);
  14106.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0401);
  14107.                 labels.add(CostantiLabel.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0402);
  14108.             }
  14109.            
  14110.             return labels;
  14111.         }catch(Exception t) {
  14112.             return labels;
  14113.         }
  14114.     }
  14115.    
  14116.    
  14117.     public void addFilterProprietaNome(ISearch ricerca, int idLista, List<String> nomiProprieta) throws DriverControlStationException{
  14118.         try {
  14119.             // controllo esistenza token policy
  14120.             int length = nomiProprieta.size() + 1;
  14121.                
  14122.             String [] values = new String[length];
  14123.             String [] labels = new String[length];
  14124.             labels[0] = CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI;
  14125.             values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI;
  14126.            
  14127.             for (int i = 0; i < nomiProprieta.size(); i++) {
  14128.                 labels[(i+1)] = nomiProprieta.get(i);
  14129.                 values[(i+1)] = nomiProprieta.get(i);
  14130.             }
  14131.            
  14132.             String nomeProprietaValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_PROPRIETA_NOME);
  14133.            
  14134.             this.pd.addFilter(Filtri.FILTRO_PROPRIETA_NOME, CostantiControlStation.LABEL_FILTRO_PROPRIETA_NOME, nomeProprietaValue, values, labels, false, this.getSize());
  14135.         } catch (Exception e) {
  14136.             this.logError("Exception: " + e.getMessage(), e);
  14137.             throw new DriverControlStationException(e);
  14138.         }
  14139.     }
  14140.    
  14141.     public void addFilterProprietaValore(ISearch ricerca, int idLista, List<String> nomiProprieta) throws DriverControlStationException{
  14142.         try {
  14143.             String valoreProprietaValue = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_PROPRIETA_VALORE);
  14144.            
  14145.             String filterLabel = CostantiControlStation.LABEL_FILTRO_PROPRIETA_VALORE;
  14146.                
  14147.             this.pd.addTextFilter(Filtri.FILTRO_PROPRIETA_VALORE, filterLabel, valoreProprietaValue, this.getSize());
  14148.         } catch (Exception e) {
  14149.             this.logError("Exception: " + e.getMessage(), e);
  14150.             throw new DriverControlStationException(e);
  14151.         }
  14152.     }
  14153.    
  14154.     // LABEL PROTOCOLLI
  14155.    
  14156.     public List<String> getLabelsProtocolli(List<String> protocolli) throws DriverControlStationException{
  14157.         try {
  14158.             return NamingUtils.getLabelsProtocolli(protocolli);
  14159.         }catch(Exception e) {
  14160.             throw new DriverControlStationException(e.getMessage(),e);
  14161.         }
  14162.     }
  14163.    
  14164.     public String getLabelProtocollo(String protocollo) throws DriverControlStationException{
  14165.         try {
  14166.             return NamingUtils.getLabelProtocollo(protocollo);
  14167.         }catch(Exception e) {
  14168.             throw new DriverControlStationException(e.getMessage(),e);
  14169.         }
  14170.     }
  14171.        
  14172.     public static String _getLabelProtocollo(String protocollo) throws DriverControlStationException{
  14173.         try {
  14174.             return NamingUtils.getLabelProtocollo(protocollo);
  14175.         }catch(Exception e) {
  14176.             throw new DriverControlStationException(e.getMessage(),e);
  14177.         }
  14178.     }
  14179.    
  14180.     public String getDescrizioneProtocollo(String protocollo) throws DriverControlStationException{
  14181.         try {
  14182.             return NamingUtils.getDescrizioneProtocollo(protocollo);
  14183.         }catch(Exception e) {
  14184.             throw new DriverControlStationException(e.getMessage(),e);
  14185.         }
  14186.     }
  14187.    
  14188.     public String getWebSiteProtocollo(String protocollo) throws DriverControlStationException{
  14189.         try {
  14190.             return NamingUtils.getWebSiteProtocollo(protocollo);
  14191.         }catch(Exception e) {
  14192.             throw new DriverControlStationException(e.getMessage(),e);
  14193.         }
  14194.     }
  14195.    
  14196.    
  14197.     // LABEL SOGGETTI
  14198.    
  14199.     public String getLabelNomeSoggetto(IDSoggetto idSoggetto) throws DriverControlStationException{
  14200.         try {
  14201.             return NamingUtils.getLabelSoggetto(idSoggetto);
  14202.         }catch(Exception e) {
  14203.             throw new DriverControlStationException(e.getMessage(),e);
  14204.         }
  14205.     }
  14206.    
  14207.     public static String _getLabelNomeSoggetto(IDSoggetto idSoggetto) throws DriverControlStationException{
  14208.         try {
  14209.             return NamingUtils.getLabelSoggetto(idSoggetto);
  14210.         }catch(Exception e) {
  14211.             throw new DriverControlStationException(e.getMessage(),e);
  14212.         }
  14213.     }
  14214.     public String getLabelNomeSoggetto(String protocollo, IDSoggetto idSoggetto) throws DriverControlStationException{
  14215.         try {
  14216.             return NamingUtils.getLabelSoggetto(protocollo, idSoggetto);
  14217.         }catch(Exception e) {
  14218.             throw new DriverControlStationException(e.getMessage(),e);
  14219.         }
  14220.     }
  14221.     public String getLabelNomeSoggetto(String protocollo, String tipoSoggetto, String nomeSoggetto) throws DriverControlStationException{
  14222.         try {
  14223.             return NamingUtils.getLabelSoggetto(protocollo, tipoSoggetto, nomeSoggetto);
  14224.         }catch(Exception e) {
  14225.             throw new DriverControlStationException(e.getMessage(),e);
  14226.         }
  14227.     }
  14228.    
  14229.    
  14230.     // APPLICATIVI
  14231.    
  14232.     public String getLabelServizioApplicativo(IDServizioApplicativo idServizioApplicativo) throws DriverControlStationException{
  14233.         try {
  14234.             return NamingUtils.getLabelServizioApplicativo(idServizioApplicativo);
  14235.         }catch(Exception e) {
  14236.             throw new DriverControlStationException(e.getMessage(),e);
  14237.         }
  14238.     }
  14239.     public String getLabelServizioApplicativo(String protocollo, IDServizioApplicativo idServizioApplicativo) throws DriverControlStationException{
  14240.         try {
  14241.             return NamingUtils.getLabelServizioApplicativo(protocollo, idServizioApplicativo);
  14242.         }catch(Exception e) {
  14243.             throw new DriverControlStationException(e.getMessage(),e);
  14244.         }
  14245.     }
  14246.     public String getLabelServizioApplicativoConDominioSoggetto(IDServizioApplicativo idServizioApplicativo) throws DriverControlStationException{
  14247.         try {
  14248.             return NamingUtils.getLabelServizioConDominioErogatore(idServizioApplicativo.getNome(),NamingUtils.getLabelSoggetto(idServizioApplicativo.getIdSoggettoProprietario()));
  14249.         }catch(Exception e) {
  14250.             throw new DriverControlStationException(e.getMessage(),e);
  14251.         }
  14252.     }
  14253.     public String getLabelServizioApplicativoConDominioSoggetto(String protocollo, IDServizioApplicativo idServizioApplicativo) throws DriverControlStationException{
  14254.         try {
  14255.             return NamingUtils.getLabelServizioConDominioErogatore(idServizioApplicativo.getNome(),NamingUtils.getLabelSoggetto(protocollo, idServizioApplicativo.getIdSoggettoProprietario()));
  14256.         }catch(Exception e) {
  14257.             throw new DriverControlStationException(e.getMessage(),e);
  14258.         }
  14259.     }
  14260.    
  14261.    
  14262.     // LABEL API
  14263.    
  14264.     public String getLabelIdAccordo(AccordoServizioParteComune as) throws DriverControlStationException{
  14265.         try {
  14266.             return NamingUtils.getLabelAccordoServizioParteComune(as);
  14267.         }catch(Exception e) {
  14268.             throw new DriverControlStationException(e.getMessage(),e);
  14269.         }
  14270.     }
  14271.     public String getLabelIdAccordo(AccordoServizioParteComuneSintetico as) throws DriverControlStationException{
  14272.         try {
  14273.             return NamingUtils.getLabelAccordoServizioParteComune(as);
  14274.         }catch(Exception e) {
  14275.             throw new DriverControlStationException(e.getMessage(),e);
  14276.         }
  14277.     }
  14278.     public String getLabelIdAccordo(IDAccordo idAccordo) throws DriverControlStationException{
  14279.         try {
  14280.             return NamingUtils.getLabelAccordoServizioParteComune(idAccordo);
  14281.         }catch(Exception e) {
  14282.             throw new DriverControlStationException(e.getMessage(),e);
  14283.         }
  14284.     }
  14285.     public String getLabelIdAccordo(String protocollo, IDAccordo idAccordo) throws DriverControlStationException{
  14286.         try {
  14287.             return NamingUtils.getLabelAccordoServizioParteComune(protocollo, idAccordo);
  14288.         }catch(Exception e) {
  14289.             throw new DriverControlStationException(e.getMessage(),e);
  14290.         }
  14291.     }
  14292.     public String getLabelIdAccordoSenzaReferente(String protocollo, IDAccordo idAccordo) throws DriverControlStationException{
  14293.         try {
  14294.             return NamingUtils.getLabelAccordoServizioParteComune(protocollo, idAccordo,false);
  14295.         }catch(Exception e) {
  14296.             throw new DriverControlStationException(e.getMessage(),e);
  14297.         }
  14298.     }
  14299.    
  14300.    
  14301.     // LABEL SERVIZI
  14302.    
  14303.     public String getLabelNomeServizio(String protocollo, String tipoServizio, String nomeServizio, Integer versioneInt) throws DriverControlStationException{
  14304.         try {
  14305.             return NamingUtils.getLabelAccordoServizioParteSpecificaSenzaErogatore(protocollo, tipoServizio, nomeServizio, versioneInt);
  14306.         }catch(Exception e) {
  14307.             throw new DriverControlStationException(e.getMessage(),e);
  14308.         }
  14309.     }
  14310.     public String getLabelIdServizio(AccordoServizioParteSpecifica as) throws DriverControlStationException{
  14311.         try {
  14312.             return NamingUtils.getLabelAccordoServizioParteSpecifica(as);
  14313.         }catch(Exception e) {
  14314.             throw new DriverControlStationException(e.getMessage(),e);
  14315.         }
  14316.     }
  14317.     public String getLabelIdServizio(IDServizio idServizio) throws DriverControlStationException{
  14318.         try {
  14319.             return NamingUtils.getLabelAccordoServizioParteSpecifica(idServizio);
  14320.         }catch(Exception e) {
  14321.             throw new DriverControlStationException(e.getMessage(),e);
  14322.         }
  14323.     }
  14324.     public String getLabelIdServizio(String protocollo, IDServizio idServizio) throws DriverControlStationException{
  14325.         try {
  14326.             return NamingUtils.getLabelAccordoServizioParteSpecifica(protocollo, idServizio);
  14327.         }catch(Exception e) {
  14328.             throw new DriverControlStationException(e.getMessage(),e);
  14329.         }
  14330.     }
  14331.     public String getLabelIdServizioSenzaErogatore(String protocollo, IDServizio idServizio) throws DriverControlStationException{
  14332.         try {
  14333.             return NamingUtils.getLabelAccordoServizioParteSpecificaSenzaErogatore(protocollo, idServizio);
  14334.         }catch(Exception e) {
  14335.             throw new DriverControlStationException(e.getMessage(),e);
  14336.         }
  14337.     }
  14338.     public String getLabelIdServizioSenzaErogatore(IDServizio idServizio) throws DriverControlStationException{
  14339.         try {
  14340.             return NamingUtils.getLabelAccordoServizioParteSpecificaSenzaErogatore(idServizio);
  14341.         }catch(Exception e) {
  14342.             throw new DriverControlStationException(e.getMessage(),e);
  14343.         }
  14344.     }
  14345.     public String getLabelServizioFruizione(String protocollo, IDSoggetto idSoggettoFruitore, AccordoServizioParteSpecifica asps) throws DriverControlStationException{
  14346.         try {
  14347.             return this.getLabelServizioFruizione(protocollo, idSoggettoFruitore, this.idServizioFactory.getIDServizioFromAccordo(asps));
  14348.         }catch(Exception e) {
  14349.             throw new DriverControlStationException(e.getMessage(),e);
  14350.         }
  14351.     }
  14352.     public String getLabelServizioFruizione(String protocollo, IDSoggetto idSoggettoFruitore, IDServizio idServizio) throws DriverControlStationException{
  14353.         String servizio = this.getLabelIdServizioSenzaErogatore(protocollo, idServizio);
  14354.         String soggetto = this.getLabelNomeSoggetto(protocollo, idServizio.getSoggettoErogatore());
  14355.         String labelServizio = NamingUtils.getLabelServizioConDominioErogatore(servizio, soggetto);
  14356.         boolean showSoggettoFruitoreInFruizioni = this.core.isMultitenant() &&
  14357.                 !this.isSoggettoMultitenantSelezionato();
  14358.         if(showSoggettoFruitoreInFruizioni) {
  14359.             String labelFruitore = this.getLabelNomeSoggetto(protocollo, idSoggettoFruitore);
  14360.             return labelFruitore + " -> " + labelServizio;
  14361.         }
  14362.         else {
  14363.             return labelServizio;
  14364.         }
  14365.     }
  14366.     public String getLabelServizioErogazione(String protocollo, AccordoServizioParteSpecifica asps) throws DriverControlStationException{
  14367.         try {
  14368.             return this.getLabelServizioErogazione(protocollo, this.idServizioFactory.getIDServizioFromAccordo(asps));
  14369.         }catch(Exception e) {
  14370.             throw new DriverControlStationException(e.getMessage(),e);
  14371.         }
  14372.     }
  14373.     public String getLabelServizioErogazione(String protocollo, IDServizio idServizio) throws DriverControlStationException{
  14374.         boolean showSoggettoErogatoreInErogazioni = this.core.isMultitenant() &&
  14375.                 !this.isSoggettoMultitenantSelezionato();
  14376.         if(showSoggettoErogatoreInErogazioni) {
  14377.             String servizio = this.getLabelIdServizioSenzaErogatore(protocollo, idServizio);
  14378.             String soggetto = this.getLabelNomeSoggetto(protocollo, idServizio.getSoggettoErogatore());
  14379.             return NamingUtils.getLabelServizioConDominioErogatore(servizio, soggetto);
  14380.         }
  14381.         else {
  14382.             return this.getLabelIdServizioSenzaErogatore(protocollo, idServizio);
  14383.         }
  14384.        
  14385.     }
  14386.    
  14387.     public String getLabelServizio(IDSoggetto idSoggettoFruitore, boolean gestioneFruitori, IDServizio idServizio, String tipoProtocollo) throws DriverControlStationException {
  14388.         String labelServizio = null;
  14389.         if(gestioneFruitori) {
  14390.             labelServizio = this.getLabelServizioFruizione(tipoProtocollo, idSoggettoFruitore, idServizio);
  14391.         }
  14392.         else {
  14393.             labelServizio = this.getLabelServizioErogazione(tipoProtocollo, idServizio);
  14394.         }
  14395.         return labelServizio;
  14396.     }
  14397.    
  14398.     public String getLabelServizio(IDSoggetto idSoggettoFruitore, boolean gestioneFruitori, AccordoServizioParteSpecifica asps, String tipoProtocollo) throws DriverControlStationException {
  14399.         String labelServizio = null;
  14400.         if(gestioneFruitori) {
  14401.             labelServizio = this.getLabelServizioFruizione(tipoProtocollo, idSoggettoFruitore, asps);
  14402.         }
  14403.         else {
  14404.             labelServizio = this.getLabelServizioErogazione(tipoProtocollo, asps);
  14405.         }
  14406.         return labelServizio;
  14407.     }
  14408.    
  14409.     // LABEL ACCORDI COOPERAZIONE
  14410.    
  14411.     public String getLabelIdAccordoCooperazione(AccordoCooperazione ac) throws DriverControlStationException{
  14412.         try {
  14413.             return NamingUtils.getLabelAccordoCooperazione(ac);
  14414.         }catch(Exception e) {
  14415.             throw new DriverControlStationException(e.getMessage(),e);
  14416.         }
  14417.     }
  14418.     public String getLabelIdAccordoCooperazione(IDAccordoCooperazione idAccordo) throws DriverControlStationException{
  14419.         try {
  14420.             return NamingUtils.getLabelAccordoCooperazione(idAccordo);
  14421.         }catch(Exception e) {
  14422.             throw new DriverControlStationException(e.getMessage(),e);
  14423.         }
  14424.     }
  14425.     public String getLabelIdAccordoCooperazione(String protocollo, IDAccordoCooperazione idAccordo) throws DriverControlStationException{
  14426.         try {
  14427.             return NamingUtils.getLabelAccordoCooperazione(protocollo, idAccordo);
  14428.         }catch(Exception e) {
  14429.             throw new DriverControlStationException(e.getMessage(),e);
  14430.         }
  14431.     }
  14432.    
  14433.    
  14434.    
  14435.     // Validazione contenuti
  14436.    
  14437.     public void validazioneContenuti(TipoOperazione tipoOperazione,List<DataElement> dati, boolean isPortaDelegata, String xsd, String tipoValidazione, String applicaMTOM,
  14438.             ServiceBinding serviceBinding, FormatoSpecifica formatoSpecifica) throws DriverControlStationException{
  14439.         validazioneContenuti(tipoOperazione, dati, true,isPortaDelegata,xsd,tipoValidazione,applicaMTOM, serviceBinding, formatoSpecifica);
  14440.     }
  14441.    
  14442.     public void validazioneContenuti(TipoOperazione tipoOperazione,List<DataElement> dati, boolean addSezione,boolean isPortaDelegata, String xsd, String tipoValidazione, String applicaMTOM,
  14443.             ServiceBinding serviceBinding, FormatoSpecifica formatoSpecifica) {
  14444.         DataElement de = new DataElement();
  14445.        
  14446.         if(addSezione) {
  14447.             de = new DataElement();
  14448.             de.setType(DataElementType.TITLE);
  14449.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_VALIDAZIONE_CONTENUTI);
  14450.             dati.add(de);
  14451.         }
  14452.        
  14453.         String[] tipoXsd = { CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_VALIDAZIONE_ABILITATO,
  14454.                 CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_VALIDAZIONE_DISABILITATO,
  14455.                 CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_VALIDAZIONE_WARNING_ONLY };
  14456.        
  14457.         de = new DataElement();
  14458.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_STATO);
  14459.         de.setType(DataElementType.SELECT);
  14460.         de.setName(CostantiControlStation.PARAMETRO_PORTE_XSD);
  14461.         de.setValues(tipoXsd);
  14462.         //      de.setOnChange("CambiaMode('" + tipoOp + "')");
  14463.         de.setPostBack(true);
  14464.         de.setSelected(xsd);
  14465.         dati.add(de);
  14466.        
  14467.         if (CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_VALIDAZIONE_ABILITATO.equals(xsd) ||
  14468.                 CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_VALIDAZIONE_WARNING_ONLY.equals(xsd)) {
  14469.            
  14470.             List<String> tipiValidazione = new ArrayList<>();
  14471.             tipiValidazione.add(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_TIPO_VALIDAZIONE_INTERFACE);
  14472.             tipiValidazione.add(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_TIPO_VALIDAZIONE_XSD);
  14473.             if(!this.isModalitaStandard()) {
  14474.                 tipiValidazione.add(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_TIPO_VALIDAZIONE_OPENSPCOOP);
  14475.             }
  14476.            
  14477.             List<String> labelTipiValidazione = new ArrayList<>();
  14478.             switch (formatoSpecifica) {
  14479.             case OPEN_API_3:
  14480.                 labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_OPEN_API_3);
  14481.                 break;
  14482.             case SWAGGER_2:
  14483.                 labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_SWAGGER_2);
  14484.                 break;
  14485.             case WADL:
  14486.                 labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WADL);
  14487.                 break;
  14488.             case WSDL_11:
  14489.                 labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_INTERFACE_TYPE_WSDL_11);
  14490.                 break;
  14491.             }
  14492.             labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_SCHEMI_XSD);
  14493.             if(!this.isModalitaStandard()) {
  14494.                 labelTipiValidazione.add(CostantiControlStation.LABEL_PARAMETRO_REGISTRO_OPENSPCOOP);
  14495.             }
  14496.            
  14497.             //String[] tipi_validazione = { "xsd", "wsdl" };
  14498.             de = new DataElement();
  14499.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_TIPO);
  14500.             de.setName(CostantiControlStation.PARAMETRO_PORTE_TIPO_VALIDAZIONE);
  14501.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_TIPO_VALIDAZIONE_OPENSPCOOP.equals(tipoValidazione) && this.isModalitaStandard()) {
  14502.                 de.setType(DataElementType.HIDDEN);
  14503.                 de.setValue(tipoValidazione);
  14504.             }
  14505.             else {
  14506.                 de.setType(DataElementType.SELECT);
  14507.                 de.setValues(tipiValidazione);
  14508.                 de.setLabels(labelTipiValidazione);
  14509.                 de.setSelected(tipoValidazione);
  14510.             }
  14511.             dati.add(de);
  14512.            
  14513.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PORTE_TIPO_VALIDAZIONE_OPENSPCOOP.equals(tipoValidazione) && this.isModalitaStandard()) {
  14514.                 de = new DataElement();
  14515.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_TIPO);
  14516.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_TIPO_VALIDAZIONE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  14517.                 de.setType(DataElementType.TEXT);
  14518.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_REGISTRO_OPENSPCOOP);
  14519.                 dati.add(de);
  14520.             }
  14521.            
  14522.            
  14523.             // Applica MTOM
  14524.             de = new DataElement();
  14525.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_ACCETTA_MTOM);
  14526.             if(ServiceBinding.SOAP.equals(serviceBinding)) {
  14527.                 de.setType(DataElementType.CHECKBOX);
  14528.                 if( ServletUtils.isCheckBoxEnabled(applicaMTOM) || CostantiRegistroServizi.ABILITATO.equals(applicaMTOM) ){
  14529.                     de.setSelected(true);
  14530.                 }
  14531.             }
  14532.             else{
  14533.                 de.setType(DataElementType.HIDDEN);
  14534.                 de.setValue(applicaMTOM);
  14535.             }        
  14536.             de.setName(CostantiControlStation.PARAMETRO_PORTE_APPLICA_MTOM);
  14537.             dati.add(de);
  14538.         }
  14539.     }
  14540.    
  14541.     public boolean validazioneContenutiCheck(TipoOperazione tipoOperazione,boolean isPortaDelegata) throws DriverControlStationException {
  14542.         String xsd = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_XSD);
  14543.        
  14544.         // Controllo che i campi "select" abbiano uno dei valori ammessi
  14545.         if (!xsd.equals(CostantiControlStation.DEFAULT_VALUE_ABILITATO) && !xsd.equals(CostantiControlStation.DEFAULT_VALUE_DISABILITATO) && !xsd.equals(CostantiControlStation.DEFAULT_VALUE_WARNING_ONLY)) {
  14546.             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_VALIDAZIONE_XSD_DEV_ESSERE_ABILITATO_DISABILITATO_O_WARNING_ONLY);
  14547.             return false;
  14548.         }
  14549.        
  14550.         return true;
  14551.     }
  14552.    
  14553.     public void addFilterAzione(Map<String,String> azioni, String azione, ServiceBinding serviceBinding) throws DriverControlStationException{
  14554.         String[] azioniDisponibiliList = new String [0];
  14555.         String[] azioniDisponibiliLabelList = new String [0];
  14556.         if(azioni!=null && azioni.size()>0) {
  14557.             azioniDisponibiliList = new String[azioni.size()];
  14558.             azioniDisponibiliLabelList = new String[azioni.size()];
  14559.             int i = 0;
  14560.             for (String string : azioni.keySet()) {
  14561.                 azioniDisponibiliList[i] = string;
  14562.                 azioniDisponibiliLabelList[i] = azioni.get(string);
  14563.                 if("Qualsiasi".equals(azioniDisponibiliLabelList[i])) {
  14564.                     azioniDisponibiliLabelList[i] = "Method e Path Qualsiasi";
  14565.                 }
  14566.                 i++;
  14567.             }
  14568.         }
  14569.        
  14570.         this.addFilterAzione(azioniDisponibiliList,azioniDisponibiliLabelList, azione, serviceBinding);      
  14571.     }
  14572.    
  14573.     public void addFilterAzione(String []azioni, String []azioniLabels, String azione, ServiceBinding serviceBinding) throws DriverControlStationException{
  14574.         try {
  14575.             String [] values = new String[azioni.length + 1];
  14576.             String [] labels = new String[azioni.length + 1];
  14577.             labels[0] = CostantiControlStation.LABEL_QUALSIASI;
  14578.             values[0] = CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA;
  14579.             for (int i =0; i < azioni.length ; i ++) {
  14580.                 labels[i+1] = azioniLabels[i];
  14581.                 values[i+1] = azioni[i];
  14582.             }
  14583.            
  14584.             String selectedValue = StringUtils.isNotEmpty(azione) ? azione : CostantiControlStation.DEFAULT_VALUE_AZIONE_RISORSA_NON_SELEZIONATA;
  14585.            
  14586.             this.pd.addFilter(Filtri.FILTRO_AZIONE,
  14587.                     this.getLabelAzione(serviceBinding),
  14588.                     selectedValue, values, labels, false, this.getSize());
  14589.            
  14590.         } catch (Exception e) {
  14591.             this.logError("Exception: " + e.getMessage(), e);
  14592.             throw new DriverControlStationException(e);
  14593.         }
  14594.     }
  14595.    
  14596.    
  14597.     public void addConfigurazioneDumpToDati(TipoOperazione tipoOperazione,List<DataElement> dati, boolean showStato, String statoDump, boolean showRealtime, String realtime, String statoDumpRichiesta, String statoDumpRisposta,
  14598.             String dumpRichiestaIngressoHeader, String dumpRichiestaIngressoPayload, String dumpRichiestaIngressoPayloadParsing, String dumpRichiestaIngressoBody, String dumpRichiestaIngressoAttachments,
  14599.             String dumpRichiestaUscitaHeader, String dumpRichiestaUscitaPayload, String dumpRichiestaUscitaPayloadParsing, String dumpRichiestaUscitaBody, String dumpRichiestaUscitaAttachments,
  14600.             String dumpRispostaIngressoHeader, String dumpRispostaIngressoPayload, String dumpRispostaIngressoPayloadParsing, String dumpRispostaIngressoBody , String dumpRispostaIngressoAttachments,
  14601.             String dumpRispostaUscitaHeader, String dumpRispostaUscitaPayload, String dumpRispostaUscitaPayloadParsing, String dumpRispostaUscitaBody, String dumpRispostaUscitaAttachments,
  14602.             boolean portaApplicativa) throws DriverControlStationException{
  14603.        
  14604.         // TipoPdD
  14605.         DataElement de = new DataElement();
  14606.         de.setName(CostantiControlStation.PARAMETRO_DUMP_TIPO_CONFIGURAZIONE);
  14607.         de.setType(DataElementType.HIDDEN);
  14608.         de.setValue(portaApplicativa ? TipoPdD.APPLICATIVA.getTipo() : TipoPdD.DELEGATA.getTipo());
  14609.         dati.add(de);
  14610.        
  14611.         if(showStato || showRealtime) {
  14612.             de = new DataElement();
  14613.             de.setType(DataElementType.TITLE);
  14614.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_GENERALE);
  14615.             dati.add(de);
  14616.         }
  14617.            
  14618.         String valuesProp [] = {StatoFunzionalita.ABILITATO.getValue(), StatoFunzionalita.DISABILITATO.getValue()};
  14619.         String labelsProp [] = {CostantiControlStation.DEFAULT_VALUE_ABILITATO, CostantiControlStation.DEFAULT_VALUE_DISABILITATO};
  14620.        
  14621.         // stato generale dump
  14622.         de = new DataElement();
  14623.         de.setName(CostantiControlStation.PARAMETRO_DUMP_STATO);
  14624.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO);
  14625.         if(showStato) {
  14626.             try {
  14627.                 de.setType(DataElementType.SELECT);
  14628.                 String valuesStato [] = {CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO};
  14629.                 String labelsStato [] = {this.getDumpLabelDefault(true, portaApplicativa), CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_RIDEFINITO};
  14630.                 de.setSelected(statoDump);
  14631.                 de.setLabels(labelsStato);
  14632.                 de.setValues(valuesStato);
  14633.                 de.setPostBack(true);
  14634.             }catch(Exception e) {
  14635.                 throw new DriverControlStationException(e.getMessage(),e);
  14636.             }
  14637.         } else {
  14638.             de.setType(DataElementType.HIDDEN);
  14639.             de.setValue(statoDump);
  14640.         }
  14641.         dati.add(de);
  14642.        
  14643.         if(!showStato || statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  14644.        
  14645.             // Realtime
  14646.             de = new DataElement();
  14647.             de.setName(CostantiControlStation.PARAMETRO_DUMP_REALTIME);
  14648.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_REALTIME);
  14649.             if(showRealtime) {
  14650.                 de.setType(DataElementType.SELECT);
  14651.                 de.setSelected(realtime);
  14652.                 de.setLabels(labelsProp);
  14653.                 de.setValues(valuesProp);
  14654.             } else {
  14655.                 de.setType(DataElementType.HIDDEN);
  14656.                 de.setValue(realtime);
  14657.             }
  14658.             dati.add(de);
  14659.            
  14660.             // Sezione Richiesta
  14661.             de = new DataElement();
  14662.             de.setType(DataElementType.TITLE);
  14663.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_RICHIESTA);
  14664.             dati.add(de);

  14665.             // Stato Dump Richiesta
  14666.             de = new DataElement();
  14667.             de.setName(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_STATO);
  14668.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_STATO);
  14669.             de.setType(DataElementType.SELECT);
  14670.             de.setSelected(statoDumpRichiesta);
  14671.             de.setLabels(labelsProp);
  14672.             de.setValues(valuesProp);
  14673.             de.setPostBack(true);
  14674.             dati.add(de);
  14675.            
  14676.             if(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  14677.                
  14678.                 try {
  14679.                    
  14680.                     // sotto sezione ingresso
  14681.                     addSottoSezioneDump(dati,
  14682.                             valuesProp, labelsProp,
  14683.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO,
  14684.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS,dumpRichiestaIngressoHeader,
  14685.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD, dumpRichiestaIngressoPayload,
  14686.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING, dumpRichiestaIngressoPayloadParsing,
  14687.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY, dumpRichiestaIngressoBody,
  14688.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS, dumpRichiestaIngressoAttachments
  14689.                             );
  14690.    
  14691.                                    
  14692.                     // sotto sezione uscita
  14693.                     addSottoSezioneDump(dati,
  14694.                             valuesProp, labelsProp,
  14695.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA,
  14696.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS,dumpRichiestaUscitaHeader,
  14697.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD, dumpRichiestaUscitaPayload,
  14698.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING, dumpRichiestaUscitaPayloadParsing,
  14699.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_BODY, dumpRichiestaUscitaBody,
  14700.                             CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS, dumpRichiestaUscitaAttachments
  14701.                             );
  14702.                    
  14703.                 }catch(Exception e) {
  14704.                     throw new DriverControlStationException(e.getMessage(),e);
  14705.                 }

  14706.             }
  14707.            
  14708.            
  14709.             // Sezione Risposta
  14710.             de = new DataElement();
  14711.             de.setType(DataElementType.TITLE);
  14712.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_RISPOSTA);
  14713.             dati.add(de);

  14714.             // Stato Dump Richiesta
  14715.             de = new DataElement();
  14716.             de.setName(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_STATO);
  14717.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_STATO);
  14718.             de.setType(DataElementType.SELECT);
  14719.             de.setSelected(statoDumpRisposta);
  14720.             de.setLabels(labelsProp);
  14721.             de.setValues(valuesProp);
  14722.             de.setPostBack(true);  
  14723.             dati.add(de);
  14724.            
  14725.             if(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  14726.                
  14727.                 try {
  14728.                
  14729.                     // sotto sezione ingresso
  14730.                     addSottoSezioneDump(dati,
  14731.                             valuesProp, labelsProp,
  14732.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO,
  14733.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS,dumpRispostaIngressoHeader,
  14734.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD, dumpRispostaIngressoPayload,
  14735.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING, dumpRispostaIngressoPayloadParsing,
  14736.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY, dumpRispostaIngressoBody,
  14737.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS, dumpRispostaIngressoAttachments
  14738.                             );
  14739.    
  14740.                                    
  14741.                     // sotto sezione uscita
  14742.                     addSottoSezioneDump(dati,
  14743.                             valuesProp, labelsProp,
  14744.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA,
  14745.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS,dumpRispostaUscitaHeader,
  14746.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD, dumpRispostaUscitaPayload,
  14747.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING, dumpRispostaUscitaPayloadParsing,
  14748.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_BODY, dumpRispostaUscitaBody,
  14749.                             CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS, dumpRispostaUscitaAttachments
  14750.                             );

  14751.                 }catch(Exception e) {
  14752.                     throw new DriverControlStationException(e.getMessage(),e);
  14753.                 }
  14754.             }
  14755.         }
  14756.     }
  14757.    
  14758.     private void addSottoSezioneDump(List<DataElement> dati, String valuesProp [], String labelsProp [],
  14759.             String labelSezione,
  14760.             String paramHeaders, String labelHeaders, String dumpHeader,
  14761.             String paramPayload, String labelPayload, String dumpPayload,
  14762.             String paramPayloadParsing, String labelPayloadParsing, String dumpPayloadParsing,
  14763.             String paramBody, String labelBody, String dumpBody,
  14764.             String paramAttachments, String labelAttachments, String dumpAttachments) throws UtilsException {
  14765.        
  14766.         DataElement de = new DataElement();
  14767.         de.setType(DataElementType.SUBTITLE);
  14768.         de.setLabel(labelSezione);
  14769.         dati.add(de);
  14770.        
  14771.         // header
  14772.         de = new DataElement();
  14773.         de.setName(paramHeaders);
  14774.         de.setLabel(labelHeaders);
  14775.         de.setType(DataElementType.SELECT);
  14776.         de.setSelected(dumpHeader);
  14777.         de.setLabels(labelsProp);
  14778.         de.setValues(valuesProp);
  14779.         dati.add(de);
  14780.        
  14781.         boolean multipartPayloadParsing = this.core.isRegistrazioneMessaggiMultipartPayloadParsingEnabled();
  14782.         if(!multipartPayloadParsing) {
  14783.             // regole configurate con modalita' attiva
  14784.             if(StatoFunzionalita.ABILITATO.getValue().equals(dumpPayload) &&
  14785.                     StatoFunzionalita.ABILITATO.getValue().equals(dumpPayloadParsing)) {
  14786.                 multipartPayloadParsing = true;
  14787.             }
  14788.         }
  14789.        
  14790.         // payload
  14791.         de = new DataElement();
  14792.         de.setName(paramPayload);
  14793.         de.setLabel(labelPayload);
  14794.         de.setType(DataElementType.SELECT);
  14795.         de.setSelected(dumpPayload);
  14796.         de.setLabels(labelsProp);
  14797.         de.setValues(valuesProp);
  14798.         if(multipartPayloadParsing) {
  14799.             de.setPostBack(true);
  14800.         }
  14801.         dati.add(de);
  14802.        
  14803.         // payload parsing ingresso
  14804.         de = new DataElement();
  14805.         de.setName(paramPayloadParsing);
  14806.         de.setLabel(labelPayloadParsing);
  14807.         de.setValue(dumpPayloadParsing);
  14808.         if(multipartPayloadParsing && dumpPayload!=null && dumpPayload.equals(StatoFunzionalita.ABILITATO.getValue())) {
  14809.             de.setType(DataElementType.SELECT);
  14810.             de.setSelected(dumpPayloadParsing);
  14811.             de.setLabels(labelsProp);
  14812.             de.setValues(valuesProp);
  14813.             de.setPostBack(true);
  14814.         }
  14815.         else {
  14816.             de.setType(DataElementType.HIDDEN);
  14817.             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  14818.         }
  14819.         dati.add(de);
  14820.        
  14821.         // body ingresso
  14822.         de = new DataElement();
  14823.         de.setName(paramBody);
  14824.         de.setLabel(labelBody);
  14825.         de.setValue(dumpBody);
  14826.         if(multipartPayloadParsing && dumpPayloadParsing!=null && dumpPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  14827.             de.setType(DataElementType.SELECT);
  14828.             de.setSelected(dumpBody);
  14829.             de.setLabels(labelsProp);
  14830.             de.setValues(valuesProp);
  14831.         }
  14832.         else {
  14833.             de.setType(DataElementType.HIDDEN);
  14834.             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  14835.         }
  14836.         dati.add(de);
  14837.        
  14838.         // attachments ingresso
  14839.         de = new DataElement();
  14840.         de.setName(paramAttachments);
  14841.         de.setLabel(labelAttachments);
  14842.         de.setValue(dumpAttachments);
  14843.         if(multipartPayloadParsing && dumpPayloadParsing!=null && dumpPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  14844.             de.setType(DataElementType.SELECT);
  14845.             de.setSelected(dumpAttachments);
  14846.             de.setLabels(labelsProp);
  14847.             de.setValues(valuesProp);
  14848.         }
  14849.         else {
  14850.             de.setType(DataElementType.HIDDEN);
  14851.             de.setValue(StatoFunzionalita.DISABILITATO.getValue());
  14852.         }
  14853.         dati.add(de);
  14854.     }
  14855.    
  14856.     protected String getGestioneCorsLabelDefault(boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  14857.        
  14858.         StringBuilder bf = new StringBuilder();
  14859.         if(usePrefixDefault) {
  14860.             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT);
  14861.             bf.append(" (");
  14862.         }
  14863.         CorsConfigurazione cc = this.confCore.getConfigurazioneGenerale().getGestioneCors();
  14864.         if(cc==null || cc.getStato()==null) {
  14865.             bf.append(StatoFunzionalita.DISABILITATO.getValue());
  14866.         }
  14867.         else {
  14868.             if(StatoFunzionalita.DISABILITATO.equals(cc.getStato())) {
  14869.                 bf.append(cc.getStato().getValue());
  14870.             }
  14871.             else {
  14872.                 bf.append(getLabelTipoGestioneCors(cc.getTipo()));
  14873.             }
  14874.         }
  14875.         if(usePrefixDefault) {
  14876.             bf.append(")");
  14877.         }
  14878.         return bf.toString();
  14879.     }
  14880.    
  14881.     protected String getLabelTipoGestioneCors(TipoGestioneCORS tipo) {
  14882.         if(tipo==null || "".equals(tipo.toString())) {
  14883.             return "undefined";
  14884.         }
  14885.         if(TipoGestioneCORS.GATEWAY.equals(tipo)) {
  14886.             return StatoFunzionalita.ABILITATO.getValue();
  14887.         }
  14888.         else {
  14889.             return StatoFunzionalita.ABILITATO.getValue()+" (applicativo)";
  14890.         }
  14891.     }
  14892.    
  14893.     protected String getResponseCachingLabelDefault(boolean usePrefixDefault) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  14894.        
  14895.         StringBuilder bf = new StringBuilder();
  14896.         if(usePrefixDefault) {
  14897.             bf.append(CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT);
  14898.             bf.append(" (");
  14899.         }
  14900.         ResponseCachingConfigurazioneGenerale rg = this.confCore.getConfigurazioneGenerale().getResponseCaching();
  14901.         if(rg==null || rg.getConfigurazione()==null || rg.getConfigurazione().getStato()==null) {
  14902.             bf.append(StatoFunzionalita.DISABILITATO.getValue());
  14903.         }
  14904.         else {
  14905.             bf.append(rg.getConfigurazione().getStato().getValue());
  14906.         }
  14907.         if(usePrefixDefault) {
  14908.             bf.append(")");
  14909.         }
  14910.         return bf.toString();
  14911.     }
  14912.    
  14913.     protected String getDumpLabelDefault(boolean usePrefixDefault, boolean portaApplicativa) throws DriverConfigurazioneNotFound, DriverConfigurazioneException {
  14914.         String labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT;
  14915.        
  14916.         Dump dConfig = this.confCore.getConfigurazioneGenerale().getDump();
  14917.         DumpConfigurazione dumpConfigurazione = null;
  14918.         if(dConfig!=null) {
  14919.             dumpConfigurazione = portaApplicativa ? dConfig.getConfigurazionePortaApplicativa() : dConfig.getConfigurazionePortaDelegata();
  14920.         }
  14921.        
  14922.         if(dConfig==null || dumpConfigurazione==null) {
  14923.             if(usePrefixDefault) {
  14924.                 labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT +" (disabilitato)";
  14925.             }
  14926.             else {
  14927.                 labelDefault = "disabilitato";
  14928.             }
  14929.         }
  14930.         else {
  14931.             boolean richiesta =
  14932.                     (
  14933.                         dumpConfigurazione.getRichiestaIngresso()!=null
  14934.                         &&
  14935.                         (
  14936.                                 StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getHeaders())
  14937.                                 ||
  14938.                                 (StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getPayload())
  14939.                                         &&
  14940.                                         (
  14941.                                         StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getBody())
  14942.                                         ||
  14943.                                         StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaIngresso().getAttachments())
  14944.                                         )
  14945.                                 )
  14946.                         )
  14947.                     )
  14948.                     ||
  14949.                     (
  14950.                         dumpConfigurazione.getRichiestaUscita()!=null
  14951.                         &&
  14952.                         (
  14953.                                 StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getHeaders())
  14954.                                 ||
  14955.                                 (StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getPayload())
  14956.                                         &&
  14957.                                         (
  14958.                                         StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getBody())
  14959.                                         ||
  14960.                                         StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRichiestaUscita().getAttachments())
  14961.                                         )
  14962.                                 )
  14963.                         )
  14964.                     )
  14965.                     ;
  14966.             boolean risposta =
  14967.                 (
  14968.                     dumpConfigurazione.getRispostaIngresso()!=null
  14969.                     &&
  14970.                     (
  14971.                             StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getHeaders())
  14972.                             ||
  14973.                             (StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getPayload())
  14974.                                     &&
  14975.                                     (
  14976.                                     StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getBody())
  14977.                                     ||
  14978.                                     StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaIngresso().getAttachments())
  14979.                                     )
  14980.                             )
  14981.                     )
  14982.                 )
  14983.                 ||
  14984.                 (
  14985.                     dumpConfigurazione.getRispostaUscita()!=null
  14986.                     &&
  14987.                     (
  14988.                             StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getHeaders())
  14989.                             ||
  14990.                             (StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getPayload())
  14991.                                     &&
  14992.                                     (
  14993.                                     StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getBody())
  14994.                                     ||
  14995.                                     StatoFunzionalita.ABILITATO.equals(dumpConfigurazione.getRispostaUscita().getAttachments())
  14996.                                     )
  14997.                             )
  14998.                     )
  14999.                 )
  15000.                 ;
  15001.             if(richiesta && risposta) {
  15002.                 if(usePrefixDefault) {
  15003.                     labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT +" (abilitato)";
  15004.                 }
  15005.                 else {
  15006.                     labelDefault = "abilitato";
  15007.                 }
  15008.             }
  15009.             else if(richiesta) {
  15010.                 if(usePrefixDefault) {
  15011.                     labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT +" (abilitato richiesta)";
  15012.                 }
  15013.                 else {
  15014.                     labelDefault = "abilitato richiesta";
  15015.                 }
  15016.             }
  15017.             else if(risposta) {
  15018.                 if(usePrefixDefault) {
  15019.                     labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT +" (abilitato risposta)";
  15020.                 }
  15021.                 else {
  15022.                     labelDefault = "abilitato risposta";
  15023.                 }
  15024.             }
  15025.             else {
  15026.                 if(usePrefixDefault) {
  15027.                     labelDefault = CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT +" (disabilitato)";
  15028.                 }
  15029.                 else {
  15030.                     labelDefault = "disabilitato";
  15031.                 }
  15032.             }
  15033.            
  15034.         }
  15035.         return labelDefault;
  15036.     }
  15037.    
  15038.     public void addConfigurazioneDumpToDatiAsHidden(TipoOperazione tipoOperazione,List<DataElement> dati, boolean showStato, String statoDump, boolean showRealtime, String realtime, String statoDumpRichiesta, String statoDumpRisposta,
  15039.             String dumpRichiestaIngressoHeader, String dumpRichiestaIngressoPayload, String dumpRichiestaIngressoPayloadParsing, String dumpRichiestaIngressoBody, String dumpRichiestaIngressoAttachments,
  15040.             String dumpRichiestaUscitaHeader, String dumpRichiestaUscitaPayload, String dumpRichiestaUscitaPayloadParsing, String dumpRichiestaUscitaBody, String dumpRichiestaUscitaAttachments,
  15041.             String dumpRispostaIngressoHeader, String dumpRispostaIngressoPayload, String dumpRispostaIngressoPayloadParsing, String dumpRispostaIngressoBody , String dumpRispostaIngressoAttachments,
  15042.             String dumpRispostaUscitaHeader, String dumpRispostaUscitaPayload, String dumpRispostaUscitaPayloadParsing, String dumpRispostaUscitaBody, String dumpRispostaUscitaAttachments,
  15043.             boolean portaApplicativa) throws DriverControlStationException{
  15044.        
  15045.         // stato generale dump
  15046.         DataElement de = new DataElement();
  15047.         de.setName(CostantiControlStation.PARAMETRO_DUMP_STATO);
  15048.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO);
  15049.         de.setType(DataElementType.HIDDEN);
  15050.         de.setValue(statoDump);
  15051.         dati.add(de);
  15052.        
  15053.         // TipoPdD
  15054.         de = new DataElement();
  15055.         de.setName(CostantiControlStation.PARAMETRO_DUMP_TIPO_CONFIGURAZIONE);
  15056.         de.setType(DataElementType.HIDDEN);
  15057.         de.setValue(portaApplicativa ? TipoPdD.APPLICATIVA.getTipo() : TipoPdD.DELEGATA.getTipo());
  15058.         dati.add(de);
  15059.        
  15060.         if(!showStato || statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  15061.        
  15062.             // Realtime
  15063.             de = new DataElement();
  15064.             de.setName(CostantiControlStation.PARAMETRO_DUMP_REALTIME);
  15065.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_REALTIME);
  15066.             de.setType(DataElementType.HIDDEN);
  15067.             de.setValue(realtime);
  15068.             dati.add(de);
  15069.            
  15070.             // Stato Dump Richiesta
  15071.             de = new DataElement();
  15072.             de.setName(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_STATO);
  15073.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_STATO);
  15074.             de.setType(DataElementType.HIDDEN);
  15075.             de.setValue(statoDumpRichiesta);
  15076.             dati.add(de);
  15077.            
  15078.             if(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15079.                
  15080.                 // sotto sezione ingresso
  15081.                 addSottoSezioneDumpHidden(dati,
  15082.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS,dumpRichiestaIngressoHeader,
  15083.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD, dumpRichiestaIngressoPayload,
  15084.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING, dumpRichiestaIngressoPayloadParsing,
  15085.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY, dumpRichiestaIngressoBody,
  15086.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS, dumpRichiestaIngressoAttachments
  15087.                         );

  15088.                                
  15089.                 // sotto sezione uscita
  15090.                 addSottoSezioneDumpHidden(dati,
  15091.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS,dumpRichiestaUscitaHeader,
  15092.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD, dumpRichiestaUscitaPayload,
  15093.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING, dumpRichiestaUscitaPayloadParsing,
  15094.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_BODY, dumpRichiestaUscitaBody,
  15095.                         CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS, dumpRichiestaUscitaAttachments
  15096.                         );
  15097.                
  15098.             }
  15099.            

  15100.             // Stato Dump Richiesta
  15101.             de = new DataElement();
  15102.             de.setName(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_STATO);
  15103.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_STATO);
  15104.             de.setType(DataElementType.HIDDEN);
  15105.             de.setValue(statoDumpRisposta);
  15106.             dati.add(de);
  15107.            
  15108.             if(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15109.                
  15110.                 // sotto sezione ingresso
  15111.                 addSottoSezioneDumpHidden(dati,
  15112.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS,dumpRispostaIngressoHeader,
  15113.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD, dumpRispostaIngressoPayload,
  15114.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING, dumpRispostaIngressoPayloadParsing,
  15115.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY, dumpRispostaIngressoBody,
  15116.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS, dumpRispostaIngressoAttachments
  15117.                         );

  15118.                                
  15119.                 // sotto sezione uscita
  15120.                 addSottoSezioneDumpHidden(dati,
  15121.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS,dumpRispostaUscitaHeader,
  15122.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD, dumpRispostaUscitaPayload,
  15123.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING, dumpRispostaUscitaPayloadParsing,
  15124.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_BODY, dumpRispostaUscitaBody,
  15125.                         CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS, dumpRispostaUscitaAttachments
  15126.                         );

  15127.             }
  15128.         }
  15129.     }
  15130.    
  15131.     private void addSottoSezioneDumpHidden(List<DataElement> dati,
  15132.             String paramHeaders, String labelHeaders, String dumpHeader,
  15133.             String paramPayload, String labelPayload, String dumpPayload,
  15134.             String paramPayloadParsing, String labelPayloadParsing, String dumpPayloadParsing,
  15135.             String paramBody, String labelBody, String dumpBody,
  15136.             String paramAttachments, String labelAttachments, String dumpAttachments) {
  15137.        
  15138.         // header
  15139.         DataElement de = new DataElement();
  15140.         de.setName(paramHeaders);
  15141.         de.setLabel(labelHeaders);
  15142.         de.setType(DataElementType.HIDDEN);
  15143.         de.setValue(dumpHeader);
  15144.         dati.add(de);
  15145.        
  15146.         // payload
  15147.         de = new DataElement();
  15148.         de.setName(paramPayload);
  15149.         de.setLabel(labelPayload);
  15150.         de.setType(DataElementType.HIDDEN);
  15151.         de.setValue(dumpPayload);
  15152.         dati.add(de);
  15153.        
  15154.         // payload parsing
  15155.         de = new DataElement();
  15156.         de.setName(paramPayloadParsing);
  15157.         de.setLabel(labelPayloadParsing);
  15158.         de.setType(DataElementType.HIDDEN);
  15159.         de.setValue(dumpPayloadParsing);
  15160.         dati.add(de);
  15161.        
  15162.         // body
  15163.         de = new DataElement();
  15164.         de.setName(paramBody);
  15165.         de.setLabel(labelBody);
  15166.         de.setType(DataElementType.HIDDEN);
  15167.         de.setValue(dumpBody);
  15168.         dati.add(de);
  15169.        
  15170.         // attachments
  15171.         de = new DataElement();
  15172.         de.setName(paramAttachments);
  15173.         de.setLabel(labelAttachments);
  15174.         de.setType(DataElementType.HIDDEN);
  15175.         de.setValue(dumpAttachments);
  15176.         dati.add(de);
  15177.     }
  15178.    
  15179.     public boolean checkDataConfigurazioneDump(TipoOperazione tipoOperazione,boolean showStato, String statoDump, boolean showRealtime, String realtime, String statoDumpRichiesta, String statoDumpRisposta,
  15180.             String dumpRichiestaIngressoHeader, String dumpRichiestaIngressoPayload, String dumpRichiestaIngressoPayloadParsing, String dumpRichiestaIngressoBody, String dumpRichiestaIngressoAttachments,
  15181.             String dumpRichiestaUscitaHeader, String dumpRichiestaUscitaPayload, String dumpRichiestaUscitaPayloadParsing, String dumpRichiestaUscitaBody, String dumpRichiestaUscitaAttachments,
  15182.             String dumpRispostaIngressoHeader, String dumpRispostaIngressoPayload, String dumpRispostaIngressoPayloadParsing, String dumpRispostaIngressoBody , String dumpRispostaIngressoAttachments,
  15183.             String dumpRispostaUscitaHeader, String dumpRispostaUscitaPayload, String dumpRispostaUscitaPayloadParsing, String dumpRispostaUscitaBody, String dumpRispostaUscitaAttachments) throws DriverControlStationException{
  15184.        
  15185.         if(showStato) {
  15186.             if(StringUtils.isEmpty(statoDump) || !(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT) || statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO))) {
  15187.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO, CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO));
  15188.                 return false;
  15189.             }
  15190.         }
  15191.        
  15192.         if(!showStato || statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  15193.             // realtime
  15194.             if(StringUtils.isEmpty(realtime) || !(realtime.equals(StatoFunzionalita.ABILITATO.getValue()) || realtime.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15195.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO, CostantiControlStation.LABEL_PARAMETRO_DUMP_REALTIME));
  15196.                 return false;
  15197.             }
  15198.            
  15199.             // statoDumpRichiesta
  15200.             if(StringUtils.isEmpty(statoDumpRichiesta) || !(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue()) || statoDumpRichiesta.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15201.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_DELLA_YY_NON_VALIDO,
  15202.                         CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15203.                 return false;
  15204.             }
  15205.            
  15206.             if(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())){
  15207.                
  15208.                 // dumpRichiestaIngressoHeader
  15209.                 if(StringUtils.isEmpty(dumpRichiestaIngressoHeader) || !(dumpRichiestaIngressoHeader.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaIngressoHeader.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15210.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15211.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15212.                     return false;
  15213.                 }
  15214.                 // dumpRichiestaIngressoPayload
  15215.                 if(StringUtils.isEmpty(dumpRichiestaIngressoPayload) || !(dumpRichiestaIngressoPayload.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaIngressoPayload.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15216.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15217.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15218.                     return false;
  15219.                 }
  15220.                 // dumpRichiestaIngressoPayloadParsing
  15221.                 if(StringUtils.isEmpty(dumpRichiestaIngressoPayloadParsing) || !(dumpRichiestaIngressoPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaIngressoPayloadParsing.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15222.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15223.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15224.                     return false;
  15225.                 }
  15226.                 // dumpRichiestaIngressoBody
  15227.                 if(StringUtils.isEmpty(dumpRichiestaIngressoBody) || !(dumpRichiestaIngressoBody.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaIngressoBody.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15228.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15229.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15230.                     return false;
  15231.                 }
  15232.                 // dumpRichiestaIngressoAttachments
  15233.                 if(StringUtils.isEmpty(dumpRichiestaIngressoAttachments) || !(dumpRichiestaIngressoAttachments.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaIngressoAttachments.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15234.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15235.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15236.                     return false;
  15237.                 }
  15238.                                
  15239.                
  15240.                 // dumpRichiestaUscitaHeader
  15241.                 if(StringUtils.isEmpty(dumpRichiestaUscitaHeader) || !(dumpRichiestaUscitaHeader.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaUscitaHeader.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15242.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15243.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15244.                     return false;
  15245.                 }
  15246.                 // dumpRichiestaUscitaPayload
  15247.                 if(StringUtils.isEmpty(dumpRichiestaUscitaPayload) || !(dumpRichiestaUscitaPayload.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaUscitaPayload.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15248.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15249.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15250.                     return false;
  15251.                 }  
  15252.                 // dumpRichiestaUscitaPayloadParsing
  15253.                 if(StringUtils.isEmpty(dumpRichiestaUscitaPayloadParsing) || !(dumpRichiestaUscitaPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaUscitaPayloadParsing.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15254.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15255.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15256.                     return false;
  15257.                 }  
  15258.                 // dumpRichiestaUscitaBody
  15259.                 if(StringUtils.isEmpty(dumpRichiestaUscitaBody) || !(dumpRichiestaUscitaBody.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaUscitaBody.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15260.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15261.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15262.                     return false;
  15263.                 }              
  15264.                 // dumpRichiestaUscitaAttachments
  15265.                 if(StringUtils.isEmpty(dumpRichiestaUscitaAttachments) || !(dumpRichiestaUscitaAttachments.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRichiestaUscitaAttachments.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15266.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15267.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15268.                     return false;
  15269.                 }
  15270.                
  15271.                
  15272.                 // se e' abilitato il dump per la richiesta almeno una singola voce deve essere abilitata
  15273.                 if(dumpRichiestaIngressoHeader.equals(StatoFunzionalita.DISABILITATO.getValue()) && dumpRichiestaIngressoPayload.equals(StatoFunzionalita.DISABILITATO.getValue())
  15274.                     && dumpRichiestaUscitaHeader.equals(StatoFunzionalita.DISABILITATO.getValue()) && dumpRichiestaUscitaPayload.equals(StatoFunzionalita.DISABILITATO.getValue())
  15275.                     ) {
  15276.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE, CostantiControlStation.LABEL_PARAMETRO_RICHIESTA));
  15277.                     return false;
  15278.                 }
  15279.                 if(dumpRichiestaIngressoPayload.equals(StatoFunzionalita.ABILITATO.getValue()) && dumpRichiestaIngressoPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15280.                     if(dumpRichiestaIngressoBody.equals(StatoFunzionalita.DISABILITATO.getValue())
  15281.                             && dumpRichiestaIngressoAttachments.equals(StatoFunzionalita.DISABILITATO.getValue())
  15282.                     ) {
  15283.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE_PAYLOAD_PARSING,
  15284.                                 CostantiControlStation.LABEL_PARAMETRO_RICHIESTA+" "+CostantiControlStation.LABEL_PARAMETRO_INGRESSO));
  15285.                         return false;
  15286.                     }
  15287.                 }
  15288.                 if(dumpRichiestaUscitaPayload.equals(StatoFunzionalita.ABILITATO.getValue()) && dumpRichiestaUscitaPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15289.                     if(dumpRichiestaUscitaBody.equals(StatoFunzionalita.DISABILITATO.getValue())
  15290.                             && dumpRichiestaUscitaAttachments.equals(StatoFunzionalita.DISABILITATO.getValue())
  15291.                     ) {
  15292.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE_PAYLOAD_PARSING,
  15293.                                 CostantiControlStation.LABEL_PARAMETRO_RICHIESTA+" "+CostantiControlStation.LABEL_PARAMETRO_USCITA));
  15294.                         return false;
  15295.                     }
  15296.                 }
  15297.             }
  15298.            
  15299.             // statoDumpRisposta
  15300.             if(StringUtils.isEmpty(statoDumpRisposta) || !(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue()) || statoDumpRisposta.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15301.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_DELLA_YY_NON_VALIDO,
  15302.                         CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15303.                 return false;
  15304.             }
  15305.            
  15306.             if(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15307.                
  15308.                 // dumpRispostaIngressoHeader
  15309.                 if(StringUtils.isEmpty(dumpRispostaIngressoHeader) || !(dumpRispostaIngressoHeader.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaIngressoHeader.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15310.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15311.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15312.                     return false;
  15313.                 }
  15314.                 // dumpRispostaIngressoPayload
  15315.                 if(StringUtils.isEmpty(dumpRispostaIngressoPayload) || !(dumpRispostaIngressoPayload.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaIngressoPayload.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15316.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15317.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15318.                     return false;
  15319.                 }
  15320.                 // dumpRispostaIngressoPayloadParsing
  15321.                 if(StringUtils.isEmpty(dumpRispostaIngressoPayloadParsing) || !(dumpRispostaIngressoPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaIngressoPayloadParsing.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15322.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15323.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15324.                     return false;
  15325.                 }
  15326.                 // dumpRispostaIngressoBody
  15327.                 if(StringUtils.isEmpty(dumpRispostaIngressoBody) || !(dumpRispostaIngressoBody.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaIngressoBody.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15328.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15329.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15330.                     return false;
  15331.                 }
  15332.                 // dumpRispostaIngressoAttachments
  15333.                 if(StringUtils.isEmpty(dumpRispostaIngressoAttachments) || !(dumpRispostaIngressoAttachments.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaIngressoAttachments.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15334.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15335.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_INGRESSO, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15336.                     return false;
  15337.                 }
  15338.                                
  15339.                
  15340.                 // dumpRispostaUscitaHeader
  15341.                 if(StringUtils.isEmpty(dumpRispostaUscitaHeader) || !(dumpRispostaUscitaHeader.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaUscitaHeader.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15342.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15343.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15344.                     return false;
  15345.                 }
  15346.                 // dumpRispostaUscitaPayload
  15347.                 if(StringUtils.isEmpty(dumpRispostaUscitaPayload) || !(dumpRispostaUscitaPayload.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaUscitaPayload.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15348.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15349.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15350.                     return false;
  15351.                 }  
  15352.                 // dumpRispostaUscitaPayloadParsing
  15353.                 if(StringUtils.isEmpty(dumpRispostaUscitaPayloadParsing) || !(dumpRispostaUscitaPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaUscitaPayloadParsing.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15354.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15355.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15356.                     return false;
  15357.                 }  
  15358.                 // dumpRispostaUscitaBody
  15359.                 if(StringUtils.isEmpty(dumpRispostaUscitaBody) || !(dumpRispostaUscitaBody.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaUscitaBody.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15360.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15361.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_BODY, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15362.                     return false;
  15363.                 }              
  15364.                 // dumpRispostaUscitaAttachments
  15365.                 if(StringUtils.isEmpty(dumpRispostaUscitaAttachments) || !(dumpRispostaUscitaAttachments.equals(StatoFunzionalita.ABILITATO.getValue()) || dumpRispostaUscitaAttachments.equals(StatoFunzionalita.DISABILITATO.getValue()))) {
  15366.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_YY_DELLA_ZZ_NON_VALIDO,
  15367.                             CostantiControlStation.LABEL_PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS, CostantiControlStation.LABEL_PARAMETRO_DUMP_SEZIONE_USCITA, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15368.                     return false;
  15369.                 }
  15370.                
  15371.                
  15372.                 // se e' abilitato il dump per la richiesta almeno una singola voce deve essere abilitata
  15373.                 if(dumpRispostaIngressoHeader.equals(StatoFunzionalita.DISABILITATO.getValue()) && dumpRispostaIngressoPayload.equals(StatoFunzionalita.DISABILITATO.getValue())
  15374.                     && dumpRispostaUscitaHeader.equals(StatoFunzionalita.DISABILITATO.getValue()) && dumpRispostaUscitaPayload.equals(StatoFunzionalita.DISABILITATO.getValue())
  15375.                     ) {
  15376.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE, CostantiControlStation.LABEL_PARAMETRO_RISPOSTA));
  15377.                     return false;
  15378.                 }
  15379.                 if(dumpRispostaIngressoPayload.equals(StatoFunzionalita.ABILITATO.getValue()) && dumpRispostaIngressoPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15380.                     if(dumpRispostaIngressoBody.equals(StatoFunzionalita.DISABILITATO.getValue())
  15381.                             && dumpRispostaIngressoAttachments.equals(StatoFunzionalita.DISABILITATO.getValue())
  15382.                     ) {
  15383.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE_PAYLOAD_PARSING,
  15384.                                 CostantiControlStation.LABEL_PARAMETRO_RISPOSTA+" "+CostantiControlStation.LABEL_PARAMETRO_INGRESSO));
  15385.                         return false;
  15386.                     }
  15387.                 }
  15388.                 if(dumpRispostaUscitaPayload.equals(StatoFunzionalita.ABILITATO.getValue()) && dumpRispostaUscitaPayloadParsing.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15389.                     if(dumpRispostaUscitaBody.equals(StatoFunzionalita.DISABILITATO.getValue())
  15390.                             && dumpRispostaUscitaAttachments.equals(StatoFunzionalita.DISABILITATO.getValue())
  15391.                     ) {
  15392.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE_PAYLOAD_PARSING,
  15393.                                 CostantiControlStation.LABEL_PARAMETRO_RISPOSTA+" "+CostantiControlStation.LABEL_PARAMETRO_USCITA));
  15394.                         return false;
  15395.                     }
  15396.                 }
  15397.             }
  15398.            
  15399.             /*
  15400.              * Vorrei poterla ridefinire disabilitata
  15401.             if (!statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())  && !statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15402.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMP_DATI_INCOMPLETI_E_NECESSARIO_ABILITARE_UNA_VOCE_TRA_RICHIESTA_E_RISPOSTA);
  15403.                 return false;
  15404.             }
  15405.             */
  15406.         }
  15407.        
  15408.        
  15409.         return true;
  15410.     }
  15411.    
  15412.     public DumpConfigurazione getConfigurazioneDump(TipoOperazione tipoOperazione,boolean showStato, String statoDump, boolean showRealtime, String realtime, String statoDumpRichiesta, String statoDumpRisposta,
  15413.             String dumpRichiestaIngressoHeader, String dumpRichiestaIngressoPayload, String dumpRichiestaIngressoPayloadParsing, String dumpRichiestaIngressoBody, String dumpRichiestaIngressoAttachments,
  15414.             String dumpRichiestaUscitaHeader, String dumpRichiestaUscitaPayload, String dumpRichiestaUscitaPayloadParsing, String dumpRichiestaUscitaBody, String dumpRichiestaUscitaAttachments,
  15415.             String dumpRispostaIngressoHeader, String dumpRispostaIngressoPayload, String dumpRispostaIngressoPayloadParsing, String dumpRispostaIngressoBody , String dumpRispostaIngressoAttachments,
  15416.             String dumpRispostaUscitaHeader, String dumpRispostaUscitaPayload, String dumpRispostaUscitaPayloadParsing, String dumpRispostaUscitaBody, String dumpRispostaUscitaAttachments) throws DriverControlStationException{
  15417.        
  15418.         DumpConfigurazione newConfigurazione = null;
  15419.        
  15420.         if(showStato) {
  15421.             // impostazioni dump di default impostate nelle PD/PA
  15422.             if(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT))
  15423.                 return newConfigurazione;
  15424.         }
  15425.        
  15426.         if(!showStato || statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  15427.            
  15428.             newConfigurazione = new DumpConfigurazione();
  15429.             newConfigurazione.setRichiestaIngresso(new DumpConfigurazioneRegola());
  15430.             newConfigurazione.setRichiestaUscita(new DumpConfigurazioneRegola());
  15431.             newConfigurazione.setRispostaIngresso(new DumpConfigurazioneRegola());
  15432.             newConfigurazione.setRispostaUscita(new DumpConfigurazioneRegola());
  15433.            
  15434.             // realtime        
  15435.             newConfigurazione.setRealtimeRawEnumValue(realtime);

  15436.             if(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15437.                 newConfigurazione.getRichiestaIngresso().setHeadersRawEnumValue(dumpRichiestaIngressoHeader);
  15438.                 newConfigurazione.getRichiestaIngresso().setPayloadRawEnumValue(dumpRichiestaIngressoPayload);
  15439.                 if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRichiestaIngresso().getPayload())){
  15440.                     newConfigurazione.getRichiestaIngresso().setPayloadParsingRawEnumValue(dumpRichiestaIngressoPayloadParsing);
  15441.                     if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRichiestaIngresso().getPayloadParsing())){
  15442.                         newConfigurazione.getRichiestaIngresso().setBodyRawEnumValue(dumpRichiestaIngressoBody);
  15443.                         newConfigurazione.getRichiestaIngresso().setAttachmentsRawEnumValue(dumpRichiestaIngressoAttachments);
  15444.                     }
  15445.                     else {
  15446.                         newConfigurazione.getRichiestaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15447.                         newConfigurazione.getRichiestaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15448.                     }
  15449.                 }
  15450.                 else {
  15451.                     newConfigurazione.getRichiestaIngresso().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15452.                     newConfigurazione.getRichiestaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15453.                     newConfigurazione.getRichiestaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15454.                 }
  15455.                
  15456.                 newConfigurazione.getRichiestaUscita().setHeadersRawEnumValue(dumpRichiestaUscitaHeader);
  15457.                 newConfigurazione.getRichiestaUscita().setPayloadRawEnumValue(dumpRichiestaUscitaPayload);
  15458.                 if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRichiestaUscita().getPayload())){
  15459.                     newConfigurazione.getRichiestaUscita().setPayloadParsingRawEnumValue(dumpRichiestaUscitaPayloadParsing);
  15460.                     if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRichiestaUscita().getPayloadParsing())){
  15461.                         newConfigurazione.getRichiestaUscita().setBodyRawEnumValue(dumpRichiestaUscitaBody);
  15462.                         newConfigurazione.getRichiestaUscita().setAttachmentsRawEnumValue(dumpRichiestaUscitaAttachments);
  15463.                     }
  15464.                     else {
  15465.                         newConfigurazione.getRichiestaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15466.                         newConfigurazione.getRichiestaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15467.                     }
  15468.                 }
  15469.                 else {
  15470.                     newConfigurazione.getRichiestaUscita().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15471.                     newConfigurazione.getRichiestaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15472.                     newConfigurazione.getRichiestaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15473.                 }
  15474.             } else {
  15475.                 newConfigurazione.getRichiestaIngresso().setHeaders(StatoFunzionalita.DISABILITATO);
  15476.                 newConfigurazione.getRichiestaIngresso().setPayload(StatoFunzionalita.DISABILITATO);
  15477.                 newConfigurazione.getRichiestaIngresso().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15478.                 newConfigurazione.getRichiestaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15479.                 newConfigurazione.getRichiestaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15480.                 newConfigurazione.getRichiestaUscita().setHeaders(StatoFunzionalita.DISABILITATO);
  15481.                 newConfigurazione.getRichiestaUscita().setPayload(StatoFunzionalita.DISABILITATO);
  15482.                 newConfigurazione.getRichiestaUscita().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15483.                 newConfigurazione.getRichiestaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15484.                 newConfigurazione.getRichiestaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15485.             }
  15486.            
  15487.             if(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  15488.                 newConfigurazione.getRispostaIngresso().setHeadersRawEnumValue(dumpRispostaIngressoHeader);
  15489.                 newConfigurazione.getRispostaIngresso().setPayloadRawEnumValue(dumpRispostaIngressoPayload);
  15490.                 if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRispostaIngresso().getPayload())){
  15491.                     newConfigurazione.getRispostaIngresso().setPayloadParsingRawEnumValue(dumpRispostaIngressoPayloadParsing);
  15492.                     if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRispostaIngresso().getPayloadParsing())){
  15493.                         newConfigurazione.getRispostaIngresso().setBodyRawEnumValue(dumpRispostaIngressoBody);
  15494.                         newConfigurazione.getRispostaIngresso().setAttachmentsRawEnumValue(dumpRispostaIngressoAttachments);
  15495.                     }
  15496.                     else {
  15497.                         newConfigurazione.getRispostaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15498.                         newConfigurazione.getRispostaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15499.                     }
  15500.                 }
  15501.                 else {
  15502.                     newConfigurazione.getRispostaIngresso().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15503.                     newConfigurazione.getRispostaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15504.                     newConfigurazione.getRispostaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15505.                 }
  15506.                
  15507.                 newConfigurazione.getRispostaUscita().setHeadersRawEnumValue(dumpRispostaUscitaHeader);
  15508.                 newConfigurazione.getRispostaUscita().setPayloadRawEnumValue(dumpRispostaUscitaPayload);
  15509.                 if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRispostaUscita().getPayload())){
  15510.                     newConfigurazione.getRispostaUscita().setPayloadParsingRawEnumValue(dumpRispostaUscitaPayloadParsing);
  15511.                     if(StatoFunzionalita.ABILITATO.equals(newConfigurazione.getRispostaUscita().getPayloadParsing())){
  15512.                         newConfigurazione.getRispostaUscita().setBodyRawEnumValue(dumpRispostaUscitaBody);
  15513.                         newConfigurazione.getRispostaUscita().setAttachmentsRawEnumValue(dumpRispostaUscitaAttachments);
  15514.                     }
  15515.                     else {
  15516.                         newConfigurazione.getRispostaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15517.                         newConfigurazione.getRispostaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15518.                     }
  15519.                 }
  15520.                 else {
  15521.                     newConfigurazione.getRispostaUscita().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15522.                     newConfigurazione.getRispostaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15523.                     newConfigurazione.getRispostaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15524.                 }
  15525.             } else {
  15526.                 newConfigurazione.getRispostaIngresso().setHeaders(StatoFunzionalita.DISABILITATO);
  15527.                 newConfigurazione.getRispostaIngresso().setPayload(StatoFunzionalita.DISABILITATO);
  15528.                 newConfigurazione.getRispostaIngresso().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15529.                 newConfigurazione.getRispostaIngresso().setBody(StatoFunzionalita.DISABILITATO);
  15530.                 newConfigurazione.getRispostaIngresso().setAttachments(StatoFunzionalita.DISABILITATO);
  15531.                 newConfigurazione.getRispostaUscita().setHeaders(StatoFunzionalita.DISABILITATO);
  15532.                 newConfigurazione.getRispostaUscita().setBody(StatoFunzionalita.DISABILITATO);
  15533.                 newConfigurazione.getRispostaUscita().setPayload(StatoFunzionalita.DISABILITATO);
  15534.                 newConfigurazione.getRispostaUscita().setPayloadParsing(StatoFunzionalita.DISABILITATO);
  15535.                 newConfigurazione.getRispostaUscita().setAttachments(StatoFunzionalita.DISABILITATO);
  15536.             }
  15537.         }
  15538.        
  15539.         return newConfigurazione;
  15540.     }
  15541.    
  15542.     public boolean isDumpConfigurazioneAbilitato(DumpConfigurazione configurazione, boolean isRisposta) {
  15543.         boolean abilitato = false;
  15544.        
  15545.         if(configurazione == null)
  15546.             return false;
  15547.        
  15548.         if(isRisposta) {
  15549.             DumpConfigurazioneRegola rispostaIngresso = configurazione.getRispostaIngresso();
  15550.            
  15551.             if(rispostaIngresso != null) {
  15552.                 if(rispostaIngresso.getHeaders().equals(StatoFunzionalita.ABILITATO))
  15553.                     return true;
  15554.                
  15555.                 if(rispostaIngresso.getPayload().equals(StatoFunzionalita.ABILITATO)) {
  15556.                     if(rispostaIngresso.getPayloadParsing().equals(StatoFunzionalita.ABILITATO)) {
  15557.                         if(rispostaIngresso.getBody().equals(StatoFunzionalita.ABILITATO))
  15558.                             return true;
  15559.                        
  15560.                         if(rispostaIngresso.getAttachments().equals(StatoFunzionalita.ABILITATO))
  15561.                             return true;        
  15562.                     }
  15563.                     else {
  15564.                         return true;
  15565.                     }
  15566.                 }
  15567.                
  15568.             }
  15569.            
  15570.             DumpConfigurazioneRegola rispostaUscita = configurazione.getRispostaUscita();
  15571.            
  15572.             if(rispostaUscita != null) {
  15573.                 if(rispostaUscita.getHeaders().equals(StatoFunzionalita.ABILITATO))
  15574.                     return true;
  15575.                
  15576.                 if(rispostaUscita.getPayload().equals(StatoFunzionalita.ABILITATO)) {
  15577.                     if(rispostaUscita.getPayloadParsing().equals(StatoFunzionalita.ABILITATO)) {
  15578.                         if(rispostaUscita.getBody().equals(StatoFunzionalita.ABILITATO))
  15579.                             return true;
  15580.                        
  15581.                         if(rispostaUscita.getAttachments().equals(StatoFunzionalita.ABILITATO))
  15582.                             return true;        
  15583.                     }
  15584.                     else {
  15585.                         return true;
  15586.                     }
  15587.                 }
  15588.             }
  15589.         } else {
  15590.             DumpConfigurazioneRegola richiestaIngresso = configurazione.getRichiestaIngresso();
  15591.            
  15592.             if(richiestaIngresso != null) {
  15593.                 if(richiestaIngresso.getHeaders().equals(StatoFunzionalita.ABILITATO))
  15594.                     return true;
  15595.                
  15596.                 if(richiestaIngresso.getPayload().equals(StatoFunzionalita.ABILITATO)) {
  15597.                     if(richiestaIngresso.getPayloadParsing().equals(StatoFunzionalita.ABILITATO)) {
  15598.                         if(richiestaIngresso.getBody().equals(StatoFunzionalita.ABILITATO))
  15599.                             return true;
  15600.                        
  15601.                         if(richiestaIngresso.getAttachments().equals(StatoFunzionalita.ABILITATO))
  15602.                             return true;        
  15603.                     }
  15604.                     else {
  15605.                         return true;
  15606.                     }
  15607.                 }
  15608.             }
  15609.            
  15610.             DumpConfigurazioneRegola richiestaUscita = configurazione.getRichiestaUscita();
  15611.            
  15612.             if(richiestaUscita != null) {
  15613.                 if(richiestaUscita.getHeaders().equals(StatoFunzionalita.ABILITATO))
  15614.                     return true;
  15615.                
  15616.                 if(richiestaUscita.getPayload().equals(StatoFunzionalita.ABILITATO)) {
  15617.                     if(richiestaUscita.getPayloadParsing().equals(StatoFunzionalita.ABILITATO)) {
  15618.                         if(richiestaUscita.getBody().equals(StatoFunzionalita.ABILITATO))
  15619.                             return true;
  15620.                        
  15621.                         if(richiestaUscita.getAttachments().equals(StatoFunzionalita.ABILITATO))
  15622.                             return true;        
  15623.                     }
  15624.                     else {
  15625.                         return true;
  15626.                     }
  15627.                 }
  15628.             }
  15629.         }
  15630.        
  15631.         return abilitato;
  15632.     }
  15633.    
  15634.     public boolean isDumpConfigurazioneAbilitato(DumpConfigurazione configurazione) {
  15635.         return isDumpConfigurazioneAbilitato(configurazione, true) || isDumpConfigurazioneAbilitato(configurazione, false);
  15636.     }

  15637.     /** Gestione Properties MVC */
  15638.    
  15639.     public void aggiornaConfigurazioneProperties(ConfigBean configurazione) throws DriverControlStationException {
  15640.         ConfigBean oldConfigurazione = ServletUtils.readConfigurazioneBeanFromSession(this.request, this.session, configurazione.getId());
  15641.        
  15642.         ExternalResources externalResources = new ExternalResources();
  15643.         externalResources.setLog(ControlStationCore.getLog());
  15644.         externalResources.setTipoDB(this.confCore.getTipoDatabase());
  15645.         Connection con = DBManager.getInstance().getConnection();
  15646.         try {
  15647.             externalResources.setConnection(con);
  15648.        
  15649.             for (String key : configurazione.getListakeys()) {
  15650.                 Boolean oldItemVisible = oldConfigurazione != null ? oldConfigurazione.getItem(key).getVisible() : null;
  15651.                
  15652.                 BaseItemBean<?> o = configurazione.getItem(key);
  15653.                 o.setOldVisible(oldItemVisible);
  15654.                 try {
  15655.                     String parameterValue = null;
  15656.                     if(ItemType.LOCK.equals(o.getItemType()) || ItemType.LOCK_HIDDEN.equals(o.getItemType())) {
  15657.                         parameterValue = this.getLockedParameter(key);
  15658.                     }
  15659.                     else {
  15660.                         parameterValue = this.getParameter(key);
  15661.                     }
  15662.                     o.setValueFromRequest(parameterValue, externalResources, this.confCore.getLockUtilities());
  15663.                 }catch(Exception e) {
  15664.                     throw new DriverControlStationException(e.getMessage(),e);
  15665.                 }
  15666.             }
  15667.            
  15668.         }finally {
  15669.             DBManager.getInstance().releaseConnection(con);
  15670.         }
  15671.     }
  15672.     public List<DataElement> addPropertiesConfigToDati(TipoOperazione tipoOperazione, List<DataElement> dati, String configName, ConfigBean configurazioneBean) throws DriverControlStationException {
  15673.         return addPropertiesConfigToDati(tipoOperazione, dati, configName, configurazioneBean, true);
  15674.     }
  15675.    
  15676.     public List<DataElement> addPropertiesConfigToDati(TipoOperazione tipoOperazione, List<DataElement> dati, String configName, ConfigBean configurazioneBean, boolean addHiddenConfigName) throws DriverControlStationException {
  15677.         if(addHiddenConfigName) {
  15678.             DataElement de = new DataElement();
  15679.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PROPERTIES_CONFIG_NAME);
  15680.             de.setValue(configName);
  15681.             de.setType(DataElementType.HIDDEN);
  15682.             de.setName(CostantiControlStation.PARAMETRO_PROPERTIES_CONFIG_NAME);
  15683.             dati.add(de);
  15684.         }
  15685.         if(configurazioneBean != null) {
  15686.             ExternalResources externalResources = new ExternalResources();
  15687.             externalResources.setLog(ControlStationCore.getLog());
  15688.             externalResources.setTipoDB(this.confCore.getTipoDatabase());
  15689.             Connection con = DBManager.getInstance().getConnection();
  15690.             try {
  15691.                 externalResources.setConnection(con);
  15692.                 Map<String, String> mapNameValue = new HashMap<>();
  15693.                 for (BaseItemBean<?> item : configurazioneBean.getListaItem()) {
  15694.                     if(item.isVisible()) {
  15695.                         try {
  15696.                             dati.add(item.toDataElement(configurazioneBean, mapNameValue, externalResources, this.confCore.getLockUtilities()));
  15697.                         }catch(Exception e) {
  15698.                             throw new DriverControlStationException(e.getMessage(),e);
  15699.                         }
  15700.                     }
  15701.                 }
  15702.             }finally {
  15703.                 DBManager.getInstance().releaseConnection(con);
  15704.             }
  15705.         }
  15706.        
  15707.         return dati;
  15708.     }
  15709.    
  15710.     public boolean checkPropertiesConfigurationData(TipoOperazione tipoOperazione,ConfigBean configurazioneBean, String nome, String descrizione, Config config) throws DriverControlStationException{
  15711.         // Controlli sui campi immessi
  15712.         try {
  15713.             ExternalResources externalResources = new ExternalResources();
  15714.             externalResources.setLog(ControlStationCore.getLog());
  15715.             externalResources.setTipoDB(this.confCore.getTipoDatabase());
  15716.             Connection con = DBManager.getInstance().getConnection();
  15717.             try {
  15718.                 externalResources.setConnection(con);
  15719.                 configurazioneBean.validazioneInputUtente(nome, descrizione, config, externalResources);
  15720.             }finally {
  15721.                 DBManager.getInstance().releaseConnection(con);
  15722.             }
  15723.             return true;
  15724.         }catch(UserInputValidationException e) {
  15725.             this.pd.setMessage(e.getMessage());  
  15726.             return false;
  15727.         } catch(ProviderException e) {
  15728.             this.pd.setMessage("Si &egrave; verificato un errore durante la validazione, impossibile utilizzare il plugin di validazione previsto dalla configurazione");
  15729.             return false;
  15730.         } catch(ProviderValidationException e) {
  15731.             this.pd.setMessage(e.getMessage());  
  15732.             return false;
  15733.         } catch (Throwable e) {
  15734.             this.pd.setMessage("Si &egrave; verificato un errore durante la validazione, impossibile caricare il plugin di validazione previsto dalla configurazione");
  15735.             return false;      
  15736.         }
  15737.     }
  15738.    
  15739.     public boolean isFirstTimeFromHttpParameters(String firstTimeParameter) throws DriverControlStationException{
  15740.        
  15741.         String tmp = this.getParameter(firstTimeParameter);
  15742.         if(tmp!=null && !"".equals(tmp.trim())){
  15743.             return "true".equals(tmp.trim());
  15744.         }
  15745.         return true;
  15746.        
  15747.     }
  15748.    
  15749.     public void addToDatiFirstTimeDisabled(List<DataElement> dati,String firstTimeParameter){
  15750.         DataElement de = new DataElement();
  15751.         de.setName(firstTimeParameter);
  15752.         de.setType(DataElementType.HIDDEN);
  15753.         de.setValue("false");
  15754.         dati.add(de);
  15755.     }
  15756.    
  15757.     public void addToDatiHiddenParameter(List<DataElement> dati,String name, String value){
  15758.         DataElement de = new DataElement();
  15759.         de.setName(name);
  15760.         de.setType(DataElementType.HIDDEN);
  15761.         de.setValue(value);
  15762.         dati.add(de);
  15763.     }
  15764.    
  15765.     public boolean hasOnlyPermessiDiagnosticaReportistica(User user) throws DriverControlStationException {
  15766.         PermessiUtente pu = user.getPermessi();
  15767.         Boolean singlePdD = ServletUtils.getObjectFromSession(this.request, this.session, Boolean.class, CostantiControlStation.SESSION_PARAMETRO_SINGLE_PDD);
  15768.         if(singlePdD==null) {
  15769.             singlePdD = this.core!=null ? this.core.isSinglePdD() : true;
  15770.         }

  15771.         String isServizi = (pu.isServizi() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15772.         String isDiagnostica = (pu.isDiagnostica() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15773.         String isReportistica = (pu.isReportistica() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15774.         String isSistema = (pu.isSistema() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15775.         String isMessaggi = (pu.isCodeMessaggi() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15776.         String isUtenti = (pu.isUtenti() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15777.         String isAuditing = (pu.isAuditing() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15778.         String isAccordiCooperazione = (pu.isAccordiCooperazione() ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED);
  15779.        
  15780.         return this.hasOnlyPermessiDiagnosticaReportistica(isServizi, isDiagnostica, isReportistica, isSistema, isMessaggi, isUtenti, isAuditing, isAccordiCooperazione, singlePdD);

  15781.     }
  15782.    
  15783.     public boolean hasOnlyPermessiDiagnosticaReportistica(String isServizi,String isDiagnostica,String isReportistica,String isSistema,String isMessaggi,
  15784.             String isUtenti,String isAuditing, String isAccordiCooperazione,boolean singlePdD) {
  15785.         return (((isServizi == null) || !ServletUtils.isCheckBoxEnabled(isServizi)) &&
  15786.                 (
  15787.                         !singlePdD
  15788.                         ||
  15789.                         checkPermessiDiagnosticaReportistica(isDiagnostica, isReportistica, singlePdD)
  15790.                 ) &&
  15791.                 ((isSistema == null) || !ServletUtils.isCheckBoxEnabled(isSistema)) &&
  15792.                 ((isMessaggi == null) || !ServletUtils.isCheckBoxEnabled(isMessaggi)) &&
  15793.                 ((isUtenti != null) || !ServletUtils.isCheckBoxEnabled(isUtenti)) &&
  15794.                 ((isAuditing == null) || !ServletUtils.isCheckBoxEnabled(isAuditing)) &&
  15795.                 ((isAccordiCooperazione == null) || !ServletUtils.isCheckBoxEnabled(isAccordiCooperazione)));
  15796.     }

  15797.     private boolean checkPermessiDiagnosticaReportistica(String isDiagnostica, String isReportistica, boolean singlePdD) {
  15798.         return singlePdD
  15799.         &&
  15800.         (
  15801.                 (isDiagnostica == null) || ServletUtils.isCheckBoxEnabled(isDiagnostica)
  15802.         )
  15803.         ||
  15804.         (
  15805.                 (isReportistica == null) || ServletUtils.isCheckBoxEnabled(isReportistica)
  15806.         );
  15807.     }
  15808.    
  15809.     public String readConfigurazioneRegistrazioneEsitiFromHttpParameters(String configurazioneEsiti, boolean first) throws DriverControlStationException {
  15810.        
  15811.        
  15812.         StringBuilder bf = new StringBuilder();
  15813.         List<Integer> esitiCodes = null;
  15814.         try {
  15815.             EsitiProperties esiti = EsitiConfigUtils.getEsitiPropertiesForConfiguration(ControlStationCore.getLog());
  15816.             esitiCodes = esiti.getEsitiCode();
  15817.         }catch(Exception e) {
  15818.             throw new DriverControlStationException(e.getMessage(),e);
  15819.         }
  15820.         if(esitiCodes!=null){
  15821.             for (Integer esito : esitiCodes) {
  15822.                 String esitoParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  15823.                 boolean checked = ServletUtils.isCheckBoxEnabled(esitoParam);
  15824.                 if(checked){
  15825.                     if(bf.length()>0){
  15826.                         bf.append(",");
  15827.                     }
  15828.                     bf.append(esito);
  15829.                 }
  15830.             }
  15831.         }
  15832.         if(bf.length()>0){
  15833.             return bf.toString();
  15834.         }
  15835.         else{
  15836.             if(first==false){
  15837.                 return null;
  15838.             }
  15839.             else{
  15840.                 if(configurazioneEsiti == null || "".equals(configurazioneEsiti.trim())){
  15841.                     // creo un default composto da tutti ad eccezione dell'esito (CONTROLLO_TRAFFICO_MAX_THREADS), delle violazioni policy di rate limiting (CONTROLLO_TRAFFICO_POLICY_VIOLATA) e delle richieste CORS OPTIONS
  15842.                     this.getRegistrazioneEsiti(configurazioneEsiti, bf);
  15843.                     if(bf.length()>0){
  15844.                         return bf.toString();
  15845.                     }
  15846.                     else{
  15847.                         return null;
  15848.                     }
  15849.                 }
  15850.             }
  15851.         }
  15852.         return configurazioneEsiti;
  15853.     }
  15854.    
  15855.     public List<String> getRegistrazioneEsiti(String configurazioneEsiti, StringBuilder bf) throws DriverControlStationException{
  15856.        
  15857.         try {
  15858.             EsitiProperties esiti = EsitiConfigUtils.getEsitiPropertiesForConfiguration(ControlStationCore.getLog());
  15859.             return EsitiConfigUtils.getRegistrazioneEsiti(configurazioneEsiti, ControlStationCore.getLog(), bf, esiti);
  15860.         }catch(Exception e) {
  15861.             throw new DriverControlStationException(e.getMessage(),e);
  15862.         }
  15863.        
  15864.     }
  15865.    
  15866.     public boolean isCompleteEnabled(List<String> attivi, List<Integer> listCheck) {

  15867.         boolean all = true;
  15868.         for (int i = 0; i < listCheck.size(); i++) {
  15869.             String okString = listCheck.get(i).intValue()+"";
  15870.             if(attivi.contains(okString)==false) {
  15871.                 all = false;
  15872.                 break;
  15873.             }
  15874.         }
  15875.         return all;
  15876.     }
  15877.    
  15878.     public boolean isCompleteDisabled(List<String> attivi, List<Integer> listCheck) {

  15879.         for (int i = 0; i < listCheck.size(); i++) {
  15880.             String okString = listCheck.get(i).intValue()+"";
  15881.             if(attivi.contains(okString)) {
  15882.                 return false;
  15883.             }
  15884.         }
  15885.         return true;
  15886.     }
  15887.    
  15888.     public List<Integer> getListaEsitiFalliteSenza_RateLimiting_MaxThreads_Scartate(EsitiProperties esiti) throws ProtocolException{
  15889.         List<Integer> listFallite = esiti.getEsitiCodeKo_senzaFaultApplicativo();
  15890.        
  15891.         List<Integer> listDaScartare = new ArrayList<>();
  15892.         listDaScartare.addAll(esiti.getEsitiCodeRichiestaScartate());
  15893.         int esitoViolazioneRateLimiting = esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_POLICY_VIOLATA);
  15894.         listDaScartare.add(esitoViolazioneRateLimiting);
  15895.         int esitoViolazione = esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_MAX_THREADS);
  15896.         listDaScartare.add(esitoViolazione);
  15897.        
  15898.         List<Integer> listFalliteSenza_rateLimiting_e_max_e_scartate = new ArrayList<>();
  15899.         int i = 0;
  15900.         for (; i < listFallite.size(); i++) {
  15901.             boolean findDaScartare = false;
  15902.             for (Integer daScartare : listDaScartare) {
  15903.                 if(listFallite.get(i).intValue() == daScartare.intValue()) {
  15904.                     findDaScartare = true;
  15905.                     break;
  15906.                 }
  15907.             }
  15908.             if(!findDaScartare) {
  15909.                
  15910.                 boolean statiConsegnaMultipla = EsitoTransazioneName.isStatiConsegnaMultipla(esiti.getEsitoTransazioneName(listFallite.get(i)));
  15911.                 if(statiConsegnaMultipla) {
  15912.                     continue; // non vengono gestiti in questa configurazione
  15913.                 }
  15914.                
  15915.                 listFalliteSenza_rateLimiting_e_max_e_scartate.add(listFallite.get(i));
  15916.             }
  15917.         }
  15918.         return listFalliteSenza_rateLimiting_e_max_e_scartate;
  15919.     }
  15920.    
  15921.     public List<Integer> getListaEsitiOkSenzaCors(EsitiProperties esiti) throws ProtocolException{
  15922.         List<Integer> listOk = esiti.getEsitiCodeOk_senzaFaultApplicativo();
  15923.         int esitoCorsGateway = esiti.convertoToCode(EsitoTransazioneName.CORS_PREFLIGHT_REQUEST_VIA_GATEWAY);
  15924.         int esitoCorsTrasparente = esiti.convertoToCode(EsitoTransazioneName.CORS_PREFLIGHT_REQUEST_TRASPARENTE);
  15925.         List<Integer> listOkSenzaCors = new ArrayList<>();
  15926.         int i = 0;
  15927.         for (; i < listOk.size(); i++) {
  15928.            
  15929.             boolean statiConsegnaMultipla = EsitoTransazioneName.isStatiConsegnaMultipla(esiti.getEsitoTransazioneName(listOk.get(i)));
  15930.             if(statiConsegnaMultipla) {
  15931.                 continue; // non vengono gestiti in questa configurazione
  15932.             }
  15933.            
  15934.             if((listOk.get(i).intValue() != esitoCorsGateway) && (listOk.get(i).intValue() != esitoCorsTrasparente)) {
  15935.                 listOkSenzaCors.add(listOk.get(i));
  15936.             }
  15937.         }
  15938.         return listOkSenzaCors;
  15939.     }
  15940.    
  15941.     public List<Integer> getListaEsitiCors(EsitiProperties esiti) throws ProtocolException{
  15942.         int esitoCorsGateway = esiti.convertoToCode(EsitoTransazioneName.CORS_PREFLIGHT_REQUEST_VIA_GATEWAY);
  15943.         int esitoCorsTrasparente = esiti.convertoToCode(EsitoTransazioneName.CORS_PREFLIGHT_REQUEST_TRASPARENTE);
  15944.         List<Integer> listCors = new ArrayList<>();
  15945.         listCors.add(esitoCorsGateway);
  15946.         listCors.add(esitoCorsTrasparente);
  15947.         return listCors;
  15948.     }
  15949.        
  15950.     public void addToDatiTracciamentoTransazioni(List<DataElement> dati, TipoOperazione tipoOperazione,
  15951.             String tracciamentoStato,
  15952.             String servletName, List<Parameter> listParameter,
  15953.             String oldTracciamentoStato) {
  15954.        
  15955.         if(tipoOperazione!=null) {
  15956.             // nop
  15957.         }
  15958.        
  15959.         DataElement de = new DataElement();
  15960.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA);
  15961.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO);
  15962.         de.setType(DataElementType.TITLE);
  15963.         dati.add(de);
  15964.        
  15965.         de = new DataElement();
  15966.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  15967.         de.setName(CostantiControlStation.PARAMETRO_PORTE_TRACCIAMENTO_STATO);
  15968.         de.setType(DataElementType.SELECT);
  15969.         String [] valuesStato = {CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO};
  15970.         String [] labelsStato = {CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_RIDEFINITO};
  15971.         de.setSelected(tracciamentoStato);
  15972.         de.setLabels(labelsStato);
  15973.         de.setValues(valuesStato);
  15974.         de.setPostBack_viaPOST(true);
  15975.         dati.add(de);
  15976.        
  15977.         if(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO.equals(oldTracciamentoStato)) {
  15978.            
  15979.             de = new DataElement();
  15980.             de.setType(DataElementType.LINK);
  15981.             listParameter.add(new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA));
  15982.             de.setUrl(servletName,
  15983.                     listParameter.toArray(new Parameter[1]));
  15984.             de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO_CONFIGURAZIONE);
  15985.             dati.add(de);
  15986.            
  15987.         }
  15988.        
  15989.     }
  15990.    
  15991.     public void addToDatiRegistrazioneEsiti(List<DataElement> dati, TipoOperazione tipoOperazione,
  15992.             String nuovaConfigurazioneEsiti,
  15993.             boolean selectAll,
  15994.             String tracciamentoEsitiSelezionePersonalizzataOk, String tracciamentoEsitiSelezionePersonalizzataFault,
  15995.             String tracciamentoEsitiSelezionePersonalizzataFallite, String tracciamentoEsitiSelezionePersonalizzataScartate,
  15996.             String tracciamentoEsitiSelezionePersonalizzataRateLimiting, String tracciamentoEsitiSelezionePersonalizzataMax, String tracciamentoEsitiSelezionePersonalizzataCors,
  15997.             TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti) throws DriverControlStationException {
  15998.        
  15999.         if(tipoOperazione!=null) {
  16000.             // nop
  16001.         }
  16002.        
  16003.         if(tracciamentoCompatibilitaFiltroEsiti!=null && !tracciamentoCompatibilitaFiltroEsiti.isTracciamentoEnabled()) {
  16004.             return;
  16005.         }
  16006.        
  16007.         boolean filterEnabled = tracciamentoCompatibilitaFiltroEsiti==null || tracciamentoCompatibilitaFiltroEsiti.isFilterEnabled();
  16008.         if(!filterEnabled){
  16009.             return;
  16010.         }
  16011.        
  16012.         DataElement de = new DataElement();
  16013.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI);
  16014.         de.setType(DataElementType.TITLE);
  16015.         dati.add(de);
  16016.                        
  16017.         de = new DataElement();
  16018.         de.setValue(ConfigurazioneCostanti.LABEL_NOTE_CONFIGURAZIONE_REGISTRAZIONE_ESITI);
  16019.         de.setType(DataElementType.NOTE);
  16020.         dati.add(de);
  16021.        
  16022.         if(tracciamentoCompatibilitaFiltroEsiti!=null) {
  16023.             String warningMsg = tracciamentoCompatibilitaFiltroEsiti.getWarningMessageFilter();
  16024.             if(warningMsg!=null && StringUtils.isNotEmpty(warningMsg)) {
  16025.                 de = new DataElement();
  16026.                 de.setValue(warningMsg);
  16027.                 de.setLabel("Nota");
  16028.                 de.setBold(true);
  16029.                 de.setType(DataElementType.NOTE);
  16030.                 dati.add(de);
  16031.             }
  16032.         }
  16033.        
  16034.         List<String> attivi = new ArrayList<>();
  16035.         if(nuovaConfigurazioneEsiti!=null){
  16036.             String [] tmp = nuovaConfigurazioneEsiti.split(",");
  16037.             if(tmp!=null){
  16038.                 for (int i = 0; i < tmp.length; i++) {
  16039.                     attivi.add(tmp[i].trim());
  16040.                 }
  16041.             }
  16042.         }
  16043.        
  16044.        
  16045.         EsitiProperties esiti = null;
  16046.         try {
  16047.             esiti = EsitiConfigUtils.getEsitiPropertiesForConfiguration(ControlStationCore.getLog());
  16048.         }catch(Exception e) {
  16049.             throw new DriverControlStationException(e.getMessage(),e);
  16050.         }
  16051.        
  16052.         List<String> values = new ArrayList<>();
  16053.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
  16054.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
  16055.         values.add(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO);
  16056.        
  16057.         List<String> valuesSenzaPersonalizzato = new ArrayList<>();
  16058.         valuesSenzaPersonalizzato.add(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
  16059.         valuesSenzaPersonalizzato.add(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
  16060.        
  16061.        
  16062.         // select all
  16063.        
  16064.         de = new DataElement();
  16065.         de.setLabelRight(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_ALL);
  16066.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_ALL);
  16067.         de.setType(DataElementType.CHECKBOX);
  16068.         de.setSelected(selectAll);
  16069.         de.setPostBack_viaPOST(true);
  16070.         dati.add(de);
  16071.        
  16072.        
  16073.         // ok
  16074.        
  16075.         List<Integer> listOk = null;
  16076.         try {
  16077.             listOk = getListaEsitiOkSenzaCors(esiti);
  16078.         }catch(Exception e) {
  16079.             throw new DriverControlStationException(e.getMessage(),e);
  16080.         }
  16081.        
  16082.         if(!selectAll) {
  16083.             de = new DataElement();
  16084.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK);
  16085.             de.setType(DataElementType.SUBTITLE);
  16086.             dati.add(de);
  16087.         }
  16088.                
  16089.         de = new DataElement();
  16090.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16091.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK);
  16092.         if(!selectAll) {
  16093.             de.setType(DataElementType.SELECT);
  16094.             de.setValues(values);
  16095.             de.setLabels(values);
  16096.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataOk);
  16097.             de.setPostBack_viaPOST(true);
  16098.         }
  16099.         else {
  16100.             de.setType(DataElementType.HIDDEN);
  16101.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataOk);
  16102.         }
  16103.         dati.add(de);
  16104.                
  16105.         if(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataOk) ||
  16106.                 ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataOk) ||
  16107.                 selectAll) {
  16108.             for (Integer esito : listOk) {
  16109.                
  16110.                 try {
  16111.                     EsitoTransazioneName esitoTransactionName = esiti.getEsitoTransazioneName(esito);
  16112.                    
  16113.                     boolean statiConsegnaMultipla = EsitoTransazioneName.isStatiConsegnaMultipla(esitoTransactionName);
  16114.                     if(statiConsegnaMultipla) {
  16115.                         continue; // non vengono gestiti in questa configurazione
  16116.                     }
  16117.                    
  16118.                     boolean integrationManagerSpecific = EsitoTransazioneName.isIntegrationManagerSpecific(esitoTransactionName);      
  16119.                     boolean integrationManagerSavedInMessageBox = EsitoTransazioneName.isSavedInMessageBox(esitoTransactionName);      
  16120.                                        
  16121.                     de = new DataElement();
  16122.                     if(EsitoTransazioneName.CONSEGNA_MULTIPLA.equals(esitoTransactionName)) {
  16123.                         de.setLabelRight(EsitoUtils.LABEL_ESITO_CONSEGNA_MULTIPLA_SENZA_STATI);
  16124.                     }
  16125.                     else {
  16126.                         de.setLabelRight(esiti.getEsitoLabel(esito));
  16127.                     }
  16128.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  16129.                     if(!selectAll && ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataOk)) {
  16130.                         if(
  16131.                                 (
  16132.                                         integrationManagerSpecific &&
  16133.                                         (this.isModalitaStandard() || !this.core.isIntegrationManagerTraceMessageBoxOperationEnabled())
  16134.                                 )
  16135.                                 ||
  16136.                                 (
  16137.                                         integrationManagerSavedInMessageBox && (!this.core.isIntegrationManagerEnabled())
  16138.                                 )
  16139.                         ) {
  16140.                             de.setType(DataElementType.HIDDEN);
  16141.                             de.setValue(attivi.contains((esito+""))+"");
  16142.                         }
  16143.                         else {
  16144.                             de.setType(DataElementType.CHECKBOX);
  16145.                             de.setSelected(attivi.contains((esito+"")));
  16146.                         }
  16147.                     }
  16148.                     else {
  16149.                         de.setType(DataElementType.HIDDEN);
  16150.                         de.setValue("true");
  16151.                     }
  16152.                     dati.add(de);
  16153.                 }catch(Exception e) {
  16154.                     throw new DriverControlStationException(e.getMessage(),e);
  16155.                 }
  16156.             }
  16157.         }
  16158.        
  16159.        
  16160.        
  16161.         // fault
  16162.        
  16163.         List<Integer> listFault = null;
  16164.         try {
  16165.             listFault = esiti.getEsitiCodeFaultApplicativo();
  16166.         }catch(Exception e) {
  16167.             throw new DriverControlStationException(e.getMessage(),e);
  16168.         }
  16169.        
  16170.         if(!selectAll) {
  16171.             de = new DataElement();
  16172.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FAULT);
  16173.             de.setType(DataElementType.SUBTITLE);
  16174.             dati.add(de);
  16175.         }
  16176.                
  16177.         de = new DataElement();
  16178.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16179.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FAULT);
  16180.         if(!selectAll) {
  16181.             de.setType(DataElementType.SELECT);
  16182.             if(listFault.size()>1) {
  16183.                 de.setValues(values);
  16184.                 de.setLabels(values);
  16185.             }
  16186.             else {
  16187.                 de.setValues(valuesSenzaPersonalizzato);
  16188.                 de.setLabels(valuesSenzaPersonalizzato);
  16189.             }
  16190.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataFault);
  16191.             de.setPostBack_viaPOST(true);
  16192.         }
  16193.         else {
  16194.             de.setType(DataElementType.HIDDEN);
  16195.             de.setValue(tracciamentoEsitiSelezionePersonalizzataFault);
  16196.         }
  16197.         dati.add(de);
  16198.                
  16199.         if(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataFault) ||
  16200.                 ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataFault) ||
  16201.                 selectAll) {
  16202.             for (Integer esito : listFault) {
  16203.                 try {
  16204.                     de = new DataElement();
  16205.                     de.setLabelRight(esiti.getEsitoLabel(esito));
  16206.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  16207.                     if(!selectAll && ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataFault)) {
  16208.                         de.setType(DataElementType.CHECKBOX);
  16209.                         de.setSelected(attivi.contains((esito+"")));
  16210.                     }
  16211.                     else {
  16212.                         de.setType(DataElementType.HIDDEN);
  16213.                         de.setValue("true");
  16214.                     }
  16215.                     dati.add(de);
  16216.                 }catch(Exception e) {
  16217.                     throw new DriverControlStationException(e.getMessage(),e);
  16218.                 }
  16219.             }
  16220.         }
  16221.        
  16222.        
  16223.        
  16224.         // fallite
  16225.        
  16226.         List<Integer> listFalliteSenzaMaxThreadsScartate = null;
  16227.         try {
  16228.             listFalliteSenzaMaxThreadsScartate = getListaEsitiFalliteSenza_RateLimiting_MaxThreads_Scartate(esiti);
  16229.         }catch(Exception e) {
  16230.             throw new DriverControlStationException(e.getMessage(),e);
  16231.         }
  16232.        
  16233.         if(!selectAll) {
  16234.             de = new DataElement();
  16235.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE);
  16236.             de.setType(DataElementType.SUBTITLE);
  16237.             dati.add(de);
  16238.         }
  16239.                
  16240.         de = new DataElement();
  16241.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16242.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE);
  16243.         if(!selectAll) {
  16244.             de.setType(DataElementType.SELECT);
  16245.             de.setValues(values);
  16246.             de.setLabels(values);
  16247.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataFallite);
  16248.             de.setPostBack_viaPOST(true);
  16249.         }
  16250.         else {
  16251.             de.setType(DataElementType.HIDDEN);
  16252.             de.setValue(tracciamentoEsitiSelezionePersonalizzataFallite);
  16253.         }
  16254.         dati.add(de);
  16255.                
  16256.         if(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataFallite) ||
  16257.                 ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataFallite) ||
  16258.                 selectAll) {
  16259.             for (Integer esito : listFalliteSenzaMaxThreadsScartate) {
  16260.                
  16261.                 try {
  16262.                     EsitoTransazioneName esitoTransactionName = esiti.getEsitoTransazioneName(esito);
  16263.                    
  16264.                     boolean statiConsegnaMultipla = EsitoTransazioneName.isStatiConsegnaMultipla(esitoTransactionName);
  16265.                     if(statiConsegnaMultipla) {
  16266.                         continue; // non vengono gestiti in questa configurazione
  16267.                     }
  16268.                    
  16269.                     boolean integrationManagerSpecific = EsitoTransazioneName.isIntegrationManagerSpecific(esitoTransactionName);      
  16270.                    
  16271.                     de = new DataElement();
  16272.                     de.setLabelRight(esiti.getEsitoLabel(esito));
  16273.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  16274.                     if(!selectAll && ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataFallite)) {
  16275.                         if(integrationManagerSpecific && (this.isModalitaStandard() || !this.core.isIntegrationManagerTraceMessageBoxOperationEnabled())) {
  16276.                             de.setType(DataElementType.HIDDEN);
  16277.                             de.setValue(attivi.contains((esito+""))+"");
  16278.                         }
  16279.                         else {
  16280.                             de.setType(DataElementType.CHECKBOX);
  16281.                             de.setSelected(attivi.contains((esito+"")));
  16282.                         }
  16283.                     }
  16284.                     else {
  16285.                         de.setType(DataElementType.HIDDEN);
  16286.                         de.setValue("true");
  16287.                     }
  16288.                     dati.add(de);
  16289.                 }catch(Exception e) {
  16290.                     throw new DriverControlStationException(e.getMessage(),e);
  16291.                 }
  16292.                
  16293.             }
  16294.         }
  16295.        
  16296.        
  16297.        
  16298.         // Scartate
  16299.        
  16300.         List<Integer> listScartate = null;
  16301.         try {
  16302.             listScartate = esiti.getEsitiCodeRichiestaScartate();
  16303.         }catch(Exception e) {
  16304.             throw new DriverControlStationException(e.getMessage(),e);
  16305.         }
  16306.        
  16307.         if(!selectAll) {
  16308.             de = new DataElement();
  16309.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_SCARTATE);
  16310.             de.setType(DataElementType.SUBTITLE);
  16311.             dati.add(de);
  16312.         }
  16313.                
  16314.         de = new DataElement();
  16315.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16316.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_SCARTATE);
  16317.         if(!selectAll) {
  16318.             de.setType(DataElementType.SELECT);
  16319.             de.setValues(values);
  16320.             de.setLabels(values);
  16321.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataScartate);
  16322.             de.setPostBack_viaPOST(true);
  16323.         }
  16324.         else {
  16325.             de.setType(DataElementType.HIDDEN);
  16326.             de.setValue(tracciamentoEsitiSelezionePersonalizzataScartate);
  16327.         }
  16328.         dati.add(de);
  16329.                
  16330.         if(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataScartate) ||
  16331.                 ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataScartate) ||
  16332.                 selectAll) {
  16333.             for (Integer esito : listScartate) {
  16334.                
  16335.                 try {
  16336.                
  16337.                     EsitoTransazioneName esitoTransactionName = esiti.getEsitoTransazioneName(esito);
  16338.                    
  16339.                     boolean statiConsegnaMultipla = EsitoTransazioneName.isStatiConsegnaMultipla(esitoTransactionName);
  16340.                     if(statiConsegnaMultipla) {
  16341.                         continue; // non vengono gestiti in questa configurazione
  16342.                     }
  16343.                    
  16344.                     boolean integrationManagerSpecific = EsitoTransazioneName.isIntegrationManagerSpecific(esitoTransactionName);      
  16345.                    
  16346.                     de = new DataElement();
  16347.                     de.setLabelRight(esiti.getEsitoLabel(esito));
  16348.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  16349.                     if(!selectAll && ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataScartate)) {
  16350.                         if(integrationManagerSpecific && (this.isModalitaStandard() || !this.core.isIntegrationManagerTraceMessageBoxOperationEnabled())) {
  16351.                             de.setType(DataElementType.HIDDEN);
  16352.                             de.setValue(attivi.contains((esito+""))+"");
  16353.                         }
  16354.                         else {
  16355.                             de.setType(DataElementType.CHECKBOX);
  16356.                             de.setSelected(attivi.contains((esito+"")));
  16357.                         }
  16358.                     }
  16359.                     else {
  16360.                         de.setType(DataElementType.HIDDEN);
  16361.                         de.setValue("true");
  16362.                     }
  16363.                     dati.add(de);
  16364.                    
  16365.                 }catch(Exception e) {
  16366.                     throw new DriverControlStationException(e.getMessage(),e);
  16367.                 }
  16368.             }
  16369.         }
  16370.                
  16371.        
  16372.        
  16373.        
  16374.         // rate limiting
  16375.        
  16376.         if(!selectAll) {
  16377.             de = new DataElement();
  16378.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_RATE_LIMITING);
  16379.             de.setType(DataElementType.SUBTITLE);
  16380.             dati.add(de);
  16381.         }
  16382.        
  16383.         String esitoViolazioneRateLimitingAsString = null;
  16384.         try {
  16385.             esitoViolazioneRateLimitingAsString = esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_POLICY_VIOLATA) + "";
  16386.         }catch(Exception e) {
  16387.             throw new DriverControlStationException(e.getMessage(),e);
  16388.         }
  16389.        
  16390.         de = new DataElement();
  16391.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16392.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_RATE_LIMITING);
  16393.         if(!selectAll) {
  16394.             de.setType(DataElementType.SELECT);
  16395.             de.setValues(valuesSenzaPersonalizzato);
  16396.             de.setLabels(valuesSenzaPersonalizzato);
  16397.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataRateLimiting);
  16398.             de.setPostBack_viaPOST(true);
  16399.         }
  16400.         else {
  16401.             de.setType(DataElementType.HIDDEN);
  16402.             de.setValue(tracciamentoEsitiSelezionePersonalizzataRateLimiting);
  16403.         }
  16404.         dati.add(de);
  16405.        
  16406.         if(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataRateLimiting) ||
  16407.                 selectAll) {
  16408.             de = new DataElement();
  16409.             de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esitoViolazioneRateLimitingAsString);
  16410.             de.setType(DataElementType.HIDDEN);
  16411.             de.setValue("true");
  16412.             dati.add(de);
  16413.         }
  16414.        
  16415.        
  16416.        
  16417.        
  16418.        
  16419.         // max
  16420.        
  16421.         if(!selectAll) {
  16422.             de = new DataElement();
  16423.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_MAX_REQUESTS);
  16424.             de.setType(DataElementType.SUBTITLE);
  16425.             dati.add(de);
  16426.         }
  16427.        
  16428.         String esitoViolazioneAsString = null;
  16429.         try{
  16430.             esitoViolazioneAsString = esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_MAX_THREADS) + "";
  16431.         }catch(Exception e) {
  16432.             throw new DriverControlStationException(e.getMessage(),e);
  16433.         }
  16434.        
  16435.         de = new DataElement();
  16436.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16437.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_MAX_REQUEST);
  16438.         if(!selectAll) {
  16439.             de.setType(DataElementType.SELECT);
  16440.             de.setValues(valuesSenzaPersonalizzato);
  16441.             de.setLabels(valuesSenzaPersonalizzato);
  16442.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataMax);
  16443.             de.setPostBack_viaPOST(true);
  16444.         }
  16445.         else {
  16446.             de.setType(DataElementType.HIDDEN);
  16447.             de.setValue(tracciamentoEsitiSelezionePersonalizzataMax);
  16448.         }
  16449.         dati.add(de);
  16450.        
  16451.         if(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataMax) ||
  16452.                 selectAll) {
  16453.             de = new DataElement();
  16454.             de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esitoViolazioneAsString);
  16455.             de.setType(DataElementType.HIDDEN);
  16456.             de.setValue("true");
  16457.             dati.add(de);
  16458.         }
  16459.        
  16460.        
  16461.        
  16462.        
  16463.         // cors
  16464.        
  16465.         if(!selectAll) {
  16466.             de = new DataElement();
  16467.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_CORS);
  16468.             de.setType(DataElementType.SUBTITLE);
  16469.             dati.add(de);
  16470.         }
  16471.        
  16472.         de = new DataElement();
  16473.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  16474.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_CORS);
  16475.         if(!selectAll) {
  16476.             de.setType(DataElementType.SELECT);
  16477.             de.setValues(values);
  16478.             de.setLabels(values);
  16479.             de.setSelected(tracciamentoEsitiSelezionePersonalizzataCors);
  16480.             de.setPostBack_viaPOST(true);
  16481.         }
  16482.         else {
  16483.             de.setType(DataElementType.HIDDEN);
  16484.             de.setValue(tracciamentoEsitiSelezionePersonalizzataCors);
  16485.         }
  16486.         dati.add(de);
  16487.                
  16488.         if(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataCors) ||
  16489.                 ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(tracciamentoEsitiSelezionePersonalizzataCors) ||
  16490.                 selectAll) {
  16491.            
  16492.             try {
  16493.            
  16494.                 List<Integer> listCors = this.getListaEsitiCors(esiti);
  16495.                
  16496.                 for (Integer esito : listCors) {
  16497.                    
  16498.                     EsitoTransazioneName esitoTransactionName = esiti.getEsitoTransazioneName(esito);
  16499.                     boolean integrationManagerSpecific = EsitoTransazioneName.isIntegrationManagerSpecific(esitoTransactionName);      
  16500.                    
  16501.                     de = new DataElement();
  16502.                     de.setLabelRight(esiti.getEsitoLabel(esito));
  16503.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO+esito);
  16504.                     if(!selectAll && ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO.equals(tracciamentoEsitiSelezionePersonalizzataCors)) {
  16505.                         if(integrationManagerSpecific && (this.isModalitaStandard() || !this.core.isIntegrationManagerTraceMessageBoxOperationEnabled())) {
  16506.                             de.setType(DataElementType.HIDDEN);
  16507.                             de.setValue(attivi.contains((esito+""))+"");
  16508.                         }
  16509.                         else {
  16510.                             de.setType(DataElementType.CHECKBOX);
  16511.                             de.setSelected(attivi.contains((esito+"")));
  16512.                         }
  16513.                     }
  16514.                     else {
  16515.                         de.setType(DataElementType.HIDDEN);
  16516.                         de.setValue("true");
  16517.                     }
  16518.                     dati.add(de);
  16519.                 }
  16520.                
  16521.             }catch(Exception e) {
  16522.                 throw new DriverControlStationException(e.getMessage(),e);
  16523.             }
  16524.         }

  16525.     }
  16526.    
  16527.     public void addToDatiRegistrazioneTransazione(List<DataElement> dati, TipoOperazione tipoOperazione,
  16528.             String transazioniTempiElaborazione, String transazioniToken) throws DriverControlStationException {
  16529.        
  16530.         if(!this.isModalitaStandard()) {
  16531.            
  16532.             DataElement de = new DataElement();
  16533.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INFORMAZIONI_TRANSAZIONE);
  16534.             de.setType(DataElementType.TITLE);
  16535.             dati.add(de);
  16536.            
  16537.         }
  16538.            
  16539.         List<String> values = new ArrayList<>();
  16540.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
  16541.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
  16542.            
  16543.         DataElement de = new DataElement();
  16544.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INFORMAZIONI_TRANSAZIONE_TEMPI_ELABORAZIONE);
  16545.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONE_TEMPI);
  16546.         if(!this.isModalitaStandard()) {
  16547.             de.setType(DataElementType.SELECT);
  16548.             de.setValues(values);
  16549.             de.setLabels(values);
  16550.             de.setSelected(transazioniTempiElaborazione);
  16551.         }
  16552.         else {
  16553.             de.setType(DataElementType.HIDDEN);
  16554.             de.setValue(transazioniTempiElaborazione);
  16555.         }
  16556.         dati.add(de);  
  16557.        
  16558.         de = new DataElement();
  16559.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INFORMAZIONI_TRANSAZIONE_TOKEN);
  16560.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONE_TOKEN);
  16561.         if(!this.isModalitaStandard()) {
  16562.             de.setType(DataElementType.SELECT);
  16563.             de.setValues(values);
  16564.             de.setLabels(values);
  16565.             de.setSelected(transazioniToken);
  16566.         }
  16567.         else {
  16568.             de.setType(DataElementType.HIDDEN);
  16569.             de.setValue(transazioniToken);
  16570.         }
  16571.         dati.add(de);  
  16572.        
  16573.     }
  16574.    
  16575.    
  16576.     public void addToDatiRegistrazioneConfigurazioneFileTrace(List<DataElement> dati,
  16577.             String fileTraceStato, String fileTraceConfigFile,
  16578.             String fileTraceClient, String fileTraceClientHdr, String fileTraceClientBody,
  16579.             String fileTraceServer, String fileTraceServerHdr, String fileTraceServerBody,
  16580.             TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti) {
  16581.        
  16582.         if(!tracciamentoCompatibilitaFiltroEsiti.isTracciamentoFileTraceEnabled()) {
  16583.             return;
  16584.         }
  16585.         if(!tracciamentoCompatibilitaFiltroEsiti.isTracciamentoFileTraceEnabled() || tracciamentoCompatibilitaFiltroEsiti.isTracciamentoFileTraceEnabledByExternalProperties() ) {
  16586.             return;
  16587.         }
  16588.        
  16589.         DataElement de = new DataElement();
  16590.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE);
  16591.         de.setType(DataElementType.TITLE);
  16592.         dati.add(de);
  16593.            
  16594.        
  16595.         de = new DataElement();
  16596.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_STATO);
  16597.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_STATO);
  16598.         de.setType(DataElementType.SELECT);
  16599.         String [] valuesStato = {CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO};
  16600.         String [] labelsStato = {CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_RIDEFINITO};
  16601.         de.setSelected(fileTraceStato);
  16602.         de.setLabels(labelsStato);
  16603.         de.setValues(valuesStato);
  16604.         de.setPostBack_viaPOST(true);
  16605.         dati.add(de);
  16606.        
  16607.         boolean ridefinito = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO.equals(fileTraceStato);
  16608.        
  16609.         de = new DataElement();
  16610.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_CONFIGURAZIONE);
  16611.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CONFIGURAZIONE);
  16612.         de.setValue(fileTraceConfigFile);
  16613.         if(ridefinito) {
  16614.             de.setType(DataElementType.TEXT_AREA);
  16615.             de.setRows(2);
  16616.         }
  16617.         else {
  16618.             de.setType(DataElementType.HIDDEN);
  16619.         }
  16620.         dati.add(de);  
  16621.        
  16622.        
  16623.         if(ridefinito) {
  16624.             de = new DataElement();
  16625.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_REGISTRAZIONE_MESSAGGI);
  16626.             de.setType(DataElementType.SUBTITLE);
  16627.             dati.add(de);
  16628.            
  16629.             de = new DataElement();
  16630.             de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_REGISTRAZIONE_MESSAGGI_NOTE);
  16631.             de.setType(DataElementType.NOTE);
  16632.             dati.add(de);  
  16633.         }
  16634.        
  16635.        
  16636.         List<String> values = new ArrayList<>();
  16637.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
  16638.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
  16639.            
  16640.        
  16641.        
  16642.         de = new DataElement();
  16643.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_CLIENT);
  16644.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT);
  16645.         if(ridefinito) {
  16646.             de.setType(DataElementType.SELECT);
  16647.             de.setValues(values);
  16648.             de.setLabels(values);
  16649.             de.setSelected(fileTraceClient);
  16650.             de.setPostBack_viaPOST(true);
  16651.         }
  16652.         else {
  16653.             de.setType(DataElementType.HIDDEN);
  16654.             de.setValue(fileTraceClient);
  16655.         }
  16656.         dati.add(de);  
  16657.        
  16658.         de = new DataElement();
  16659.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_HEADER);
  16660.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT_HEADER);
  16661.         if(ridefinito && ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(fileTraceClient)) {
  16662.             de.setType(DataElementType.SELECT);
  16663.             de.setValues(values);
  16664.             de.setLabels(values);
  16665.             de.setSelected(fileTraceClientHdr);
  16666.         }
  16667.         else {
  16668.             de.setType(DataElementType.HIDDEN);
  16669.             de.setValue(fileTraceClientHdr);
  16670.         }
  16671.         dati.add(de);  
  16672.        
  16673.         de = new DataElement();
  16674.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_PAYLOAD);
  16675.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT_PAYLOAD);
  16676.         if(ridefinito && ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(fileTraceClient)) {
  16677.             de.setType(DataElementType.SELECT);
  16678.             de.setValues(values);
  16679.             de.setLabels(values);
  16680.             de.setSelected(fileTraceClientBody);
  16681.         }
  16682.         else {
  16683.             de.setType(DataElementType.HIDDEN);
  16684.             de.setValue(fileTraceClientBody);
  16685.         }
  16686.         dati.add(de);  
  16687.        
  16688.        
  16689.        
  16690.        
  16691.         de = new DataElement();
  16692.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_SERVER);
  16693.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER);
  16694.         if(ridefinito) {
  16695.             de.setType(DataElementType.SELECT);
  16696.             de.setValues(values);
  16697.             de.setLabels(values);
  16698.             de.setSelected(fileTraceServer);
  16699.             de.setPostBack_viaPOST(true);
  16700.         }
  16701.         else {
  16702.             de.setType(DataElementType.HIDDEN);
  16703.             de.setValue(fileTraceServer);
  16704.         }
  16705.         dati.add(de);  
  16706.        
  16707.         de = new DataElement();
  16708.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_HEADER);
  16709.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER_HEADER);
  16710.         if(ridefinito && ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(fileTraceServer)) {
  16711.             de.setType(DataElementType.SELECT);
  16712.             de.setValues(values);
  16713.             de.setLabels(values);
  16714.             de.setSelected(fileTraceServerHdr);
  16715.         }
  16716.         else {
  16717.             de.setType(DataElementType.HIDDEN);
  16718.             de.setValue(fileTraceServerHdr);
  16719.         }
  16720.         dati.add(de);  
  16721.        
  16722.         de = new DataElement();
  16723.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILETRACE_PAYLOAD);
  16724.         de.setName(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER_PAYLOAD);
  16725.         if(ridefinito && ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(fileTraceServer)) {
  16726.             de.setType(DataElementType.SELECT);
  16727.             de.setValues(values);
  16728.             de.setLabels(values);
  16729.             de.setSelected(fileTraceServerBody);
  16730.         }
  16731.         else {
  16732.             de.setType(DataElementType.HIDDEN);
  16733.             de.setValue(fileTraceServerBody);
  16734.         }
  16735.         dati.add(de);  
  16736.     }
  16737.    
  16738.    
  16739.     public void addToDatiConfigurazioneAvanzataTracciamento(List<DataElement> dati, TipoOperazione tipoOperazione,
  16740.             String dbStato,
  16741.             String dbStatoReqIn, String dbStatoReqOut, String dbStatoResOut, String dbStatoResOutComplete,
  16742.             boolean dbFiltroEsiti,
  16743.             String fsStato,
  16744.             String fsStatoReqIn, String fsStatoReqOut, String fsStatoResOut, String fsStatoResOutComplete,
  16745.             boolean fsFiltroEsiti,
  16746.             boolean porta) {
  16747.                            

  16748.         DataElement de = new DataElement();
  16749.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA);
  16750.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO);
  16751.         de.setType(DataElementType.TITLE);
  16752.         dati.add(de);
  16753.        
  16754.        
  16755.         // DATABASE
  16756.        
  16757.         de = new DataElement();
  16758.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE);
  16759.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE);
  16760.         de.setType(DataElementType.SUBTITLE);
  16761.         /**de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.CHIUSO);*/
  16762.         dati.add(de);
  16763.        
  16764.         // stato abilitazione
  16765.         addTransazioniStatoElement(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO,
  16766.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO,
  16767.                 false,
  16768.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO,
  16769.                 dbStato,
  16770.                 true,
  16771.                 true,
  16772.                 false);
  16773.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO_REQ_IN,
  16774.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_IN,
  16775.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato), // hidden
  16776.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_IN,
  16777.                 dbStatoReqIn,
  16778.                 true);
  16779.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO_REQ_OUT,
  16780.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_OUT,
  16781.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato), // hidden
  16782.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_OUT,
  16783.                 dbStatoReqOut,
  16784.                 true);
  16785.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO_RES_OUT,
  16786.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT,
  16787.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato), // hidden
  16788.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT,
  16789.                 dbStatoResOut,
  16790.                 true);
  16791.         if(this.core.isTracciamentoDatabaseRispostaConsegnataSelectEnabled()) {
  16792.             addTransazioniStatoElement(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO_RES_OUT_COMPLETE,
  16793.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE,
  16794.                     !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato), // hidden
  16795.                     ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE,
  16796.                     dbStatoResOutComplete,
  16797.                     false);
  16798.         }
  16799.         else {
  16800.             de = new DataElement();
  16801.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_STATO_RES_OUT_COMPLETE);
  16802.             de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE);
  16803.             boolean hidden = !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato);
  16804.             if(StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato)) {
  16805.                 dbStatoResOutComplete = org.openspcoop2.core.config.constants.StatoFunzionalita.ABILITATO.getValue();
  16806.             }
  16807.             if(hidden) {
  16808.                 de.setType(DataElementType.HIDDEN);
  16809.             }
  16810.             else {
  16811.                 de.setType(DataElementType.TEXT);
  16812.             }
  16813.             de.setValue(dbStatoResOutComplete);
  16814.             dati.add(de);
  16815.         }
  16816.        
  16817.         de = new DataElement();
  16818.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_DATABASE_FILTRA_ESITI);
  16819.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_FILTRA_ESITI);
  16820.         if(StatoFunzionalitaConPersonalizzazione.DISABILITATO.getValue().equals(dbStato) ||
  16821.                 (StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(dbStato) &&
  16822.                         (StatoFunzionalitaBloccante.ABILITATO.getValue().equals(dbStatoReqIn) || StatoFunzionalitaBloccante.NON_BLOCCANTE.getValue().equals(dbStatoReqIn)))) {
  16823.             de.setType(DataElementType.HIDDEN);
  16824.             de.setValue(null);
  16825.         }
  16826.         else {
  16827.             de.setType(DataElementType.CHECKBOX);
  16828.             de.setValoreDefaultCheckbox(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_FILTRA_ESITI);
  16829.             de.setSelected(dbFiltroEsiti);
  16830.         }
  16831.         de.setPostBack_viaPOST(true);
  16832.         dati.add(de);
  16833.        
  16834.         /**this.impostaAperturaTitle(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE);*/
  16835.        
  16836.        
  16837.         // FILETRACE
  16838.        
  16839.         de = new DataElement();
  16840.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE);
  16841.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE);
  16842.         de.setType(DataElementType.SUBTITLE);
  16843.         /**de.setStatoAperturaSezioni(STATO_APERTURA_SEZIONI.CHIUSO);*/
  16844.         dati.add(de);
  16845.        
  16846.         // stato abilitazione
  16847.         addTransazioniStatoElement(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_STATO,
  16848.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO,
  16849.                 false,
  16850.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO,
  16851.                 fsStato,
  16852.                 true,
  16853.                 true,
  16854.                 !porta);
  16855.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_STATO_REQ_IN,
  16856.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_IN,
  16857.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(fsStato), // hidden
  16858.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_IN,
  16859.                 fsStatoReqIn,
  16860.                 true);
  16861.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_STATO_REQ_OUT,
  16862.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_OUT,
  16863.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(fsStato), // hidden
  16864.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_OUT,
  16865.                 fsStatoReqOut,
  16866.                 true);
  16867.         addTransazioniStatoElementBloccante(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_STATO_RES_OUT,
  16868.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT,
  16869.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(fsStato), // hidden
  16870.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT,
  16871.                 fsStatoResOut,
  16872.                 true);
  16873.         addTransazioniStatoElement(dati, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_STATO_RES_OUT_COMPLETE,
  16874.                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT_COMPLETE,
  16875.                 !StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(fsStato), // hidden
  16876.                 ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT_COMPLETE,
  16877.                 fsStatoResOutComplete,
  16878.                 false);
  16879.        
  16880.         de = new DataElement();
  16881.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_AVANZATA_FILETRACE_FILTRA_ESITI);
  16882.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_FILTRA_ESITI);
  16883.         if(StatoFunzionalitaConPersonalizzazione.DISABILITATO.getValue().equals(fsStato) ||
  16884.                 (StatoFunzionalitaConPersonalizzazione.PERSONALIZZATO.getValue().equals(fsStato) &&
  16885.                         (StatoFunzionalitaBloccante.ABILITATO.getValue().equals(fsStatoReqIn) || StatoFunzionalitaBloccante.NON_BLOCCANTE.getValue().equals(fsStatoReqIn)))) {
  16886.             de.setType(DataElementType.HIDDEN);
  16887.             de.setValue(null);
  16888.         }
  16889.         else {
  16890.             de.setType(DataElementType.CHECKBOX);
  16891.             de.setValoreDefaultCheckbox(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_FILTRA_ESITI);
  16892.             de.setSelected(fsFiltroEsiti);
  16893.         }
  16894.         de.setPostBack_viaPOST(true);
  16895.         dati.add(de);
  16896.        
  16897.         /**this.impostaAperturaTitle(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE);*/
  16898.     }
  16899.     private void addTransazioniStatoElement(List<DataElement> dati, String label, String name, boolean hidden, String defaultValue, String value, boolean postback) {
  16900.         addTransazioniStatoElement(dati, label, name, hidden, defaultValue, value, postback, false, false, false);
  16901.     }
  16902.     private void addTransazioniStatoElementBloccante(List<DataElement> dati, String label, String name, boolean hidden, String defaultValue, String value, boolean postback) {
  16903.         addTransazioniStatoElement(dati, label, name, hidden, defaultValue, value, postback, false, false, true);
  16904.     }
  16905.     private void addTransazioniStatoElement(List<DataElement> dati, String label, String name, boolean hidden, String defaultValue, String value, boolean postback,
  16906.             boolean personalizzato, boolean configurazioneEsterna) {
  16907.         addTransazioniStatoElement(dati, label, name, hidden, defaultValue, value, postback,
  16908.                 personalizzato, configurazioneEsterna, false);
  16909.     }
  16910.     private void addTransazioniStatoElement(List<DataElement> dati, String label, String name, boolean hidden, String defaultValue, String value, boolean postback,
  16911.             boolean personalizzato, boolean configurazioneEsterna, boolean bloccante) {
  16912.        
  16913.         List<String> values = new ArrayList<>();
  16914.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
  16915.         if(bloccante) {
  16916.             values.add(ConfigurazioneCostanti.DEFAULT_VALUE_NON_BLOCCANTE);
  16917.         }
  16918.         values.add(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);  
  16919.         if(personalizzato) {
  16920.             values.add(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO);
  16921.         }
  16922.         if(configurazioneEsterna) {
  16923.             values.add(ConfigurazioneCostanti.TRACCIAMENTO_ESITI_CONFIGURAZIONE_ESTERNA);
  16924.         }
  16925.        
  16926.         List<String> labels = null;
  16927.         if(bloccante) {
  16928.             labels = new ArrayList<>();
  16929.             labels.add(CostantiLabel.LABEL_ABILITATO_BLOCCANTE);
  16930.             labels.add(CostantiLabel.LABEL_ABILITATO_NON_BLOCCANTE);
  16931.             labels.add(CostantiLabel.LABEL_DISABILITATO);
  16932.         }
  16933.        
  16934.         DataElement de = new DataElement();
  16935.         de.setLabel(label);
  16936.         de.setName(name);
  16937.         if(hidden) {
  16938.             de.setType(DataElementType.HIDDEN);
  16939.             de.setValue(value);
  16940.         }
  16941.         else {
  16942.             de.setType(DataElementType.SELECT);
  16943.             de.setValues(values);
  16944.             if(labels!=null) {
  16945.                 de.setLabels(labels);
  16946.             }
  16947.             de.setValoreDefaultSelect(defaultValue);
  16948.             de.setPostBack_viaPOST(postback);
  16949.             de.setSelected(value);
  16950.         }
  16951.         dati.add(de);
  16952.     }
  16953.    
  16954.     public void addSeveritaMessaggiDiagnosticiToDati(String severita, String severita_log4j, List<DataElement> dati) {
  16955.        
  16956.         DataElement de;
  16957.         de = new DataElement();
  16958.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MESSAGGI_DIAGNOSTICI);
  16959.         de.setType(DataElementType.TITLE);
  16960.         dati.add(de);

  16961.         //                  String[] tipoMsg = { "off", "fatalOpenspcoop", "errorSpcoop", "errorOpenspcoop", "infoSpcoop", "infoOpenspcoop",
  16962.         //                          "debugLow", "debugMedium", "debugHigh", "all" };
  16963.         String[] tipoMsg = { LogLevels.LIVELLO_OFF, LogLevels.LIVELLO_FATAL, LogLevels.LIVELLO_ERROR_PROTOCOL, LogLevels.LIVELLO_ERROR_INTEGRATION,
  16964.                 LogLevels.LIVELLO_INFO_PROTOCOL, LogLevels.LIVELLO_INFO_INTEGRATION,
  16965.                 LogLevels.LIVELLO_DEBUG_LOW, LogLevels.LIVELLO_DEBUG_MEDIUM, LogLevels.LIVELLO_DEBUG_HIGH,
  16966.                 LogLevels.LIVELLO_ALL};
  16967.         de = new DataElement();
  16968.         de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  16969.         //      de.setLabel("Livello Severita");
  16970.         de.setType(DataElementType.SELECT);
  16971.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  16972.         de.setValues(tipoMsg);
  16973.         de.setSelected(severita);
  16974.         dati.add(de);

  16975.         de = new DataElement();
  16976.         //      de.setLabel("Livello Severita Log4J");
  16977.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
  16978.         de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
  16979.         if(this.core.isVisualizzazioneConfigurazioneDiagnosticaLog4J()){
  16980.             de.setType(DataElementType.SELECT);
  16981.             de.setValues(tipoMsg);
  16982.             de.setSelected(severita_log4j);
  16983.         }
  16984.         else{
  16985.             de.setType(DataElementType.HIDDEN);
  16986.             de.setValue(severita_log4j);
  16987.         }
  16988.         dati.add(de);
  16989.        
  16990.     }
  16991.    
  16992.     public void addPortaSeveritaMessaggiDiagnosticiToDati(String stato, String severita, List<DataElement> dati) {
  16993.        
  16994.         DataElement de;
  16995.         de = new DataElement();
  16996.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MESSAGGI_DIAGNOSTICI);
  16997.         de.setType(DataElementType.TITLE);
  16998.         dati.add(de);

  16999.         de = new DataElement();
  17000.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_STATO);
  17001.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_RIDEFINITO);
  17002.         de.setType(DataElementType.SELECT);
  17003.         String valuesStato [] = {CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO};
  17004.         String labelsStato [] = {CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_DEFAULT, CostantiControlStation.LABEL_PARAMETRO_DUMP_STATO_RIDEFINITO};
  17005.         de.setSelected(stato);
  17006.         de.setLabels(labelsStato);
  17007.         de.setValues(valuesStato);
  17008.         de.setPostBack(true);
  17009.         dati.add(de);
  17010.        
  17011.         //                  String[] tipoMsg = { "off", "fatalOpenspcoop", "errorSpcoop", "errorOpenspcoop", "infoSpcoop", "infoOpenspcoop",
  17012.         //                          "debugLow", "debugMedium", "debugHigh", "all" };
  17013.         if(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO.equals(stato)) {
  17014.             String[] tipoMsg = { LogLevels.LIVELLO_OFF, LogLevels.LIVELLO_FATAL, LogLevels.LIVELLO_ERROR_PROTOCOL, LogLevels.LIVELLO_ERROR_INTEGRATION,
  17015.                     LogLevels.LIVELLO_INFO_PROTOCOL, LogLevels.LIVELLO_INFO_INTEGRATION,
  17016.                     LogLevels.LIVELLO_DEBUG_LOW, LogLevels.LIVELLO_DEBUG_MEDIUM, LogLevels.LIVELLO_DEBUG_HIGH,
  17017.                     LogLevels.LIVELLO_ALL};
  17018.             de = new DataElement();
  17019.             de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  17020.             //      de.setLabel("Livello Severita");
  17021.             de.setType(DataElementType.SELECT);
  17022.             de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  17023.             de.setValues(tipoMsg);
  17024.             de.setSelected(severita);
  17025.             dati.add(de);
  17026.         }
  17027.        
  17028.     }

  17029.     public List<DataElement> configurazioneCambiaNome(List<DataElement> dati, TipoOperazione other, String nomeGruppo,boolean isPortaDelegata) throws DriverControlStationException{
  17030.          
  17031.         DataElement de = new DataElement();
  17032.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_NOME_GRUPPO);
  17033.         de.setType(DataElementType.TITLE);
  17034.         dati.add(de);
  17035.        
  17036.         // Azione
  17037.         de = new DataElement();
  17038.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  17039.         de.setType(DataElementType.TEXT_EDIT);
  17040.         de.setName(CostantiControlStation.PARAMETRO_NOME_GRUPPO);
  17041.         de.setValue(nomeGruppo);  
  17042.         de.setRequired(true);
  17043.         dati.add(de);
  17044.        
  17045.         return dati;
  17046.     }
  17047.    
  17048.     public boolean configurazioneCambiaNomeCheck(TipoOperazione other, String nomeGruppo, List<String> listaNomiGruppiOccupati,boolean isPortaDelegata) throws DriverControlStationException{
  17049.         if(StringUtils.isEmpty(nomeGruppo)) {
  17050.             this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NOME_GRUPPO_NON_PUO_ESSERE_VUOTA);
  17051.             return false;
  17052.         }
  17053.        
  17054.         for (String nomeOccupato : listaNomiGruppiOccupati) {
  17055.             if(nomeOccupato.equalsIgnoreCase(nomeGruppo)) {
  17056.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NOME_GRUPPO_GIA_PRESENTE);
  17057.                 return false;          
  17058.             }
  17059.         }
  17060.        
  17061.         return true;
  17062.     }

  17063.     public DataElement getDataElementNotCorrelazioneApplicativa() {
  17064.         DataElement de = new DataElement();
  17065.         de.setLabel(CostantiControlStation.LABEL_PORTE_CORRELAZIONE_APPLICATIVA_ATTENZIONE);
  17066.         de.setBold(true);
  17067.         de.setValue(CostantiControlStation.getLABEL_PORTE_CORRELAZIONE_APPLICATIVA_ATTENZIONE_MESSAGGIO(this.core.getPortaCorrelazioneApplicativaMaxLength()));
  17068.         de.setType(DataElementType.NOTE);
  17069.         return de;
  17070.     }

  17071.    
  17072.     public static String normalizeLabel(String label, int maxWidth) {
  17073.         if(label.length() > maxWidth) {
  17074.             return label.substring(0, maxWidth - 3) + "...";
  17075.         }
  17076.         return label;
  17077.     }
  17078.    
  17079.     public void addConfigurazioneCorsPorteToDati(TipoOperazione tipoOperazione,List<DataElement> dati, boolean showStato, String statoCorsPorta, boolean corsStato, TipoGestioneCORS corsTipo,
  17080.             boolean corsAllAllowOrigins, boolean corsAllAllowHeaders, boolean corsAllAllowMethods,
  17081.             String corsAllowHeaders, String corsAllowOrigins, String corsAllowMethods,
  17082.             boolean corsAllowCredential, String corsExposeHeaders, boolean corsMaxAge, int corsMaxAgeSeconds) throws DriverControlStationException {
  17083.        
  17084.         if(showStato) {
  17085.             DataElement de = new DataElement();
  17086.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_CORS);
  17087.             de.setType(DataElementType.TITLE);
  17088.             dati.add(de);
  17089.         }
  17090.        
  17091.         // stato generale cors
  17092.         DataElement de = new DataElement();
  17093.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_STATO_PORTA);
  17094.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CORS_STATO_PORTA);
  17095.         if(showStato) {
  17096.             try {
  17097.                 de.setType(DataElementType.SELECT);
  17098.                 String valuesStato [] = {CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_RIDEFINITO};
  17099.                 String labelsStato [] = { this.getGestioneCorsLabelDefault(true), CostantiControlStation.LABEL_PARAMETRO_CORS_STATO_PORTA_RIDEFINITO};
  17100.                 de.setSelected(statoCorsPorta);
  17101.                 de.setLabels(labelsStato);
  17102.                 de.setValues(valuesStato);
  17103.                 de.setPostBack(true);
  17104.             }catch(Exception e) {
  17105.                 throw new DriverControlStationException(e.getMessage(),e);
  17106.             }
  17107.         } else {
  17108.             de.setType(DataElementType.HIDDEN);
  17109.             de.setValue(statoCorsPorta);
  17110.         }
  17111.         dati.add(de);
  17112.        
  17113.         if(!showStato || statoCorsPorta.equals(CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_RIDEFINITO)) {
  17114.             this.addConfigurazioneCorsToDati(dati, corsStato, corsTipo,
  17115.                     corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
  17116.                     corsAllowHeaders, corsAllowOrigins, corsAllowMethods,
  17117.                     corsAllowCredential, corsExposeHeaders, corsMaxAge, corsMaxAgeSeconds,
  17118.                     false,
  17119.                     false);
  17120.         }
  17121.     }
  17122.            
  17123.    
  17124.     // CORS
  17125.     public void addConfigurazioneCorsToDati(List<DataElement> dati, boolean corsStato, TipoGestioneCORS corsTipo,
  17126.             boolean corsAllAllowOrigins, boolean corsAllAllowHeaders, boolean corsAllAllowMethods,
  17127.             String corsAllowHeaders, String corsAllowOrigins, String corsAllowMethods,
  17128.             boolean corsAllowCredential, String corsExposeHeaders, boolean corsMaxAge, int corsMaxAgeSeconds,
  17129.             boolean addTitle,
  17130.             boolean allHidden) {
  17131.        
  17132.         DataElement de;
  17133.         if(!allHidden && addTitle) {
  17134.             de = new DataElement();
  17135.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_CORS);
  17136.             de.setType(DataElementType.TITLE);
  17137.             dati.add(de);
  17138.         }
  17139.        
  17140.         de = new DataElement();
  17141.         de.setLabel(addTitle ? CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_STATO : "");
  17142.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_STATO);
  17143.         if(allHidden) {
  17144.             de.setType(DataElementType.HIDDEN);
  17145.         }
  17146.         else {
  17147.             de.setType(DataElementType.SELECT);
  17148.             de.setPostBack(true);
  17149.             de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  17150.             de.setSelected(corsStato ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
  17151.         }
  17152.         de.setValue(corsStato ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
  17153.         dati.add(de);
  17154.        
  17155.         if(corsStato) {
  17156.            
  17157.             de = new DataElement();
  17158.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_TIPO);
  17159.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_TIPO);
  17160.             de.setValue(corsTipo.getValue());
  17161.             if(allHidden) {
  17162.                 de.setType(DataElementType.HIDDEN);
  17163.             }
  17164.             else if(
  17165.                     TipoGestioneCORS.TRASPARENTE.equals(corsTipo) // impostato in avanzato
  17166.                     ||
  17167.                     !this.isModalitaStandard()
  17168.                     ) {
  17169.            
  17170.                 String [] corsTipiValues = new String [] { TipoGestioneCORS.GATEWAY.getValue(), TipoGestioneCORS.TRASPARENTE.getValue()};
  17171.                 String [] corsTipiLabels = new String [] {
  17172.                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_TIPO_GESTITO_GATEWAY,
  17173.                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_TIPO_GESTITO_APPLICATIVO
  17174.                         };
  17175.                 de.setType(DataElementType.SELECT);
  17176.                 de.setPostBack(true);
  17177.                 de.setValues(corsTipiValues);
  17178.                 de.setLabels(corsTipiLabels);
  17179.                 de.setSelected(corsTipo.getValue());
  17180.             }
  17181.             else {
  17182.                 de.setType(DataElementType.HIDDEN);
  17183.             }
  17184.             dati.add(de);
  17185.            
  17186.             if(TipoGestioneCORS.GATEWAY.equals(corsTipo)) {
  17187.                
  17188.                 if(!allHidden) {
  17189.                     de = new DataElement();
  17190.                     de.setType(DataElementType.SUBTITLE);
  17191.                     de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_CORS_ACCESS_CONTROL);
  17192.                     dati.add(de);
  17193.                 }
  17194.                
  17195.                
  17196.                 de = new DataElement();
  17197.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS);
  17198.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS);
  17199.                 if(allHidden) {
  17200.                     de.setType(DataElementType.HIDDEN);
  17201.                 }
  17202.                 else {
  17203.                     de.setType(DataElementType.CHECKBOX);
  17204.                     de.setSelected(corsAllAllowOrigins);
  17205.                     de.setPostBack(true);
  17206.                 }
  17207.                 de.setValue(corsAllAllowOrigins+"");
  17208.                 dati.add(de);
  17209.                
  17210.                 if(!corsAllAllowOrigins) {
  17211.                     de = new DataElement();
  17212.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS);
  17213.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS);
  17214.                     if(allHidden) {
  17215.                         de.setType(DataElementType.HIDDEN);
  17216.                     }else {
  17217.                         de.setType(DataElementType.TEXT_EDIT);
  17218.                         de.setRequired(true);
  17219.                         de.enableTags();
  17220.                     }
  17221.                     de.setValue(corsAllowOrigins);
  17222.                     dati.add(de);
  17223.                 }
  17224.                 else {
  17225.                     corsAllAllowMethods = false;
  17226.                     corsAllAllowHeaders = false;
  17227.                 }
  17228.                                        
  17229.                 de = new DataElement();
  17230.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_METHODS);
  17231.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_METHODS);
  17232.                 if(allHidden || corsAllAllowOrigins) {
  17233.                     de.setType(DataElementType.HIDDEN);
  17234.                 }
  17235.                 else {
  17236.                     de.setType(DataElementType.CHECKBOX);
  17237.                     de.setSelected(corsAllAllowMethods);
  17238.                     de.setPostBack(true);
  17239.                 }
  17240.                 de.setValue(corsAllAllowMethods+"");
  17241.                 dati.add(de);
  17242.                
  17243.                 if(!corsAllAllowMethods || corsAllAllowOrigins) {
  17244.                     de = new DataElement();
  17245.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS);
  17246.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS);
  17247.                     if(allHidden) {
  17248.                         de.setType(DataElementType.HIDDEN);
  17249.                     }else {
  17250.                         de.setType(DataElementType.TEXT_EDIT);
  17251.                         de.setRequired(true);
  17252.                         de.enableTags();
  17253.                     }
  17254.                     de.setValue(corsAllowMethods);
  17255.                     dati.add(de);
  17256.                 }
  17257.                            
  17258.                 de = new DataElement();
  17259.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_HEADERS);
  17260.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_HEADERS);
  17261.                 if(allHidden || corsAllAllowOrigins) {
  17262.                     de.setType(DataElementType.HIDDEN);
  17263.                 }
  17264.                 else {
  17265.                     de.setType(DataElementType.CHECKBOX);
  17266.                     de.setSelected(corsAllAllowHeaders);
  17267.                     de.setPostBack(true);
  17268.                 }
  17269.                 de.setValue(corsAllAllowHeaders+"");
  17270.                 dati.add(de);
  17271.                
  17272.                 if(!corsAllAllowHeaders || corsAllAllowOrigins) {
  17273.                     de = new DataElement();
  17274.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS);
  17275.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS);
  17276.                     if(allHidden) {
  17277.                         de.setType(DataElementType.HIDDEN);
  17278.                     }else {
  17279.                         de.setType(DataElementType.TEXT_EDIT);
  17280.                         de.setRequired(true);
  17281.                         de.enableTags();
  17282.                     }
  17283.                     de.setValue(corsAllowHeaders);
  17284.                     dati.add(de);
  17285.                 }
  17286.                
  17287.                 de = new DataElement();
  17288.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_CREDENTIALS);
  17289.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_CREDENTIALS);
  17290.                 if(allHidden) {
  17291.                     de.setType(DataElementType.HIDDEN);
  17292.                 }else {
  17293.                     de.setType(DataElementType.CHECKBOX);
  17294.                     de.setSelected(corsAllowCredential);
  17295.                 }
  17296.                 de.setValue(corsAllowCredential+"");
  17297.                 dati.add(de);
  17298.                
  17299.                 de = new DataElement();
  17300.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_EXPOSE_HEADERS);
  17301.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_EXPOSE_HEADERS);
  17302.                 if(allHidden) {
  17303.                     de.setType(DataElementType.HIDDEN);
  17304.                 }else {
  17305.                     de.setType(DataElementType.TEXT_EDIT);
  17306.                     de.enableTags();
  17307.                 }
  17308.                 de.setValue(corsExposeHeaders);
  17309.                 dati.add(de);
  17310.                
  17311.                
  17312.                 de = new DataElement();
  17313.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE);
  17314.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE);
  17315.                 //if(allHidden || this.isModalitaStandard()) {
  17316.                 if(allHidden) {
  17317.                     de.setType(DataElementType.HIDDEN);
  17318.                 }else {
  17319.                     de.setType(DataElementType.CHECKBOX);
  17320.                     de.setSelected(corsMaxAge);
  17321.                     de.setPostBack(true);
  17322.                 }
  17323.                 de.setValue(corsMaxAge+"");
  17324.                 dati.add(de);
  17325.                
  17326.                 if(corsMaxAge) {
  17327.                     de = new DataElement();
  17328.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE_SECONDS);
  17329.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE_SECONDS);
  17330.                     de.setValue(corsMaxAgeSeconds+"");
  17331.                     //if(allHidden || this.isModalitaStandard()) {
  17332.                     if(allHidden) {
  17333.                         de.setType(DataElementType.HIDDEN);
  17334.                     }else {
  17335.                         de.setType(DataElementType.NUMBER);
  17336.                         de.setMinValue(-1);
  17337.                         de.setMaxValue(Integer.MAX_VALUE);
  17338.                         de.setNote(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE_SECONDS_NOTE);
  17339.                     }
  17340.                     dati.add(de);
  17341.                 }
  17342.             }
  17343.         }
  17344.     }
  17345.    
  17346.     public CorsConfigurazione getGestioneCors(boolean corsStato, TipoGestioneCORS corsTipo,
  17347.             boolean corsAllAllowOrigins, boolean corsAllAllowHeaders, boolean corsAllAllowMethods,
  17348.             String corsAllowHeaders, String corsAllowOrigins, String corsAllowMethods, boolean corsAllowCredential,
  17349.             String corsExposeHeaders, boolean corsMaxAge, int corsMaxAgeSeconds) {
  17350.         CorsConfigurazione gestioneCors = new CorsConfigurazione();
  17351.         gestioneCors.setStato(corsStato ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  17352.         if(corsStato) {
  17353.             gestioneCors.setTipo(corsTipo);

  17354.             if(corsTipo.equals(TipoGestioneCORS.GATEWAY)) {
  17355.                 gestioneCors.setAccessControlAllAllowOrigins(corsAllAllowOrigins ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  17356.                 if(!corsAllAllowOrigins) {
  17357.                     CorsConfigurazioneOrigin accessControlAllowOrigins = new CorsConfigurazioneOrigin();
  17358.                     accessControlAllowOrigins.setOriginList(Arrays.asList(corsAllowOrigins.split(",")));
  17359.                     gestioneCors.setAccessControlAllowOrigins(accessControlAllowOrigins );
  17360.                 }

  17361.                 gestioneCors.setAccessControlAllAllowHeaders(corsAllAllowHeaders ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  17362.                 if(!corsAllAllowHeaders) {
  17363.                     CorsConfigurazioneHeaders accessControlAllowHeaders = new CorsConfigurazioneHeaders();
  17364.                     accessControlAllowHeaders.setHeaderList(Arrays.asList(corsAllowHeaders.split(",")));
  17365.                     gestioneCors.setAccessControlAllowHeaders(accessControlAllowHeaders);
  17366.                 }
  17367.                
  17368.                 gestioneCors.setAccessControlAllAllowMethods(corsAllAllowMethods ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  17369.                 if(!corsAllAllowMethods) {
  17370.                     CorsConfigurazioneMethods accessControlAllowMethods = new CorsConfigurazioneMethods();
  17371.                     accessControlAllowMethods.setMethodList(Arrays.asList(corsAllowMethods.split(",")));
  17372.                     gestioneCors.setAccessControlAllowMethods(accessControlAllowMethods);
  17373.                 }

  17374.                 gestioneCors.setAccessControlAllowCredentials(corsAllowCredential ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);

  17375.                 CorsConfigurazioneHeaders accessControlExposeHeaders = new CorsConfigurazioneHeaders();
  17376.                 accessControlExposeHeaders.setHeaderList(Arrays.asList(corsExposeHeaders.split(",")));
  17377.                 gestioneCors.setAccessControlExposeHeaders(accessControlExposeHeaders );

  17378.                 gestioneCors.setAccessControlMaxAge(corsMaxAge ? corsMaxAgeSeconds : null);
  17379.             }
  17380.         }
  17381.         return gestioneCors;
  17382.     }
  17383.    
  17384.     public boolean checkDataConfigurazioneCorsPorta(TipoOperazione tipoOperazione,boolean showStato, String statoCorsPorta) throws DriverControlStationException{
  17385.        
  17386.         if(showStato) {
  17387.             if(StringUtils.isEmpty(statoCorsPorta) || !(statoCorsPorta.equals(CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_DEFAULT) || statoCorsPorta.equals(CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_RIDEFINITO))) {
  17388.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO, CostantiControlStation.LABEL_PARAMETRO_CORS_STATO_PORTA));
  17389.                 return false;
  17390.             }
  17391.         }
  17392.        
  17393.         if(!showStato || statoCorsPorta.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  17394.             return this.checkDataCors();
  17395.         }
  17396.        
  17397.         return true;
  17398.     }
  17399.    
  17400.     public boolean checkDataURLInvocazione() throws DriverControlStationException {
  17401.        
  17402.         String urlInvocazionePA = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA);
  17403.        
  17404.         if(StringUtils.isEmpty(urlInvocazionePA)){
  17405.             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA));
  17406.             return false;
  17407.         }
  17408.        
  17409.         if(urlInvocazionePA.contains(" ")) {
  17410.             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA));  
  17411.             return false;
  17412.         }
  17413.        
  17414.         if(!this.checkLength(urlInvocazionePA, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA, 1, 255)) {
  17415.             return false;
  17416.         }
  17417.        
  17418.         try{
  17419.             org.openspcoop2.utils.regexp.RegExpUtilities.validateUrl(urlInvocazionePA);
  17420.         }catch(Exception e){
  17421.             this.pd.setMessage(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA + " non correttamente formata: "+e.getMessage());
  17422.             return false;
  17423.         }
  17424.        
  17425.         String urlInvocazionePD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD);
  17426.        
  17427.         /*
  17428.         if(StringUtils.isEmpty(urlInvocazionePD)){
  17429.             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD));
  17430.             return false;
  17431.         }
  17432.         */
  17433.         if(!StringUtils.isEmpty(urlInvocazionePD)){
  17434.             if(urlInvocazionePD.contains(" ")) {
  17435.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD));  
  17436.                 return false;
  17437.             }
  17438.            
  17439.             if(!this.checkLength(urlInvocazionePD, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD, 1, 255)) {
  17440.                 return false;
  17441.             }
  17442.        
  17443.             try{
  17444.                 org.openspcoop2.utils.regexp.RegExpUtilities.validateUrl(urlInvocazionePD);
  17445.             }catch(Exception e){
  17446.                 this.pd.setMessage(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD + " non correttamente formata: "+e.getMessage());
  17447.                 return false;
  17448.             }
  17449.         }
  17450.            
  17451.         return true;
  17452.     }
  17453.    
  17454.     public boolean checkDataCors() throws DriverControlStationException {
  17455.         String corsStatoTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_STATO);
  17456.         boolean corsStato = ServletUtils.isCheckBoxEnabled(corsStatoTmp);
  17457.         if(corsStato) {
  17458.             String corsTipoTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_TIPO);
  17459.             TipoGestioneCORS corsTipo = corsTipoTmp != null ? TipoGestioneCORS.toEnumConstant(corsTipoTmp) : TipoGestioneCORS.GATEWAY;
  17460.             if(corsTipo.equals(TipoGestioneCORS.GATEWAY)) {
  17461.                 String corsAllAllowOriginsTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS);
  17462.                 boolean corsAllAllowOrigins = ServletUtils.isCheckBoxEnabled(corsAllAllowOriginsTmp);
  17463.                 if(!corsAllAllowOrigins) {
  17464.                     String corsAllowOrigins =  this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS);
  17465.                     if(StringUtils.isNotEmpty(corsAllowOrigins)) {
  17466.                         List<String> asList = Arrays.asList(corsAllowOrigins.split(","));
  17467.                         for (String string : asList) {
  17468.                             if(string.contains(" ")) {
  17469.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS));  
  17470.                                 return false;
  17471.                             }
  17472.                         }
  17473.                     } else {
  17474.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_CAMPO_OBBLIGATORIO, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS));  
  17475.                         return false;
  17476.                     }
  17477.                 }
  17478.                
  17479.                 String corsAllAllowHeadersTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_HEADERS);
  17480.                 boolean corsAllAllowHeaders = ServletUtils.isCheckBoxEnabled(corsAllAllowHeadersTmp);
  17481.                 if(corsAllAllowHeaders && corsAllAllowOrigins) {
  17482.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_DIPENDENZA,
  17483.                             CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS,
  17484.                             CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_HEADERS));  
  17485.                     return false;
  17486.                 }
  17487.                 if(!corsAllAllowHeaders) {
  17488.                     String corsAllowHeaders =  this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS);
  17489.                     if(StringUtils.isNotEmpty(corsAllowHeaders)) {
  17490.                         List<String> asList = Arrays.asList(corsAllowHeaders.split(","));
  17491.                         for (String string : asList) {
  17492.                             if(string.contains(" ")) {
  17493.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS));  
  17494.                                 return false;
  17495.                             }
  17496.                         }
  17497.                     } else {
  17498.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_CAMPO_OBBLIGATORIO, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS));  
  17499.                         return false;
  17500.                     }
  17501.                 }
  17502.                
  17503.                 String corsAllAllowMethodsTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_METHODS);
  17504.                 boolean corsAllAllowMethods = ServletUtils.isCheckBoxEnabled(corsAllAllowMethodsTmp);
  17505.                 if(corsAllAllowMethods && corsAllAllowOrigins) {
  17506.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_DIPENDENZA,
  17507.                             CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS,
  17508.                             CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_METHODS));  
  17509.                     return false;
  17510.                 }
  17511.                 if(!corsAllAllowMethods) {
  17512.                     String corsAllowMethods =  this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS);
  17513.                     if(StringUtils.isNotEmpty(corsAllowMethods)) {
  17514.                         List<String> asList = Arrays.asList(corsAllowMethods.split(","));
  17515.                         for (String string : asList) {
  17516.                             if(string.contains(" ")) {
  17517.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS));  
  17518.                                 return false;
  17519.                             }
  17520.                            
  17521.                             try {
  17522.                                 // check che HTTP-Method sia supportato
  17523.                                 Enum.valueOf(HttpRequestMethod.class, string.toUpperCase());
  17524.                             } catch(Exception e) {
  17525.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_ALLOW_METHOD_NON_VALIDO, string, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS));  
  17526.                                 return false;
  17527.                             }
  17528.                         }
  17529.                     }else {
  17530.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_CAMPO_OBBLIGATORIO, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS));  
  17531.                         return false;
  17532.                     }
  17533.                 }
  17534.                
  17535. //              String corsAllowCredentialTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_CREDENTIALS);
  17536. //              boolean corsAllowCredential =  ServletUtils.isCheckBoxEnabled(corsAllowCredentialTmp);
  17537.                
  17538.                 String corsExposeHeaders = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_EXPOSE_HEADERS);
  17539.                 if(StringUtils.isNotEmpty(corsExposeHeaders)) {
  17540.                     List<String> asList = Arrays.asList(corsExposeHeaders.split(","));
  17541.                     for (String string : asList) {
  17542.                         if(string.contains(" ")) {
  17543.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CORS_EXPOSE_HEADERS));  
  17544.                             return false;
  17545.                         }
  17546.                     }
  17547.                 }
  17548.                
  17549.                
  17550. //              String corsMaxAgeTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE);
  17551. //              boolean corsMaxAge =  ServletUtils.isCheckBoxEnabled(corsMaxAgeTmp);
  17552. //              if(corsMaxAge) {
  17553. //                  String corsMaxAgeSecondsTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE_SECONDS);
  17554. //                  int corsMaxAgeSeconds = -1;
  17555. //                  if(corsMaxAgeSecondsTmp != null) {
  17556. //                      try {
  17557. //                          corsMaxAgeSeconds = Integer.parseInt(corsMaxAgeSecondsTmp);
  17558. //                      }catch(Exception e) {}
  17559. //                  }
  17560. //              }
  17561.             }
  17562.         }
  17563.         return true;
  17564.     }
  17565.    
  17566.     public void addDescrizioneVerificaConnettoreToDati(List<DataElement> dati, String server, String labelConnettore,
  17567.             Connettore connettore, boolean registro, String aliasConnettore) throws DriverControlStationException {
  17568.        
  17569.         List<Parameter> downloadCertServerParameters = new ArrayList<>();
  17570.        
  17571.         downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_ID_CONNETTORE, connettore.getId().longValue()+""));
  17572.        
  17573.         this.addDescrizioneVerificaConnettivitaToDati(dati, connettore,
  17574.                 server, false, aliasConnettore,
  17575.                 downloadCertServerParameters,
  17576.                 false, false);
  17577.        
  17578.     }
  17579.    
  17580.     public void addVerificaConnettoreSceltaAlias(List<String> aliases,List<DataElement> dati) throws DriverControlStationException {
  17581.        
  17582.         DataElement de = new DataElement();
  17583.         de.setType(DataElementType.SELECT);
  17584.         List<String> values = new ArrayList<>();
  17585.         List<String> labels = new ArrayList<>();
  17586.         values.add(CostantiControlStation.LABEL_VERIFICA_CONNETTORE_TUTTI_I_NODI);
  17587.         labels.add(CostantiControlStation.LABEL_VERIFICA_CONNETTORE_TUTTI_I_NODI);
  17588.         values.addAll(this.confCore.getJmxPdDAliases());
  17589.         for (String alias : this.confCore.getJmxPdDAliases()) {
  17590.             try {
  17591.                 labels.add(this.confCore.getJmxPdDDescrizione(alias));
  17592.             }catch(Exception e) {
  17593.                 throw new DriverControlStationException(e.getMessage(),e);
  17594.             }
  17595.         }
  17596.         de.setValues(values);
  17597.         de.setLabels(labels);
  17598.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
  17599.         de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
  17600.         de.setSize(this.getSize());
  17601.         //de.setPostBack(true);
  17602.         dati.add(de);
  17603.        
  17604.     }
  17605.    
  17606.     public void addVerificaConnettoreHidden(List<DataElement> dati,
  17607.             String id, String idsogg,  String idAsps, String idFruizione,
  17608.             long idConnettore, boolean accessoDaGruppi, boolean connettoreRegistro) throws DriverControlStationException {

  17609.         DataElement de = new DataElement();
  17610.         de.setType(DataElementType.HIDDEN);
  17611.         de.setName(CostantiControlStation.PARAMETRO_ID);
  17612.         de.setValue(id);
  17613.         dati.add(de);
  17614.        
  17615.         de = new DataElement();
  17616.         de.setType(DataElementType.HIDDEN);
  17617.         de.setName(CostantiControlStation.PARAMETRO_ID_SOGGETTO);
  17618.         de.setValue(idsogg);
  17619.         dati.add(de);
  17620.        
  17621.         de = new DataElement();
  17622.         de.setType(DataElementType.HIDDEN);
  17623.         de.setName(CostantiControlStation.PARAMETRO_ID_ASPS);
  17624.         de.setValue(idAsps);
  17625.         dati.add(de);
  17626.        
  17627.         de = new DataElement();
  17628.         de.setType(DataElementType.HIDDEN);
  17629.         de.setName(CostantiControlStation.PARAMETRO_ID_FRUIZIONE);
  17630.         de.setValue(idFruizione);
  17631.         dati.add(de);
  17632.        
  17633.         de = new DataElement();
  17634.         de.setType(DataElementType.HIDDEN);
  17635.         de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ID);
  17636.         de.setValue(idConnettore+"");
  17637.         dati.add(de);
  17638.        
  17639.         de = new DataElement();
  17640.         de.setType(DataElementType.HIDDEN);
  17641.         de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  17642.         de.setValue(accessoDaGruppi+"");
  17643.         dati.add(de);
  17644.        
  17645.         de = new DataElement();
  17646.         de.setType(DataElementType.HIDDEN);
  17647.         de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  17648.         de.setValue(connettoreRegistro+"");
  17649.         dati.add(de);
  17650.        
  17651.     }
  17652.    
  17653.     public boolean isConnettoreRidefinito(PortaApplicativa paDefault,   PortaApplicativaServizioApplicativo paSADefault,
  17654.             PortaApplicativa paCurrent, PortaApplicativaServizioApplicativo paSACurrent,
  17655.             List<PortaApplicativaServizioApplicativo> list_paSACurrent) throws DriverControlStationException {
  17656.        
  17657.         if(paDefault==null) {
  17658.             throw new DriverControlStationException("Param paDefault is null");
  17659.         }
  17660.         if(paCurrent==null) {
  17661.             throw new DriverControlStationException("Param paCurrent is null");
  17662.         }
  17663.        
  17664.         boolean connettoreRidefinito = (
  17665.                 (
  17666.                     paDefault.getServizioApplicativoDefault() == null && (paCurrent.getServizioApplicativoDefault() != null || paSACurrent.getNome().equals(paCurrent.getNome()))
  17667.                 ) || (
  17668.                     paDefault.getServizioApplicativoDefault() != null &&
  17669.                         (
  17670.                             paCurrent.getServizioApplicativoDefault() == null
  17671.                             ||
  17672.                             !paDefault.getServizioApplicativoDefault().equals(paCurrent.getServizioApplicativoDefault())
  17673.                             ||
  17674.                             paDefault.sizeServizioApplicativoList()!=paCurrent.sizeServizioApplicativoList()
  17675.                             ||
  17676.                             (paDefault.sizeServizioApplicativoList()==1 && paCurrent.sizeServizioApplicativoList()==1 && !paDefault.getServizioApplicativo(0).getNome().equals(paCurrent.getServizioApplicativo(0).getNome()))
  17677.                         )
  17678.                     //!paSADefault.getNome().equals(paSACurrent.getNome()))
  17679.                 )
  17680.             );
  17681.         if(!connettoreRidefinito) {
  17682.             boolean connettoreMultiploEnabled = paCurrent.getBehaviour() != null;
  17683.             if(connettoreMultiploEnabled && paDefault.getServizioApplicativoDefault() == null && paCurrent.getServizioApplicativoDefault() == null) {
  17684.                 if(list_paSACurrent!=null && !list_paSACurrent.isEmpty() && list_paSACurrent.size()>1) { // se uguale a 1 si rientra nel primo caso sopra, altrimenti l'ordine potrebbe cambiare e non essere alla posizione 0 quello di default
  17685.                     for (PortaApplicativaServizioApplicativo portaApplicativaServizioApplicativo : list_paSACurrent) {
  17686.                         if(portaApplicativaServizioApplicativo.getNome().equals(paCurrent.getNome())){
  17687.                             connettoreRidefinito = true;
  17688.                             break;
  17689.                         }
  17690.                     }
  17691.                 }
  17692.             }
  17693.         }
  17694.         return connettoreRidefinito;
  17695.     }
  17696.    
  17697.     public String getTooltipConnettore(ServizioApplicativo sa, org.openspcoop2.core.config.InvocazioneServizio is, boolean addExtInfo) throws DriverControlStationException {
  17698.        
  17699.         if(sa==null) {
  17700.             throw new DriverControlStationException("Param sa is null");
  17701.         }
  17702.        
  17703.         StringBuilder sbCon = new StringBuilder();
  17704.         if(ServiziApplicativiCostanti.VALUE_SERVIZI_APPLICATIVI_TIPO_SERVER.equals(sa.getTipo())) {
  17705.             sbCon.append(ConnettoriCostanti.LABEL_SERVER);
  17706.             sbCon.append(": ");
  17707.             sbCon.append(sa.getNome());
  17708.             sbCon.append(CostantiControlStation.TOOLTIP_BREAK_LINE);
  17709.         }
  17710.         sbCon.append(this.getLabelConnettore(is, addExtInfo, true));
  17711.         return sbCon.toString();
  17712.     }
  17713.    
  17714.     public String getClipBoardUrlConnettore(ServizioApplicativo sa, org.openspcoop2.core.config.InvocazioneServizio is) throws DriverControlStationException {
  17715.        
  17716.         if(sa==null) {
  17717.             throw new DriverControlStationException("Param sa is null");
  17718.         }
  17719.        
  17720.         StringBuilder sbCon = new StringBuilder();
  17721.         sbCon.append(this.getClipBoardUrlConnettore(is));
  17722.         return sbCon.toString();
  17723.     }
  17724.    
  17725.     public String getClipBoardUrlConnettore(org.openspcoop2.core.config.InvocazioneServizio is) throws DriverControlStationException {
  17726.        
  17727.         if(is==null) {
  17728.             throw new DriverControlStationException("Param is is null");
  17729.         }
  17730.        
  17731.         // la parte che aggiungeva MessageBox e' stata eliminata
  17732.         return this.getLabelConnettoreInternal(is.getConnettore(), false, false, false);
  17733.     }
  17734.     public String getClipBoardUrlConnettore(org.openspcoop2.core.registry.Connettore connettore) throws DriverControlStationException {
  17735.        
  17736.         if(connettore==null) {
  17737.             throw new DriverControlStationException("Param connettore is null");
  17738.         }
  17739.        
  17740.         return this.getLabelConnettoreInternal(connettore.mappingIntoConnettoreConfigurazione(), false, false, false);
  17741.     }
  17742.    
  17743.     public String getLabelConnettore(ServizioApplicativo sa, org.openspcoop2.core.config.InvocazioneServizio is, boolean addExtInfo) throws DriverControlStationException {
  17744.        
  17745.         if(sa==null) {
  17746.             throw new DriverControlStationException("Param sa is null");
  17747.         }
  17748.        
  17749.         StringBuilder sbCon = new StringBuilder();
  17750. //      if(ServiziApplicativiCostanti.VALUE_SERVIZI_APPLICATIVI_TIPO_SERVER.equals(sa.getTipo())) {
  17751. //          //sbCon.append(sa.getNome());
  17752. //          //sbCon.append(" ");
  17753. //      }
  17754.         sbCon.append(this.getLabelConnettore(is, addExtInfo, false));
  17755.         return sbCon.toString();
  17756.     }
  17757.    
  17758.     public String getLabelConnettore(org.openspcoop2.core.config.InvocazioneServizio is, boolean addExtInfo, boolean tooltip) throws DriverControlStationException {
  17759.        
  17760.         if(is==null) {
  17761.             throw new DriverControlStationException("Param is is null");
  17762.         }
  17763.        
  17764.         String urlConnettore = this.getLabelConnettore(is.getConnettore(), addExtInfo, tooltip);
  17765.        
  17766.         if(is.getGetMessage()!=null && StatoFunzionalita.ABILITATO.equals(is.getGetMessage())) {
  17767.             urlConnettore = urlConnettore + " [MessageBox]";
  17768.         }
  17769.        
  17770.         return urlConnettore;
  17771.     }
  17772.     public String getLabelConnettore(org.openspcoop2.core.registry.Connettore connettore, boolean addExtInfo, boolean tooltip) throws DriverControlStationException {
  17773.        
  17774.         if(connettore==null) {
  17775.             throw new DriverControlStationException("Param connettore is null");
  17776.         }
  17777.        
  17778.         return this.getLabelConnettore(connettore.mappingIntoConnettoreConfigurazione(), addExtInfo, tooltip);
  17779.     }
  17780.     public String getLabelConnettore(org.openspcoop2.core.config.Connettore connettore, boolean addExtInfo, boolean tooltip) throws DriverControlStationException {
  17781.         return getLabelConnettoreInternal(connettore, addExtInfo, tooltip, true);
  17782.     }
  17783.     private String getLabelConnettoreInternal(org.openspcoop2.core.config.Connettore connettore, boolean addExtInfo, boolean tooltip, boolean addPrefix) throws DriverControlStationException {
  17784.        
  17785.         if(connettore==null) {
  17786.             throw new DriverControlStationException("Param connettore is null");
  17787.         }
  17788.        
  17789.         String urlConnettore = "";
  17790.        
  17791.         List<org.openspcoop2.core.config.Property> cp = connettore.getPropertyList();
  17792.        
  17793.         //TipiConnettore.HTTP.getNome() e anche TipiConnettore.HTTPS.getNome() -> location
  17794.         //TipiConnettore.DISABILITATO.getNome() ci scrivi "disabilitato"
  17795.         //TipiConnettore.FILE.getNome() CostantiConnettori.CONNETTORE_FILE_REQUEST_OUTPUT_FILE
  17796.         //TipiConnettore.JMS.compareTo() CostantiConnettori.CONNETTORE_LOCATION
  17797. //          TipiConnettore.NULL
  17798. //          TipiConnettore.CUSTOM -> connettore custom
  17799.         String tipo = connettore.getTipo();
  17800.        
  17801.         TipiConnettore tipoC = TipiConnettore.toEnumFromName(connettore.getTipo());
  17802.         String labelC = connettore.getTipo();
  17803.         if(tipoC!=null) {
  17804.             labelC = tipoC.getLabel();
  17805.         }
  17806.         String tipoLabel = addPrefix ? "[" + labelC + "] " : "";
  17807.         if ((connettore.getCustom()!=null && connettore.getCustom()) &&
  17808.                 !connettore.getTipo().equals(CostantiDB.CONNETTORE_TIPO_HTTPS) &&
  17809.                 !connettore.getTipo().equals(CostantiDB.CONNETTORE_TIPO_FILE) &&
  17810.                 !connettore.getTipo().equals(CostantiDB.CONNETTORE_TIPO_STATUS)) {
  17811.             tipo = ConnettoriCostanti.DEFAULT_CONNETTORE_TYPE_CUSTOM;
  17812.         }  

  17813.         if(tipo.equals(ConnettoriCostanti.DEFAULT_CONNETTORE_TYPE_CUSTOM)) {
  17814.             if(this.connettoriCore.isConfigurazionePluginsEnabled()) {
  17815.                 tipoLabel = addPrefix ? "[" + TipiConnettore.CUSTOM.getLabel() + "] " : "";
  17816.                 Plugin plugin = null;
  17817.                 try {
  17818.                     plugin = this.confCore.getPlugin(TipoPlugin.CONNETTORE,connettore.getTipo(), false);
  17819.                 }catch(Throwable e) {
  17820.                     // ignore
  17821.                 }
  17822.                 if(plugin!=null) {
  17823.                     urlConnettore = tipoLabel + plugin.getLabel();
  17824.                 }
  17825.                 else {
  17826.                     // backward compatibility
  17827.                     urlConnettore = tipoLabel + connettore.getTipo();
  17828.                 }
  17829.             }
  17830.             else {
  17831.                 urlConnettore = tipoLabel + ConnettoriCostanti.LABEL_CONNETTORE_CUSTOM;
  17832.             }
  17833.         } else  if(tipo.equals(TipiConnettore.DISABILITATO.getNome())) {
  17834.             urlConnettore = CostantiControlStation.DEFAULT_VALUE_DISABILITATO;
  17835.         } else if(tipo.equals(TipiConnettore.NULL.getNome())) {
  17836.             urlConnettore = tipoLabel + ConnettoreNULL.LOCATION;
  17837.         } else if(tipo.equals(TipiConnettore.NULLECHO.getNome())) {
  17838.             urlConnettore = tipoLabel + ConnettoreNULLEcho.LOCATION;
  17839.         } else if(tipo.equals(TipiConnettore.STATUS.getNome())) {
  17840.             urlConnettore = tipoLabel + ConnettoreStatus.LOCATION;
  17841.         } else {  
  17842.             String propertyName = CostantiConnettori.CONNETTORE_LOCATION;
  17843.             if(tipo.equals(TipiConnettore.FILE.getNome()))
  17844.                 propertyName = CostantiConnettori.CONNETTORE_FILE_REQUEST_OUTPUT_FILE;
  17845.        
  17846.             // Prefix token
  17847.             String token = "";
  17848.             if(addExtInfo) {
  17849.                 if(tipo.equals(TipiConnettore.HTTP.getNome()) || tipo.equals(TipiConnettore.HTTPS.getNome())) {
  17850.                     for (int i = 0; i < connettore.sizePropertyList(); i++) {
  17851.                         org.openspcoop2.core.config.Property singlecp = cp.get(i);
  17852.                         if (singlecp.getNome().equals(CostantiConnettori.CONNETTORE_TOKEN_POLICY) &&
  17853.                                 singlecp.getValore()!=null && StringUtils.isNotEmpty(singlecp.getValore())) {
  17854.                             if(tooltip) {
  17855.                                 token = "[token: "+singlecp.getValore()+"]\n";
  17856.                             }
  17857.                             else {
  17858.                                 token = "[token] ";
  17859.                             }
  17860.                         }
  17861.                     }
  17862.                 }
  17863.             }
  17864.            
  17865.             for (int i = 0; i < connettore.sizePropertyList(); i++) {
  17866.                 org.openspcoop2.core.config.Property singlecp = cp.get(i);
  17867.                 if (singlecp.getNome().equals(propertyName)) {
  17868.                     if(!tipo.equals(TipiConnettore.HTTP.getNome()) && !tipo.equals(TipiConnettore.HTTPS.getNome())) {
  17869.                         urlConnettore = tipoLabel + singlecp.getValore();
  17870.                     }
  17871.                     else {
  17872.                         urlConnettore = token + singlecp.getValore();
  17873.                     }
  17874.                    
  17875.                     break;
  17876.                 }
  17877.             }
  17878.         }
  17879.         return urlConnettore;
  17880.     }
  17881.    
  17882.     public void addConfigurazioneResponseCachingPorteToDati(TipoOperazione tipoOperazione,List<DataElement> dati, boolean showStato, String statoResponseCachingPorta, boolean responseCachingEnabled, int responseCachingSeconds,
  17883.             boolean responseCachingMaxResponseSize, long responseCachingMaxResponseSizeBytes,
  17884.             boolean responseCachingDigestUrlInvocazione, boolean responseCachingDigestHeaders,
  17885.             boolean responseCachingDigestPayload, String responseCachingDigestHeadersNomiHeaders, StatoFunzionalitaCacheDigestQueryParameter responseCachingDigestQueryParameter, String responseCachingDigestNomiParametriQuery,
  17886.             boolean responseCachingCacheControlNoCache, boolean responseCachingCacheControlMaxAge, boolean responseCachingCacheControlNoStore, boolean visualizzaLinkConfigurazioneRegola,
  17887.             String servletResponseCachingConfigurazioneRegolaList, List<Parameter> paramsResponseCachingConfigurazioneRegolaList, int numeroResponseCachingConfigurazioneRegola) throws DriverControlStationException {
  17888.        
  17889.         if(showStato) {
  17890.             DataElement de = new DataElement();
  17891.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_RESPONSE_CACHING);
  17892.             de.setType(DataElementType.TITLE);
  17893.             dati.add(de);
  17894.         }
  17895.        
  17896.         // stato generale cors
  17897.         DataElement de = new DataElement();
  17898.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_STATO_PORTA);
  17899.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_RESPONSE_CACHING_STATO_PORTA);
  17900.         if(showStato) {
  17901.             try {
  17902.                 de.setType(DataElementType.SELECT);
  17903.                 String valuesStato [] = {CostantiControlStation.VALUE_PARAMETRO_RESPONSE_CACHING_STATO_DEFAULT, CostantiControlStation.VALUE_PARAMETRO_RESPONSE_CACHING_STATO_RIDEFINITO};
  17904.                 String labelsStato [] = { this.getResponseCachingLabelDefault(true), CostantiControlStation.LABEL_PARAMETRO_RESPONSE_CACHING_STATO_PORTA_RIDEFINITO};
  17905.                 de.setSelected(statoResponseCachingPorta);
  17906.                 de.setLabels(labelsStato);
  17907.                 de.setValues(valuesStato);
  17908.                 de.setPostBack(true);
  17909.             }catch(Exception e) {
  17910.                 throw new DriverControlStationException(e.getMessage(),e);
  17911.             }
  17912.         } else {
  17913.             de.setType(DataElementType.HIDDEN);
  17914.             de.setValue(statoResponseCachingPorta);
  17915.         }
  17916.         dati.add(de);
  17917.        
  17918.         if(!showStato || statoResponseCachingPorta.equals(CostantiControlStation.VALUE_PARAMETRO_CORS_STATO_RIDEFINITO)) {
  17919.             this.addResponseCachingToDati(dati, responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize,
  17920.                     responseCachingMaxResponseSizeBytes, responseCachingDigestUrlInvocazione, responseCachingDigestHeaders, responseCachingDigestPayload, false, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
  17921.                     responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore, visualizzaLinkConfigurazioneRegola,
  17922.                     servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList, numeroResponseCachingConfigurazioneRegola,
  17923.                     false);
  17924.         }
  17925.     }
  17926.    
  17927.     public void addResponseCachingToDati(List<DataElement> dati, boolean responseCachingEnabled, int responseCachingSeconds,
  17928.             boolean responseCachingMaxResponseSize, long responseCachingMaxResponseSizeBytes,
  17929.             boolean responseCachingDigestUrlInvocazione, boolean responseCachingDigestHeaders,
  17930.             boolean responseCachingDigestPayload, boolean addTitle, String responseCachingDigestHeadersNomiHeaders, StatoFunzionalitaCacheDigestQueryParameter responseCachingDigestQueryParameter, String responseCachingDigestNomiParametriQuery,  
  17931.             boolean responseCachingCacheControlNoCache, boolean responseCachingCacheControlMaxAge, boolean responseCachingCacheControlNoStore, boolean visualizzaLinkConfigurazioneRegola,
  17932.             String servletResponseCachingConfigurazioneRegolaList, List<Parameter> paramsResponseCachingConfigurazioneRegolaList, int numeroResponseCachingConfigurazioneRegola,
  17933.             boolean allHidden) {
  17934.         DataElement de;
  17935.         if(!allHidden && addTitle) {
  17936.             de = new DataElement();
  17937.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_RESPONSE_CACHING);
  17938.             de.setType(DataElementType.TITLE);
  17939.             dati.add(de);
  17940.         }
  17941.        
  17942.         de = new DataElement();
  17943.         de.setLabel(addTitle ?  CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_STATO : "");
  17944.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_STATO);
  17945.         if(allHidden) {
  17946.             de.setType(DataElementType.HIDDEN);
  17947.         }
  17948.         else {
  17949.             de.setType(DataElementType.SELECT);
  17950.             de.setPostBack(true);
  17951.             de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  17952.             de.setSelected(responseCachingEnabled ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  17953.         }
  17954.         de.setValue(responseCachingEnabled ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  17955.         dati.add(de);
  17956.        
  17957.         if(responseCachingEnabled) {
  17958.             de = new DataElement();
  17959.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_TIMEOUT);
  17960.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_TIMEOUT);
  17961.             de.setValue(responseCachingSeconds+"");
  17962.             if(allHidden) {
  17963.                 de.setType(DataElementType.HIDDEN);
  17964.             }
  17965.             else {
  17966.                 de.setType(DataElementType.NUMBER);
  17967.                 de.setMinValue(1);
  17968.                 de.setMaxValue(Integer.MAX_VALUE);
  17969.             }
  17970.             dati.add(de);
  17971.            
  17972.            
  17973.             de = new DataElement();
  17974.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE);
  17975.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE);
  17976.             if(allHidden) {
  17977.                 de.setType(DataElementType.HIDDEN);
  17978.             }
  17979.             else {
  17980.                 de.setType(DataElementType.CHECKBOX);
  17981.                 de.setSelected(responseCachingMaxResponseSize);
  17982.                 de.setPostBack(true);
  17983.             }
  17984.             de.setValue(responseCachingMaxResponseSize+"");
  17985.             dati.add(de);
  17986.            
  17987.             if(responseCachingMaxResponseSize) {
  17988.                 de = new DataElement();
  17989.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE_BYTES);
  17990.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE_BYTES);
  17991.                 de.setValue(responseCachingMaxResponseSizeBytes+"");
  17992.                 if(allHidden) {
  17993.                     de.setType(DataElementType.HIDDEN);
  17994.                 }
  17995.                 else {
  17996.                     de.setType(DataElementType.NUMBER);
  17997.                     de.setMinValue(1);
  17998.                     de.setMaxValue(Integer.MAX_VALUE);
  17999.                 }
  18000.                 dati.add(de);
  18001.             }
  18002.            
  18003.             if(!allHidden) {
  18004.                 de = new DataElement();
  18005.                 de.setType(DataElementType.SUBTITLE);
  18006.                 de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_RESPONSE_CACHING_GENERAZIONE_HASH);
  18007.                 dati.add(de);
  18008.             }
  18009.            
  18010.             de = new DataElement();
  18011.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_URI_INVOCAZIONE);
  18012.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_URI_INVOCAZIONE);
  18013.             if(allHidden) {
  18014.                 de.setType(DataElementType.HIDDEN);
  18015.             }
  18016.             else {
  18017.                 de.setType(DataElementType.SELECT);
  18018.                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  18019.                 de.setSelected(responseCachingDigestUrlInvocazione ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18020.             }
  18021.             de.setValue(responseCachingDigestUrlInvocazione ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18022.             dati.add(de);
  18023.            
  18024.             de = new DataElement();
  18025.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS);
  18026.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS);
  18027.             if(allHidden) {
  18028.                 de.setType(DataElementType.HIDDEN);
  18029.             }
  18030.             else {
  18031.                 de.setType(DataElementType.SELECT);
  18032.                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA_RESPONSE_CACHING_DIGEST_QUERY_PARAMETERS);
  18033.                 if(responseCachingDigestQueryParameter!=null) {
  18034.                     de.setSelected(responseCachingDigestQueryParameter.getValue());
  18035.                 }
  18036.                 de.setPostBack(true);
  18037.             }
  18038.             if(responseCachingDigestQueryParameter!=null) {
  18039.                 de.setValue(responseCachingDigestQueryParameter.getValue());
  18040.             }
  18041.             dati.add(de);
  18042.            
  18043.             if(StatoFunzionalitaCacheDigestQueryParameter.SELEZIONE_PUNTUALE.equals(responseCachingDigestQueryParameter)) {
  18044.                 de = new DataElement();
  18045. //              de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI);
  18046.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI);
  18047.                 if(allHidden) {
  18048.                     de.setType(DataElementType.HIDDEN);
  18049.                 }
  18050.                 else {
  18051.                     de.setType(DataElementType.TEXT_EDIT);
  18052.                     de.enableTags();
  18053.                     de.setNote(CostantiControlStation.NOTE_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI);
  18054. //                  de.setRequired(true);
  18055.                 }
  18056.                 de.setValue(responseCachingDigestNomiParametriQuery);
  18057.                 dati.add(de);
  18058.             }
  18059.            
  18060.             de = new DataElement();
  18061.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_PAYLOAD);
  18062.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_PAYLOAD);
  18063.             if(allHidden) {
  18064.                 de.setType(DataElementType.HIDDEN);
  18065.             }
  18066.             else {
  18067.                 de.setType(DataElementType.SELECT);
  18068.                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  18069.                 de.setSelected(responseCachingDigestPayload ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18070.             }
  18071.             de.setValue(responseCachingDigestPayload ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18072.             dati.add(de);
  18073.            
  18074.             de = new DataElement();
  18075.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS);
  18076.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS);
  18077.             if(allHidden) {
  18078.                 de.setType(DataElementType.HIDDEN);
  18079.             }
  18080.             else {
  18081.                 de.setType(DataElementType.SELECT);
  18082.                 de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
  18083.                 de.setSelected(responseCachingDigestHeaders ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18084.                 de.setPostBack(true);
  18085.             }
  18086.             de.setValue(responseCachingDigestHeaders ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
  18087.             dati.add(de);
  18088.            
  18089.             if(responseCachingDigestHeaders) {
  18090.                 de = new DataElement();
  18091. //              de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS);
  18092.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS);
  18093.                 if(allHidden) {
  18094.                     de.setType(DataElementType.HIDDEN);
  18095.                 }
  18096.                 else {
  18097.                     de.setType(DataElementType.TEXT_EDIT);
  18098.                     de.enableTags();
  18099.                     de.setNote(CostantiControlStation.NOTE_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS);
  18100. //                  de.setRequired(true);
  18101.                 }
  18102.                 de.setValue(responseCachingDigestHeadersNomiHeaders);
  18103.                 dati.add(de);
  18104.             }
  18105.            
  18106.             if(!allHidden) {
  18107.                 de = new DataElement();
  18108.                 de.setType(DataElementType.SUBTITLE);
  18109.                 de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL);
  18110.                 dati.add(de);
  18111.             }
  18112.            
  18113.             de = new DataElement();
  18114.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_CACHE);
  18115.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_CACHE);
  18116.             if(allHidden) {
  18117.                 de.setType(DataElementType.HIDDEN);
  18118.             }
  18119.             else {
  18120.                 de.setType(DataElementType.CHECKBOX);
  18121.                 de.setSelected(responseCachingCacheControlNoCache);
  18122.             }
  18123.             de.setValue(responseCachingCacheControlNoCache+"");
  18124.             dati.add(de);
  18125.            
  18126.             de = new DataElement();
  18127.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_MAX_AGE);
  18128.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_MAX_AGE);
  18129.             if(allHidden) {
  18130.                 de.setType(DataElementType.HIDDEN);
  18131.             }
  18132.             else {
  18133.                 de.setType(DataElementType.CHECKBOX);
  18134.                 de.setSelected(responseCachingCacheControlMaxAge);
  18135.             }
  18136.             de.setValue(responseCachingCacheControlMaxAge+"");
  18137.             dati.add(de);
  18138.            
  18139.             de = new DataElement();
  18140.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_STORE);
  18141.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_STORE);
  18142.             if(allHidden) {
  18143.                 de.setType(DataElementType.HIDDEN);
  18144.             }
  18145.             else {
  18146.                 de.setType(DataElementType.CHECKBOX);
  18147.                 de.setSelected(responseCachingCacheControlNoStore);
  18148.             }
  18149.             de.setValue(responseCachingCacheControlNoStore+"");
  18150.             dati.add(de);
  18151.            
  18152.            
  18153.                        
  18154.             if(!allHidden && visualizzaLinkConfigurazioneRegola) {
  18155.                
  18156.                 de = new DataElement();
  18157.                 de.setType(DataElementType.SUBTITLE);
  18158.                 de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIOME_AVANZATA);
  18159.                 dati.add(de);
  18160.                
  18161.                 de = new DataElement();
  18162.                 de.setType(DataElementType.LINK);
  18163.                 boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
  18164.                 if (contaListeFromSession)
  18165.                     de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLE+" (" + numeroResponseCachingConfigurazioneRegola + ")");
  18166.                 else
  18167.                     de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLE);
  18168.                 de.setUrl(servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList.toArray(new Parameter[paramsResponseCachingConfigurazioneRegolaList.size()]));
  18169.                 dati.add(de);
  18170.             }
  18171.         }
  18172.     }
  18173.    
  18174.     public ResponseCachingConfigurazione getResponseCaching(boolean responseCachingEnabled, int responseCachingSeconds, boolean responseCachingMaxResponseSize, long responseCachingMaxResponseSizeBytes,
  18175.             boolean responseCachingDigestUrlInvocazione, boolean responseCachingDigestHeaders,  boolean responseCachingDigestPayload, String responseCachingDigestHeadersNomiHeaders, StatoFunzionalitaCacheDigestQueryParameter responseCachingDigestQueryParameter, String responseCachingDigestNomiParametriQuery,
  18176.             boolean responseCachingCacheControlNoCache, boolean responseCachingCacheControlMaxAge, boolean responseCachingCacheControlNoStore,List<ResponseCachingConfigurazioneRegola> listaRegoleCachingConfigurazione) {
  18177.        
  18178.         ResponseCachingConfigurazione responseCaching  = new ResponseCachingConfigurazione();
  18179.        
  18180.         responseCaching.setStato(responseCachingEnabled ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  18181.         if(responseCachingEnabled) {
  18182.             responseCaching.setCacheTimeoutSeconds(responseCachingSeconds);
  18183.            
  18184.             if(responseCachingMaxResponseSize) {
  18185.                 responseCaching.setMaxMessageSize(responseCachingMaxResponseSizeBytes);
  18186.             }
  18187.            
  18188.             if(responseCachingDigestUrlInvocazione || responseCachingDigestHeaders || responseCachingDigestPayload) {
  18189.                 ResponseCachingConfigurazioneHashGenerator hashGenerator = new ResponseCachingConfigurazioneHashGenerator();
  18190.                
  18191.                 hashGenerator.setPayload(responseCachingDigestPayload ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  18192.                 hashGenerator.setRequestUri(responseCachingDigestUrlInvocazione ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  18193.                 hashGenerator.setQueryParameters(responseCachingDigestQueryParameter);
  18194.                 if(StringUtils.isNotEmpty(responseCachingDigestNomiParametriQuery)) {
  18195.                     hashGenerator.setQueryParameterList(Arrays.asList(responseCachingDigestNomiParametriQuery.split(",")));
  18196.                 }
  18197.                 hashGenerator.setHeaders(responseCachingDigestHeaders ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);
  18198.                 if(StringUtils.isNotEmpty(responseCachingDigestHeadersNomiHeaders)) {
  18199.                     hashGenerator.setHeaderList(Arrays.asList(responseCachingDigestHeadersNomiHeaders.split(",")));
  18200.                 }
  18201.                
  18202.                 responseCaching.setHashGenerator(hashGenerator);
  18203.             }
  18204.            
  18205.             ResponseCachingConfigurazioneControl control = new ResponseCachingConfigurazioneControl();
  18206.            
  18207.             control.setNoCache(responseCachingCacheControlNoCache);
  18208.             control.setMaxAge(responseCachingCacheControlMaxAge);
  18209.             control.setNoStore(responseCachingCacheControlNoStore);
  18210.            
  18211.             responseCaching.setControl(control);
  18212.            
  18213.             if(listaRegoleCachingConfigurazione!= null) {
  18214.                 for (ResponseCachingConfigurazioneRegola regola : listaRegoleCachingConfigurazione) {
  18215.                     responseCaching.addRegola(regola);
  18216.                 }
  18217.             }
  18218.         }
  18219.        
  18220.         return responseCaching;
  18221.     }
  18222.    
  18223.     public boolean isResponseCachingAbilitato(ResponseCachingConfigurazione configurazione) {
  18224.         boolean abilitato = false;
  18225.        
  18226.         if(configurazione == null)
  18227.             return false;
  18228.        
  18229.         if(configurazione.getStato().equals(StatoFunzionalita.ABILITATO))
  18230.             return true;
  18231.        
  18232.        
  18233.         return abilitato;
  18234.     }
  18235.    
  18236.     public int numeroRegoleResponseCaching(ResponseCachingConfigurazione configurazione) {
  18237.         if(configurazione == null)
  18238.             return 0;
  18239.        
  18240.         if(configurazione.getStato().equals(StatoFunzionalita.ABILITATO))
  18241.             return configurazione.sizeRegolaList();
  18242.        
  18243.         return 0;
  18244.     }
  18245.    
  18246.     public int numeroRegoleProxyPass(ConfigurazioneUrlInvocazione configurazione) {
  18247.         if(configurazione == null)
  18248.             return 0;
  18249.        
  18250.         return configurazione.sizeRegolaList();
  18251.     }
  18252.    
  18253.     public int numeroPluginsRegistroArchivi()  throws DriverControlStationException {
  18254.         try {
  18255.             return this.confCore.numeroPluginsArchiviList();
  18256.         }catch(Exception e) {
  18257.             throw new DriverControlStationException(e.getMessage(),e);
  18258.         }
  18259.     }
  18260.    
  18261.     public int numeroPluginsRegistroClassi() throws DriverControlStationException {
  18262.         try {
  18263.             return this.confCore.numeroPluginsClassiList();
  18264.         }catch(Exception e) {
  18265.             throw new DriverControlStationException(e.getMessage(),e);
  18266.         }
  18267.     }
  18268.    
  18269.     public boolean isCorsAbilitato(CorsConfigurazione configurazione) {
  18270.         boolean abilitato = false;
  18271.        
  18272.         if(configurazione == null)
  18273.             return false;
  18274.        
  18275.         if(configurazione.getStato().equals(StatoFunzionalita.ABILITATO))
  18276.             return true;
  18277.        
  18278.        
  18279.         return abilitato;
  18280.     }
  18281.    
  18282.     public int numeroCanali(CanaliConfigurazione configurazione) {
  18283.         if(configurazione == null || configurazione.getStato() == null)
  18284.             return 0;
  18285.        
  18286.         if(configurazione.getStato().equals(StatoFunzionalita.ABILITATO))
  18287.             return configurazione.sizeCanaleList();
  18288.        
  18289.         return 0;
  18290.     }
  18291.    
  18292.     public int numeroNodi(CanaliConfigurazione configurazione) {
  18293.         if(configurazione == null || configurazione.getStato() == null)
  18294.             return 0;
  18295.        
  18296.         if(configurazione.getStato().equals(StatoFunzionalita.ABILITATO))
  18297.             return configurazione.sizeNodoList();
  18298.        
  18299.         return 0;
  18300.     }
  18301.    
  18302.     public boolean checkDataConfigurazioneResponseCachingPorta(TipoOperazione tipoOperazione,boolean showStato, String statoResponseCachingPorta) throws DriverControlStationException{
  18303.        
  18304.         if(showStato) {
  18305.             if(StringUtils.isEmpty(statoResponseCachingPorta) ||
  18306.                     !(statoResponseCachingPorta.equals(CostantiControlStation.VALUE_PARAMETRO_RESPONSE_CACHING_STATO_DEFAULT) || statoResponseCachingPorta.equals(CostantiControlStation.VALUE_PARAMETRO_RESPONSE_CACHING_STATO_RIDEFINITO))) {
  18307.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO, CostantiControlStation.LABEL_PARAMETRO_RESPONSE_CACHING_STATO_PORTA));
  18308.                 return false;
  18309.             }
  18310.         }
  18311.        
  18312.         if(!showStato || statoResponseCachingPorta.equals(CostantiControlStation.VALUE_PARAMETRO_RESPONSE_CACHING_STATO_RIDEFINITO)) {
  18313.             return this.checkDataResponseCaching();
  18314.         }
  18315.        
  18316.         return true;
  18317.     }
  18318.    
  18319.     public boolean checkDataResponseCaching() throws DriverControlStationException {
  18320.        
  18321.         String responseCachingDigestQueryTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS);
  18322.         StatoFunzionalitaCacheDigestQueryParameter stato = null;
  18323.         if(responseCachingDigestQueryTmp!=null) {
  18324.             try {
  18325.                 stato = StatoFunzionalitaCacheDigestQueryParameter.toEnumConstant(responseCachingDigestQueryTmp, true);
  18326.             }catch(Exception e) {
  18327.                 throw new DriverControlStationException(e.getMessage(),e);
  18328.             }
  18329.         }
  18330.         if(StatoFunzionalitaCacheDigestQueryParameter.SELEZIONE_PUNTUALE.equals(stato)) {
  18331.             // se e' abilitato il salvataggio dei parametri della query bisogna indicare quali si vuole salvare
  18332.             String responseCachingDigestNomiQueryParameters =  this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI);
  18333.             if(StringUtils.isNotEmpty(responseCachingDigestNomiQueryParameters)) {
  18334.                 List<String> asList = Arrays.asList(responseCachingDigestNomiQueryParameters.split(","));
  18335.                 for (String string : asList) {
  18336.                     if(string.contains(" ")) {
  18337.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI));  
  18338.                         return false;
  18339.                     }
  18340.                 }
  18341.             } else {
  18342.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_CAMPO_OBBLIGATORIO, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI));  
  18343.                 return false;
  18344.             }
  18345.         }
  18346.        
  18347.         String responseCachingDigestHeadersTmp = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS);
  18348.         boolean responseCachingDigestHeaders = ServletUtils.isCheckBoxEnabled(responseCachingDigestHeadersTmp);
  18349.         if(responseCachingDigestHeaders) {
  18350.             // se e' abilitato il salvataggio degli headers bisogna indicare quali si vuole salvare
  18351.             String responseCachingDigestHeadersNomiHeaders =  this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS);
  18352.             if(StringUtils.isNotEmpty(responseCachingDigestHeadersNomiHeaders)) {
  18353.                 List<String> asList = Arrays.asList(responseCachingDigestHeadersNomiHeaders.split(","));
  18354.                 for (String string : asList) {
  18355.                     if(string.contains(" ")) {
  18356.                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS));  
  18357.                         return false;
  18358.                     }
  18359.                 }
  18360.             } else {
  18361.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_CAMPO_OBBLIGATORIO, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS));  
  18362.                 return false;
  18363.             }
  18364.         }
  18365.        
  18366.         return true;
  18367.     }
  18368.    
  18369.     public boolean checkRegolaResponseCaching() throws DriverControlStationException {
  18370.        
  18371.         String returnCode = getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE);
  18372.         String statusMinS = getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN);
  18373.         String statusMaxS = getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MAX);
  18374.         @SuppressWarnings("unused")
  18375.         String faultS = getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT);
  18376.         String cacheSecondsS = getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS);
  18377.        
  18378.         if(_checkReturnCode(returnCode, statusMinS, statusMaxS,
  18379.                 CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE,
  18380.                 CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN,
  18381.                 CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MAX)==false) {
  18382.             return false;
  18383.         }
  18384.        
  18385.         Integer cacheSeconds = null;
  18386.         if(StringUtils.isNotEmpty(cacheSecondsS)) {
  18387.             try {
  18388.                 cacheSeconds = Integer.parseInt(cacheSecondsS);
  18389.                
  18390.                 if(cacheSeconds < 1) {
  18391.                     this.pd.setMessage("Il valore inserito nel campo "+ CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS + " non &egrave; valido, sono ammessi valori compresi tra 1 e 999.");
  18392.                     return false;
  18393.                 }
  18394.             }catch(Exception e) {
  18395.                 this.pd.setMessage("Il formato del campo "+ CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS + " non &egrave; valido.");
  18396.                 return false;
  18397.             }
  18398.         }
  18399.        
  18400.         return true;
  18401.     }
  18402.    
  18403.     public boolean _checkReturnCode(String returnCode, String statusMinS, String statusMaxS,
  18404.             String labelReturnCode, String labelReturnCodeMin, String labelReturnCodeMax) throws DriverControlStationException {
  18405.        
  18406.         Integer statusMin = null;
  18407.         Integer statusMax = null;
  18408.        
  18409.         if(!returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI)) {
  18410.            
  18411.             if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO)) {
  18412.                 if(StringUtils.isEmpty(statusMinS)) {
  18413.                     this.pd.setMessage("Il campo "+ labelReturnCode + " &egrave; obbligatorio.");
  18414.                     return false;
  18415.                 }
  18416.             }
  18417.            
  18418.             if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO)) {
  18419.                 if(StringUtils.isEmpty(statusMinS) || StringUtils.isEmpty(statusMaxS)) {
  18420.                     this.pd.setMessage("Tutt gli intervalli del campo "+ labelReturnCode + " sono obbligatori.");
  18421.                     return false;
  18422.                 }
  18423.             }
  18424.            
  18425.             if(StringUtils.isNotEmpty(statusMinS)) {
  18426.                 try {
  18427.                     statusMin = Integer.parseInt(statusMinS);
  18428.                    
  18429.                     if(statusMin < 200 || statusMin > 599) {
  18430.                         if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO)) {
  18431.                             this.pd.setMessage("Il valore inserito nel campo "+ labelReturnCode + " non &egrave; valido, sono ammessi valori compresi tra 200 e 599.");
  18432.                         }
  18433.                         else {
  18434.                             this.pd.setMessage("Il valore inserito nell'intervallo sinistro non &egrave; valido, sono ammessi valori compresi tra 200 e 599.");
  18435.                         }
  18436.                         return false;
  18437.                     }
  18438.                     // return code esatto, ho salvato lo stesso valore nel campo return code;
  18439.                     if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO))
  18440.                         statusMax = statusMin;
  18441.                 }catch(Exception e) {
  18442.                     this.pd.setMessage("Il formato del campo "+ labelReturnCodeMin + " non &egrave; valido.");
  18443.                     return false;
  18444.                 }
  18445.             }
  18446.            
  18447.             if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO)) {
  18448.                 if(StringUtils.isNotEmpty(statusMaxS)) {
  18449.                     try {
  18450.                         statusMax = Integer.parseInt(statusMaxS);
  18451.                        
  18452.                         if(statusMax < 200 || statusMax > 599) {
  18453.                             this.pd.setMessage("Il valore inserito nell'intervallo destro non &egrave; valido, sono ammessi valori compresi tra 200 e 599.");
  18454.                             return false;
  18455.                         }
  18456.                     }catch(Exception e) {
  18457.                         this.pd.setMessage("Il formato del campo "+ labelReturnCodeMax + " non &egrave; valido.");
  18458.                         return false;
  18459.                     }
  18460.                 }
  18461.             }
  18462.            
  18463.             if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO)) {
  18464.                 if(statusMax!=null && statusMin!=null) {
  18465.                     if(statusMin>=statusMax) {
  18466.                         this.pd.setMessage("Il valore inserito nell'intervallo sinistro deve essere minore del valore inserito nell'intervallo destro.");
  18467.                         return false;
  18468.                     }
  18469.                 }
  18470.             }
  18471.         }
  18472.        
  18473.         return true;
  18474.     }
  18475.    
  18476.     public List<DataElement> addResponseCachingConfigurazioneRegola(TipoOperazione tipoOP, String returnCode, String statusMin, String statusMax, String fault, String cacheSeconds, List<DataElement> dati) {
  18477.        
  18478.         DataElement dataElement = new DataElement();
  18479.         dataElement.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA);
  18480.         dataElement.setType(DataElementType.TITLE);
  18481.         dati.add(dataElement);
  18482.        
  18483.         DataElement de = new DataElement();
  18484.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE);
  18485.         de.setLabels(CostantiControlStation.SELECT_LABELS_CONFIGURAZIONE_RETURN_CODE);
  18486.         de.setValues(CostantiControlStation.SELECT_VALUES_CONFIGURAZIONE_RETURN_CODE);
  18487.         de.setType(DataElementType.SELECT);
  18488.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE);
  18489.         de.setPostBack(true);
  18490.         de.setSelected(returnCode);
  18491.         dati.add(de);
  18492.        
  18493.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI.equals(returnCode)) {
  18494.             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO.equals(returnCode)) {
  18495.                 de = this.getHttpReturnCodeDataElement(CostantiControlStation.LABEL_EMPTY,
  18496.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN,
  18497.                         statusMin, true);
  18498.                 dati.add(de);
  18499.             }
  18500.            
  18501.             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO.equals(returnCode)) {
  18502.                 de = getHttpReturnCodeIntervallDataElement(CostantiControlStation.LABEL_EMPTY,
  18503.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN,
  18504.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MAX,
  18505.                         statusMin,
  18506.                         statusMax,
  18507.                         true);
  18508.                 dati.add(de);
  18509.             }
  18510.         }
  18511.        
  18512.         de = new DataElement();
  18513.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS);
  18514.         de.setValue(cacheSeconds+ "");
  18515.         de.setType(DataElementType.NUMBER);
  18516.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS);
  18517.         de.setSize( getSize());
  18518.         de.setMinValue(1);
  18519.         de.reloadMinValue(false);
  18520.         dati.add(de);
  18521.        
  18522.         de = new DataElement();
  18523.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT);
  18524.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT);
  18525.         de.setType(DataElementType.CHECKBOX);
  18526.         de.setSelected(fault);
  18527.         de.setValue(fault+"");
  18528.         dati.add(de);

  18529.         return dati;
  18530.     }
  18531.    
  18532.     public List<DataElement> addTrasformazioneRispostaToDatiOpAdd(String protocollo, List<DataElement> dati, String idTrasformazione,
  18533.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding,
  18534.             String nome, String returnCode, String statusMin, String statusMax, String pattern, String contentType) throws DriverControlStationException {
  18535.         return addTrasformazioneRispostaToDati(TipoOperazione.ADD, protocollo, dati, 0, null, false, idTrasformazione, null,
  18536.                 serviceBinding,
  18537.                 nome, returnCode, statusMin, statusMax, pattern, contentType,
  18538.                 null, null, 0,
  18539.                 false,false,false,
  18540.                 false,null,
  18541.                 null,null,null,null,
  18542.                 null,
  18543.                 false,null,
  18544.                 null,null,null);
  18545.     }
  18546.    
  18547.     public List<DataElement> addTrasformazioneRispostaToDati(TipoOperazione tipoOP, String protocollo, List<DataElement> dati, long idPorta, TrasformazioneRegolaRisposta risposta, boolean isPortaDelegata, String idTrasformazione, String idTrasformazioneRisposta,
  18548.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBindingParam,
  18549.             String nome, String returnCode, String statusMin, String statusMax, String pattern, String contentType,
  18550.             String servletTrasformazioniRispostaHeadersList, List<Parameter> parametriInvocazioneServletTrasformazioniRispostaHeaders, int numeroTrasformazioniRispostaHeaders,
  18551.             boolean trasformazioneContenutoRichiestaAbilitato, boolean trasformazioneRichiestaRestAbilitato, boolean trasformazioneRichiestaSoapAbilitato,
  18552.             boolean trasformazioneContenutoRispostaAbilitato, org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneContenutoRispostaTipo,
  18553.             BinaryParameter trasformazioneContenutoRispostaTemplate, String trasformazioneContenutoRispostaTipoCheck, String trasformazioneContenutoRispostaContentType, String trasformazioneContenutoRispostaReturnCode,
  18554.             ServiceBinding serviceBindingMessage,
  18555.             boolean trasformazioneRispostaSoapAbilitatoParam, String trasformazioneRispostaSoapEnvelope,  
  18556.             org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneRispostaSoapEnvelopeTipo, BinaryParameter trasformazioneRispostaSoapEnvelopeTemplate, String trasformazioneRispostaSoapEnvelopeTipoCheck
  18557.            
  18558.             ) throws DriverControlStationException {
  18559.        
  18560.        
  18561.         org.openspcoop2.core.registry.constants.ServiceBinding infoServiceBinding = serviceBindingParam;
  18562.         if(trasformazioneRichiestaRestAbilitato) {
  18563.             infoServiceBinding = org.openspcoop2.core.registry.constants.ServiceBinding.REST;
  18564.         }
  18565.         else if(trasformazioneRichiestaSoapAbilitato){
  18566.             infoServiceBinding = org.openspcoop2.core.registry.constants.ServiceBinding.SOAP;
  18567.         }
  18568.        
  18569.         DataElementInfo dInfoPatternTrasporto = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  18570.         dInfoPatternTrasporto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  18571.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(infoServiceBinding)) {
  18572.             dInfoPatternTrasporto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  18573.         }
  18574.         else {
  18575.             dInfoPatternTrasporto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  18576.         }
  18577.        
  18578.         DataElement de = new DataElement();
  18579.         de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_TRASFORMAZIONE);
  18580.         de.setType(DataElementType.TITLE);
  18581.         dati.add(de);
  18582.        
  18583.         // Nome
  18584.         de = new DataElement();
  18585.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_NOME);
  18586.         de.setValue(nome);
  18587.         de.setType(DataElementType.TEXT_EDIT);
  18588.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_NOME);
  18589.         de.setRequired(true);
  18590.         dati.add(de);
  18591.        
  18592.         de = new DataElement();
  18593.         de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA);
  18594.         de.setType(DataElementType.SUBTITLE);
  18595.         dati.add(de);
  18596.        
  18597.         // Id trasformazione hidden
  18598.         de = new DataElement();
  18599.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  18600.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  18601.         de.setType(DataElementType.HIDDEN);
  18602.         de.setValue(idTrasformazione);
  18603.         dati.add(de);
  18604.        
  18605.         // First
  18606.         de = new DataElement();
  18607.         de.setValue("first");
  18608.         de.setType(DataElementType.HIDDEN);
  18609.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_FIRST);
  18610.         dati.add(de);
  18611.        
  18612.         de = new DataElement();
  18613.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  18614.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RISPOSTA);
  18615.         de.setType(DataElementType.HIDDEN);
  18616.         de.setValue(idTrasformazioneRisposta);
  18617.         dati.add(de);
  18618.        
  18619.         de = new DataElement();
  18620.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS);
  18621.         de.setLabels(CostantiControlStation.SELECT_LABELS_CONFIGURAZIONE_RETURN_CODE);
  18622.         de.setValues(CostantiControlStation.SELECT_VALUES_CONFIGURAZIONE_RETURN_CODE);
  18623.         de.setType(DataElementType.SELECT);
  18624.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS);
  18625.         de.setPostBack(true);
  18626.         de.setSelected(returnCode);
  18627.         dati.add(de);
  18628.        
  18629.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI.equals(returnCode)) {
  18630.             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO.equals(returnCode)) {
  18631.                 de = this.getHttpReturnCodeDataElement(CostantiControlStation.LABEL_EMPTY,
  18632.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MIN,
  18633.                         statusMin, true);
  18634.                 dati.add(de);
  18635.             }
  18636.            
  18637.             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO.equals(returnCode)) {
  18638.                 de = getHttpReturnCodeIntervallDataElement(CostantiControlStation.LABEL_EMPTY,
  18639.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MIN,
  18640.                         CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MAX,
  18641.                         statusMin,
  18642.                         statusMax,
  18643.                         true);
  18644.                 dati.add(de);
  18645.             }
  18646.         }
  18647.                
  18648.         // Content-type
  18649.         de = new DataElement();
  18650.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_CT);
  18651.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_CT);
  18652.         de.setType(DataElementType.TEXT_EDIT);
  18653.         de.setValue(contentType);
  18654.         de.enableTags();
  18655. //      de.setRequired(true);
  18656.         DataElementInfo dInfoCT = new DataElementInfo(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA+" - "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CT);
  18657.         dInfoCT.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_CONTENT_TYPE);
  18658.         dInfoCT.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_CONTENT_TYPE_VALORI);
  18659.         de.setInfo(dInfoCT);
  18660.         dati.add(de);
  18661.        
  18662.         // Pattern
  18663.         de = new DataElement();
  18664.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN);
  18665.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN);
  18666.         de.setType(DataElementType.TEXT_AREA);
  18667.         de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_SIZE);
  18668.         de.setSize(this.getSize());
  18669.         de.setValue(pattern);
  18670. //      de.setRequired(true);
  18671.         DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA+" - "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  18672.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(infoServiceBinding)) {
  18673.             dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_REST_RISPOSTA);
  18674.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_VALORI_REST);
  18675.         }
  18676.         else {
  18677.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_SOAP_RISPOSTA);
  18678.         }
  18679.         de.setInfo(dInfoPattern);
  18680.         dati.add(de);
  18681.        
  18682.        
  18683.         // in edit faccio vedere i link per configurare la richiesta e le risposte
  18684.                
  18685.         if(tipoOP.equals(TipoOperazione.CHANGE)) {
  18686.            
  18687.             String postbackElement = this.getPostBackElementName();
  18688.            
  18689.             boolean old_trasformazioneRispostaContenutoTemplate = false;
  18690.             boolean old_trasformazioneRispostaSoapEnvelopeTemplate = false;
  18691.            
  18692.             de = new DataElement();
  18693.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_REGOLE_TRASFORMAZIONE);
  18694.             de.setType(DataElementType.TITLE);
  18695.             dati.add(de);
  18696.            
  18697.             // sezione trasporto
  18698.             de = new DataElement();
  18699.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_TRASPORTO);
  18700.             de.setType(DataElementType.SUBTITLE);
  18701.             dati.add(de);
  18702.            
  18703.             // Return Code e Header Risposta
  18704.            
  18705.             /*
  18706.             de = this.getHttpReturnCodeDataElement(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE,
  18707.                     CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE,
  18708.                     trasformazioneContenutoRispostaReturnCode, false);
  18709.                     */
  18710.             de = new DataElement();
  18711.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE);
  18712.             de.setValue(trasformazioneContenutoRispostaReturnCode);
  18713.             de.setType(DataElementType.TEXT_EDIT);
  18714.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE);
  18715.             de.setSize(getSize());
  18716.             de.setInfo(dInfoPatternTrasporto);
  18717.             de.setRequired(false);
  18718.             dati.add(de);
  18719.            
  18720.             de = new DataElement();
  18721.             de.setType(DataElementType.LINK);
  18722.             boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
  18723.             if (contaListeFromSession)
  18724.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADERS+" (" + numeroTrasformazioniRispostaHeaders + ")");
  18725.             else
  18726.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADERS);
  18727.             de.setUrl(servletTrasformazioniRispostaHeadersList, parametriInvocazioneServletTrasformazioniRispostaHeaders.toArray(new Parameter[parametriInvocazioneServletTrasformazioniRispostaHeaders.size()]));
  18728.             dati.add(de);
  18729.            
  18730.             // sezione contenuto
  18731.             de = new DataElement();
  18732.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENUTO);
  18733.             de.setType(DataElementType.SUBTITLE);
  18734.             dati.add(de);
  18735.            
  18736.             // abilitato
  18737.             de = new DataElement();
  18738.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_ENABLED);
  18739.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_ENABLED);
  18740.             //if(!trasformazioneContenutoRichiestaAbilitato) {
  18741.             de.setType(DataElementType.CHECKBOX);
  18742.             de.setSelected(trasformazioneContenutoRispostaAbilitato);
  18743.             de.setPostBack(true);
  18744.             //} else {
  18745.             //de.setType(DataElementType.HIDDEN);
  18746.             //}
  18747.             de.setValue(trasformazioneContenutoRispostaAbilitato+"");
  18748.             dati.add(de);
  18749.            
  18750.             if(trasformazioneContenutoRispostaAbilitato) {
  18751.                 // tipo
  18752.                 de = new DataElement();
  18753.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO);
  18754.                 de.setLabels(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toLabelList(serviceBindingMessage, false));
  18755.                 de.setValues(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toStringList(serviceBindingMessage, false));
  18756.                 de.setType(DataElementType.SELECT);
  18757.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO);
  18758.                 de.setPostBack(true);
  18759.                 de.setSelected(trasformazioneContenutoRispostaTipo.getValue());
  18760.                 setTemplateInfo(de, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO, trasformazioneContenutoRispostaTipo, infoServiceBinding, true,
  18761.                         protocollo, isPortaDelegata);
  18762.                 dati.add(de);
  18763.                
  18764.                 if(trasformazioneContenutoRispostaTipo.isTemplateRequired()) {  
  18765.                    
  18766.                     // richiesta null in add
  18767.                     boolean templateRequired = true;
  18768.                    
  18769.                     if(risposta!=null){
  18770.                         old_trasformazioneRispostaContenutoTemplate = risposta.getConversioneTemplate() != null && risposta.getConversioneTemplate().length > 0;
  18771.                         TipoTrasformazione oldTrasformazioneRispostaContenutoTipo = StringUtils.isNotEmpty(risposta.getConversioneTipo())
  18772.                                 ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(risposta.getConversioneTipo()) : org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  18773.                         if(trasformazioneContenutoRispostaTipo.equals(oldTrasformazioneRispostaContenutoTipo)) {
  18774.                             templateRequired = false;
  18775.                         }
  18776.                     }
  18777.                                
  18778.                     if(postbackElement != null) {
  18779.                         if(postbackElement.equals(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO)) {
  18780.                             old_trasformazioneRispostaContenutoTemplate = false;
  18781.                             templateRequired = true;
  18782.                         }
  18783. //                      if(postbackElement.equals(trasformazioneContenutoTemplate.getName())) {
  18784. //                          if(StringUtils.isEmpty(trasformazioneContenutoTipoCheck))
  18785. //                              trasformazioneContenutoTipoCheck = CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_FILE;
  18786. //                      }
  18787.                     }
  18788.                    
  18789.                     de = new DataElement();
  18790.                     de.setLabel("");
  18791.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO_CHECK);
  18792.                     de.setType(DataElementType.HIDDEN);
  18793.                     de.setValue(trasformazioneContenutoRispostaTipoCheck);
  18794.                     dati.add(de);
  18795.                    
  18796.                     if(StringUtils.isNotEmpty(trasformazioneContenutoRispostaTipoCheck) && trasformazioneContenutoRispostaTipoCheck.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_TIPO))
  18797.                         templateRequired = true;
  18798.                    
  18799.                     String trasformazioneRispostaContenutoLabel = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE;
  18800.                     if(old_trasformazioneRispostaContenutoTemplate && StringUtils.isEmpty(trasformazioneContenutoRispostaTipoCheck)) {
  18801.                         trasformazioneRispostaContenutoLabel = "";
  18802.                         DataElement saveAs = new DataElement();
  18803.                         saveAs.setValue(CostantiControlStation.LABEL_DOWNLOAD_DOCUMENTO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE);
  18804.                         saveAs.setType(DataElementType.LINK);
  18805.                    
  18806.                         Parameter pIdTrasformazioneRegola = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE, idTrasformazione);
  18807.                         Parameter pIdTrasformazioneRegolaRisposta = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RISPOSTA, idTrasformazioneRisposta);
  18808.                         Parameter pIdAccordo = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_ID_ACCORDO, idPorta+"");
  18809.                         Parameter pTipoAllegato = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, isPortaDelegata ? "pd" : "pa");
  18810.                         Parameter pTipoDoc = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, isPortaDelegata ?
  18811.                                 ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_DELEGATA_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE :
  18812.                                     ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_APPLICATIVA_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE);
  18813.                         saveAs.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT, pIdAccordo, pTipoAllegato, pTipoDoc, pIdTrasformazioneRegola,pIdTrasformazioneRegolaRisposta);
  18814.                         saveAs.setDisabilitaAjaxStatus();
  18815.                         dati.add(saveAs);
  18816.                     }
  18817.                    
  18818.                     // template
  18819.                     DataElement trasformazioneContenutoTemplateDataElement = trasformazioneContenutoRispostaTemplate.getFileDataElement(trasformazioneRispostaContenutoLabel, "", getSize());
  18820.                     trasformazioneContenutoTemplateDataElement.setRequired(templateRequired);
  18821.                     dati.add(trasformazioneContenutoTemplateDataElement);
  18822.                     dati.addAll(trasformazioneContenutoRispostaTemplate.getFileNameDataElement());
  18823.                     dati.add(trasformazioneContenutoRispostaTemplate.getFileIdDataElement());
  18824.                 }
  18825.                
  18826.                 boolean contentTypePerAttachmentSOAP = false;
  18827.                 if(trasformazioneContenutoRispostaTipo.isTrasformazioneProtocolloEnabled() && trasformazioneRichiestaRestAbilitato &&
  18828.                         !TipoTrasformazione.EMPTY.equals(trasformazioneContenutoRispostaTipo) &&
  18829.                         CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneRispostaSoapEnvelope)) {
  18830.                     contentTypePerAttachmentSOAP = true;
  18831.                 }
  18832.                
  18833.                 if(!contentTypePerAttachmentSOAP && trasformazioneContenutoRispostaTipo.isContentTypeEnabled()) {
  18834.                     // Content-type
  18835.                     de = new DataElement();
  18836.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE);
  18837.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE);
  18838.                     de.setType(DataElementType.TEXT_EDIT);
  18839.                     de.setValue(StringEscapeUtils.escapeHtml(trasformazioneContenutoRispostaContentType));
  18840.                     if(trasformazioneRichiestaRestAbilitato) { // devo restituire un soap e il ct e' deciso dall'engine
  18841.                         de.setType(DataElementType.HIDDEN);
  18842.                         de.setValue("");
  18843.                     }  
  18844.                     else {
  18845.                         de.setInfo(dInfoPatternTrasporto);
  18846.                     }
  18847.                     dati.add(de);
  18848.                 }
  18849.                                
  18850.                 if(trasformazioneContenutoRispostaTipo.isTrasformazioneProtocolloEnabled() && trasformazioneRichiestaRestAbilitato &&
  18851.                         !TipoTrasformazione.EMPTY.equals(trasformazioneContenutoRispostaTipo)) {
  18852.                    
  18853.                     boolean trasformazioneRispostaSoapAbilitato = trasformazioneRispostaSoapAbilitatoParam;
  18854.                     trasformazioneRispostaSoapAbilitato = true; // forzo
  18855.                    
  18856.                     // sezione trasformazione SOAP
  18857.                     de = new DataElement();
  18858.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP);
  18859.                     de.setType(DataElementType.SUBTITLE);
  18860.                     dati.add(de);
  18861.                    
  18862.                     // abilitato
  18863.                     de = new DataElement();
  18864.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_TRANSFORMATION);
  18865.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_TRANSFORMATION);
  18866.                     de.setType(DataElementType.HIDDEN);
  18867.                     de.setValue(trasformazioneRispostaSoapAbilitato+"");
  18868.                     dati.add(de);
  18869.                    
  18870.                     //if(trasformazioneRispostaSoapAbilitato) {
  18871.                     // Envelope
  18872.                     de = new DataElement();
  18873.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE);
  18874.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE);
  18875.                     de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  18876.                     de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  18877.                     de.setType(DataElementType.SELECT);
  18878.                     de.setSelected(trasformazioneRispostaSoapEnvelope);
  18879.                     de.setPostBack(true);
  18880.                     dati.add(de);
  18881.                                            
  18882.                     if(trasformazioneRispostaSoapEnvelope!=null && CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneRispostaSoapEnvelope)) {
  18883.                        
  18884.                         // Content-type
  18885.                         de = new DataElement();
  18886.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE_ATTACHMENT);
  18887.                         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE);
  18888.                         de.setType(DataElementType.TEXT_EDIT);
  18889.                         de.setValue(trasformazioneContenutoRispostaContentType);
  18890.                         de.setInfo(dInfoPatternTrasporto);
  18891.                         de.setRequired(true);
  18892.                         dati.add(de);
  18893.                        
  18894.                         de = new DataElement();
  18895.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TITLE_BODY);
  18896.                         de.setType(DataElementType.SUBTITLE);
  18897.                         dati.add(de);  
  18898.                        
  18899.                         // tipo envelope attachement
  18900.                         de = new DataElement();
  18901.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO);
  18902.                         de.setLabels(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toLabelList(ServiceBinding.SOAP, true));
  18903.                         de.setValues(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toStringList(ServiceBinding.SOAP, true));
  18904.                         de.setType(DataElementType.SELECT);
  18905.                         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO);
  18906.                         if(trasformazioneRispostaSoapEnvelopeTipo!=null) {
  18907.                             de.setSelected(trasformazioneRispostaSoapEnvelopeTipo.getValue());
  18908.                         }
  18909.                         de.setPostBack(true);
  18910.                         setTemplateInfo(de, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO, trasformazioneRispostaSoapEnvelopeTipo, infoServiceBinding, true,
  18911.                                 protocollo, isPortaDelegata);
  18912.                         dati.add(de);
  18913.                        
  18914.                         if(trasformazioneRispostaSoapEnvelopeTipo!=null && trasformazioneRispostaSoapEnvelopeTipo.isTemplateRequired()) {
  18915.                            
  18916.                             // richiesta null in add
  18917.                             boolean templateRequired = true;
  18918.                             if(risposta!=null){
  18919.                                 TrasformazioneSoapRisposta oldTrasformazioneSoapRisposta = risposta.getTrasformazioneSoap();
  18920.                                 old_trasformazioneRispostaSoapEnvelopeTemplate = oldTrasformazioneSoapRisposta != null && oldTrasformazioneSoapRisposta.getEnvelopeBodyConversioneTemplate() != null && oldTrasformazioneSoapRisposta.getEnvelopeBodyConversioneTemplate().length > 0;
  18921.                                 String oldTrasformazioneSoapEnvelopeTipoS = oldTrasformazioneSoapRisposta != null ? oldTrasformazioneSoapRisposta.getEnvelopeBodyConversioneTipo() : null;
  18922.                                 TipoTrasformazione oldTrasformazioneSoapEnvelopeTipo = StringUtils.isNotEmpty(oldTrasformazioneSoapEnvelopeTipoS)
  18923.                                         ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(oldTrasformazioneSoapEnvelopeTipoS) : org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  18924.                                 if(trasformazioneRispostaSoapEnvelopeTipo.equals(oldTrasformazioneSoapEnvelopeTipo)) {
  18925.                                     templateRequired = false;
  18926.                                 }  
  18927.                             }
  18928.                            
  18929.                             if(postbackElement != null) {
  18930.                                 if(postbackElement.equals(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO)) {
  18931.                                     old_trasformazioneRispostaSoapEnvelopeTemplate = false;
  18932.                                     templateRequired = true;
  18933.                                 }
  18934.                                
  18935. //                              if(postbackElement.equals(trasformazioneSoapEnvelopeTemplate.getName())) {
  18936. //                                  trasformazioneSoapEnvelopeTipoCheck = CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_FILE;
  18937. //                              }
  18938.                             }
  18939.                            
  18940.                             de = new DataElement();
  18941.                             de.setLabel("");
  18942.                             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO_CHECK);
  18943.                             de.setType(DataElementType.HIDDEN);
  18944.                             de.setValue(trasformazioneRispostaSoapEnvelopeTipoCheck);
  18945.                             dati.add(de);
  18946.                            
  18947.                             if(StringUtils.isNotEmpty(trasformazioneRispostaSoapEnvelopeTipoCheck) && trasformazioneRispostaSoapEnvelopeTipoCheck.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_TIPO))
  18948.                                 templateRequired = true;
  18949.                            
  18950.                             String trasformazioneSoapEnvelopeTemplateLabel = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE;
  18951.                             if(old_trasformazioneRispostaSoapEnvelopeTemplate && StringUtils.isEmpty(trasformazioneRispostaSoapEnvelopeTipoCheck)) {
  18952.                                 trasformazioneSoapEnvelopeTemplateLabel = "";
  18953.                                 DataElement saveAs = new DataElement();
  18954.                                 saveAs.setValue(CostantiControlStation.LABEL_DOWNLOAD_DOCUMENTO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE);
  18955.                                 saveAs.setType(DataElementType.LINK);

  18956.                                 Parameter pIdTrasformazioneRegola = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE, idTrasformazione);
  18957.                                 Parameter pIdTrasformazioneRegolaRisposta = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RISPOSTA, idTrasformazioneRisposta);
  18958.                                 Parameter pIdAccordo = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_ID_ACCORDO, idPorta+"");
  18959.                                 Parameter pTipoAllegato = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, isPortaDelegata ? "pd" : "pa");
  18960.                                 Parameter pTipoDoc = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, isPortaDelegata
  18961.                                         ? ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_DELEGATA_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE
  18962.                                                 : ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_APPLICATIVA_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE);
  18963.                                 saveAs.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT, pIdAccordo, pTipoAllegato, pTipoDoc,pIdTrasformazioneRegola,pIdTrasformazioneRegolaRisposta);
  18964.                                 dati.add(saveAs);
  18965.                             }
  18966.                            
  18967.                            
  18968.                             //  template envelope attachement
  18969.                             DataElement trasformazioneSoapEnvelopeTemplateDataElement = trasformazioneRispostaSoapEnvelopeTemplate.getFileDataElement(trasformazioneSoapEnvelopeTemplateLabel, "", getSize());
  18970.                             trasformazioneSoapEnvelopeTemplateDataElement.setRequired(templateRequired);
  18971.                             dati.add(trasformazioneSoapEnvelopeTemplateDataElement);
  18972.                             dati.addAll(trasformazioneRispostaSoapEnvelopeTemplate.getFileNameDataElement());
  18973.                             dati.add(trasformazioneRispostaSoapEnvelopeTemplate.getFileIdDataElement());
  18974.                         }
  18975.                     }
  18976.                    
  18977.                 }
  18978.             }
  18979.         }
  18980.        
  18981.        
  18982.         return dati;
  18983.     }
  18984.    
  18985.     public boolean trasformazioniCheckData(TipoOperazione tipoOp, long idPorta, String nome, TrasformazioneRegola regolaDBCheck_criteri, TrasformazioneRegola trasformazioneDBCheck_nome,  TrasformazioneRegola oldRegola,
  18986.             ServiceBinding serviceBinding) throws DriverControlStationException {
  18987.         try{
  18988. //          String [] azioni = this.getParameterValues(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI);
  18989. //          String pattern = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  18990. //          String contentType = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CT);
  18991.            
  18992.             if(nome==null || "".equals(nome)) {
  18993.                 this.pd.setMessage("Indicare un valore nel campo '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOME+"'");
  18994.                 return false;
  18995.             }
  18996.             if(!this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOME)) {
  18997.                 return false;
  18998.             }
  18999.            
  19000.             // Se tipoOp = add, controllo che la trasformazione non sia gia' stato registrata
  19001.             if (tipoOp.equals(TipoOperazione.ADD)) {
  19002.                 if (regolaDBCheck_criteri != null) {
  19003.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_REGOLA_TRASFORMAZIONE_APPLICABILITA_DUPLICATA);
  19004.                     return false;
  19005.                 }
  19006.                 else if (trasformazioneDBCheck_nome != null) {
  19007.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_REGOLA_TRASFORMAZIONE_APPLICABILITA_NOME);
  19008.                     return false;
  19009.                 }
  19010.             } else {
  19011.                 // controllo che le modifiche ai parametri non coincidano con altre regole gia' presenti
  19012. //              TrasformazioneRegola trasformazione = this.porteApplicativeCore.getTrasformazione(idPorta, azioniDBCheck, patternDBCheck, contentTypeDBCheck);
  19013.                 if(regolaDBCheck_criteri != null && regolaDBCheck_criteri.getId().longValue() != oldRegola.getId().longValue()) {
  19014.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_REGOLA_TRASFORMAZIONE_APPLICABILITA_DUPLICATA);
  19015.                     return false;
  19016.                 }
  19017.                 else if (trasformazioneDBCheck_nome != null && trasformazioneDBCheck_nome.getId().longValue() != oldRegola.getId().longValue()) {
  19018.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_REGOLA_TRASFORMAZIONE_APPLICABILITA_NOME);
  19019.                     return false;
  19020.                 }
  19021.             }
  19022.            
  19023.            
  19024.             String pattern = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  19025.             if(pattern!=null && StringUtils.isNotEmpty(pattern)) {
  19026.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  19027.                     if(this.checkXPath(pattern,CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN)==false){
  19028.                         return false;
  19029.                     }
  19030.                 }
  19031.                 else {
  19032.                     if(this.checkXPathOrJsonPath(pattern,CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN)==false){
  19033.                         return false;
  19034.                     }
  19035.                 }
  19036.             }
  19037.            
  19038.             return true;
  19039.         } catch (Exception e) {
  19040.             this.logError("Exception: " + e.getMessage(), e);
  19041.             throw new DriverControlStationException(e);
  19042.         }
  19043.     }
  19044.    
  19045.     public boolean trasformazioniRichiestaCheckData(TipoOperazione tipoOp, TrasformazioneRegola oldRegola , ServiceBinding serviceBindingMessage) throws DriverControlStationException {
  19046.         try{
  19047.        
  19048.             String trasformazioneContenutoAbilitatoS  = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_ENABLED);
  19049.             boolean trasformazioneContenutoAbilitato = trasformazioneContenutoAbilitatoS != null ? ServletUtils.isCheckBoxEnabled(trasformazioneContenutoAbilitatoS) : false;
  19050.            
  19051.             if(trasformazioneContenutoAbilitato) {
  19052.                 String trasformazioneContenutoTipoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO);
  19053.                 org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneContenutoTipo =
  19054.                         trasformazioneContenutoTipoS != null ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(trasformazioneContenutoTipoS) :
  19055.                             org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  19056.                
  19057.                 if(trasformazioneContenutoTipo.isTemplateRequired()) {
  19058.                     BinaryParameter trasformazioneContenutoTemplate = this.getBinaryParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE);
  19059.                    
  19060.                     String trasformazioneContenutoTipoCheck = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK);
  19061.                    
  19062.                     if(StringUtils.isNotEmpty(trasformazioneContenutoTipoCheck)) { // ho cambiato il tipo conversione
  19063.                         if((trasformazioneContenutoTemplate.getValue() == null || trasformazioneContenutoTemplate.getValue().length == 0)) {
  19064.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19065.                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE));
  19066.                             return false;
  19067.                         }
  19068.                     } else { // non ho cambiato il template
  19069.                         if((oldRegola.getRichiesta() == null || oldRegola.getRichiesta().getConversioneTemplate() == null)) {
  19070.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19071.                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE));
  19072.                             return false;
  19073.                         }
  19074.                     }
  19075.                 }
  19076.                
  19077.                 String trasformazioneRichiestaContentType = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE);
  19078.                
  19079.                 switch (serviceBindingMessage) {
  19080.                 case REST:
  19081.                     String trasformazioneSoapAbilitatoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_TRANSFORMATION);
  19082.                     boolean trasformazioneSoapAbilitato =  trasformazioneSoapAbilitatoS != null ? ServletUtils.isCheckBoxEnabled(trasformazioneSoapAbilitatoS) : false;
  19083.                    
  19084.                     if(trasformazioneSoapAbilitato) {
  19085.                         String trasformazioneSoapAction = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION);
  19086.                        
  19087.                         if(!this.checkLength255(trasformazioneSoapAction, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION)) {
  19088.                             return false;
  19089.                         }
  19090.                        
  19091.                         if(trasformazioneSoapAction!=null && !"".equals(trasformazioneSoapAction)) {
  19092.                             try{
  19093.                                 DynamicUtils.validate(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION, trasformazioneSoapAction, false);
  19094.                             }catch(Exception e){
  19095.                                 this.pd.setMessage("Il valore indicato nel parametro '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION+"' non risulta corretto: "+e.getMessage());
  19096.                                 return false;
  19097.                             }
  19098.                         }
  19099.                        
  19100.                         String trasformazioneSoapEnvelope = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  19101.                        
  19102.                         if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneSoapEnvelope)) {
  19103.                            
  19104.                             // content-type obbligatorio
  19105.                             if (StringUtils.isEmpty(trasformazioneRichiestaContentType)) {
  19106.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19107.                                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE_ATTACHMENT));
  19108.                                 return false;
  19109.                             }
  19110.                             if(!this.checkLength255(trasformazioneRichiestaContentType, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE_ATTACHMENT)) {
  19111.                                 return false;
  19112.                             }
  19113.                            
  19114.                             String trasformazioneSoapEnvelopeTipoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO);
  19115.                             org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneSoapEnvelopeTipo =
  19116.                                     trasformazioneSoapEnvelopeTipoS != null ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(trasformazioneSoapEnvelopeTipoS) :
  19117.                                     org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  19118.                                    
  19119.                             if(trasformazioneSoapEnvelopeTipo.isTemplateRequired()) {
  19120.                                 BinaryParameter trasformazioneSoapEnvelopeTemplate = this.getBinaryParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE);
  19121.                                
  19122.                                 String trasformazioneSoapEnvelopeTipoCheck = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO_CHECK);
  19123.                                
  19124.                                 if(StringUtils.isNotEmpty(trasformazioneSoapEnvelopeTipoCheck)) { // ho cambiato il tipo conversione
  19125.                                     if((trasformazioneSoapEnvelopeTemplate.getValue() == null || trasformazioneSoapEnvelopeTemplate.getValue().length == 0)) {
  19126.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19127.                                                 CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE));
  19128.                                         return false;
  19129.                                     }
  19130.                                 } else { // non ho cambiato il template
  19131.                                     if((oldRegola.getRichiesta() == null || oldRegola.getRichiesta().getTrasformazioneSoap() == null || oldRegola.getRichiesta().getTrasformazioneSoap().getEnvelopeBodyConversioneTemplate() == null)) {
  19132.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19133.                                                 CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE));
  19134.                                         return false;
  19135.                                     }
  19136.                                 }
  19137.                             }
  19138.                            
  19139.                         }
  19140.                     } else {
  19141.                         // dimensione content-type
  19142.                         if(!this.checkLength255(trasformazioneRichiestaContentType, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE)) {
  19143.                             return false;
  19144.                         }
  19145.                     }
  19146.                     break;
  19147.                 case SOAP:
  19148.                     String trasformazioneRestAbilitatoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_TRANSFORMATION);
  19149.                     boolean trasformazioneRestAbilitato =  trasformazioneRestAbilitatoS != null ? ServletUtils.isCheckBoxEnabled(trasformazioneRestAbilitatoS) : false;
  19150.                     if(trasformazioneRestAbilitato) {
  19151.                         // content-type obbligatorio
  19152.                         if(trasformazioneContenutoTipo.isContentTypeEnabled()) {
  19153.                             if (StringUtils.isEmpty(trasformazioneRichiestaContentType)) {
  19154.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19155.                                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE));
  19156.                                 return false;
  19157.                             }
  19158.                         }
  19159.                         // dimensione content-type
  19160.                         if(!this.checkLength255(trasformazioneRichiestaContentType, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE)) {
  19161.                             return false;
  19162.                         }
  19163.                        
  19164.                        
  19165.                         String trasformazioneRestMethod = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD);
  19166.                        
  19167.                         if (StringUtils.isEmpty(trasformazioneRestMethod)) {
  19168.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19169.                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD));
  19170.                             return false;
  19171.                         }
  19172.                        
  19173.                         String trasformazioneRestPath = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  19174.                        
  19175.                         if (StringUtils.isEmpty(trasformazioneRestPath)) {
  19176.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19177.                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH));
  19178.                             return false;
  19179.                         }
  19180.                         if (!this.checkLength4000(trasformazioneRestPath, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH)) {
  19181.                             return false;
  19182.                         }
  19183.                     }
  19184.                     break;
  19185.                 }
  19186.             }
  19187.            
  19188.            
  19189.             if(ServiceBinding.REST.equals(serviceBindingMessage)) {
  19190.            
  19191.                 String trasformazioneRestMethod = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD);
  19192.                 if (!StringUtils.isEmpty(trasformazioneRestMethod)) {
  19193.                     if (!this.checkLength255(trasformazioneRestMethod, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD)) {
  19194.                         return false;
  19195.                     }
  19196.                 }
  19197.                
  19198.                 String trasformazioneRestPath = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  19199.                 if (!StringUtils.isEmpty(trasformazioneRestPath)) {
  19200.                     if (!this.checkLength4000(trasformazioneRestPath, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH)) {
  19201.                         return false;
  19202.                     }
  19203.                 }
  19204.                
  19205.             }
  19206.            
  19207.            
  19208.             return true;
  19209.         } catch (Exception e) {
  19210.             this.logError("Exception: " + e.getMessage(), e);
  19211.             throw new DriverControlStationException(e);
  19212.         }
  19213.     }
  19214.    
  19215.     public boolean trasformazioniRispostaCheckData(TipoOperazione tipoOp, TrasformazioneRegola regolaRichiesta, TrasformazioneRegolaRisposta oldRegolaRisposta,
  19216.             ServiceBinding serviceBinding) throws DriverControlStationException {
  19217.         try{

  19218.             String nome = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_NOME);
  19219.             if(nome==null || "".equals(nome)) {
  19220.                 this.pd.setMessage("Indicare un valore nel campo '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_NOME+"'");
  19221.                 return false;
  19222.             }
  19223.             if(!this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_NOME)) {
  19224.                 return false;
  19225.             }
  19226.            
  19227.             String returnCode = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS);
  19228.             String statusMinS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MIN);
  19229.             String statusMaxS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MAX);
  19230.        
  19231.             if(_checkReturnCode(returnCode, statusMinS, statusMaxS,
  19232.                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS,
  19233.                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MIN,
  19234.                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_STATUS_MAX)==false) {
  19235.                 return false;
  19236.             }
  19237.            
  19238.             String pattern = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN);
  19239.             if(pattern!=null && StringUtils.isNotEmpty(pattern)) {
  19240.                 if(ServiceBinding.SOAP.equals(serviceBinding)) {
  19241.                     if(this.checkXPath(pattern,CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN)==false){
  19242.                         return false;
  19243.                     }
  19244.                 }
  19245.                 else {
  19246.                     if(this.checkXPathOrJsonPath(pattern,CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_APPLICABILITA_PATTERN)==false){
  19247.                         return false;
  19248.                     }
  19249.                 }
  19250.             }
  19251.            
  19252.             // Se tipoOp = add, controllo che la trasformazione risposta non sia gia' stato registrata
  19253.             if (tipoOp.equals(TipoOperazione.CHANGE)) {
  19254.                
  19255.                 boolean trasformazioneRichiestaRestAbilitato = false;
  19256.                 if(regolaRichiesta.getRichiesta() != null) {
  19257.                     trasformazioneRichiestaRestAbilitato = regolaRichiesta.getRichiesta().getTrasformazioneRest() != null;
  19258.                 }
  19259.                
  19260.                 String trasformazioneContenutoRispostaAbilitatoS  = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_ENABLED);
  19261.                 boolean trasformazioneContenutoRispostaAbilitato = trasformazioneContenutoRispostaAbilitatoS != null ? ServletUtils.isCheckBoxEnabled(trasformazioneContenutoRispostaAbilitatoS) : false;
  19262.                
  19263.                 if(trasformazioneContenutoRispostaAbilitato) {
  19264.                     String trasformazioneContenutoRispostaTipoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO);
  19265.                     org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneContenutoRispostaTipo =
  19266.                             trasformazioneContenutoRispostaTipoS != null ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(trasformazioneContenutoRispostaTipoS) :
  19267.                                 org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  19268.                    
  19269.                     if(trasformazioneContenutoRispostaTipo.isTemplateRequired()) {
  19270.                         BinaryParameter trasformazioneContenutoTemplate = this.getBinaryParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE);
  19271.                        
  19272.                         String trasformazioneContenutoRispostaTipoCheck = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TIPO_CHECK);
  19273.                        
  19274.                         if(StringUtils.isNotEmpty(trasformazioneContenutoRispostaTipoCheck)) { // ho cambiato il tipo conversione
  19275.                             if((trasformazioneContenutoTemplate.getValue() == null || trasformazioneContenutoTemplate.getValue().length == 0)) {
  19276.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19277.                                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE));
  19278.                                 return false;
  19279.                             }
  19280.                         } else { // non ho cambiato il template
  19281.                             if(oldRegolaRisposta.getConversioneTemplate() == null) {
  19282.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19283.                                         CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONVERSIONE_TEMPLATE));
  19284.                                 return false;
  19285.                             }
  19286.                         }
  19287.                     }
  19288.                    
  19289.                     String trasformazioneRispostaContentType = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE);
  19290.                    
  19291.                     String trasformazioneRispostaReturnCode = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE);
  19292.                    
  19293.                     if(trasformazioneRispostaReturnCode!=null && StringUtils.isNotEmpty(trasformazioneRispostaReturnCode) && !trasformazioneRispostaReturnCode.contains("${")) { // altrimenti vi è una risoluzione dinamica
  19294.                         try {
  19295.                             int returnCodeEsatto = Integer.parseInt(trasformazioneRispostaReturnCode);
  19296.                            
  19297.                             if(returnCodeEsatto < 200) {
  19298.                                 this.pd.setMessage("Il valore inserito nel campo "+ CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE + " non &egrave; valido, sono ammessi valori compresi tra 200 e 599.");
  19299.                                 return false;
  19300.                             }
  19301.                             if(returnCodeEsatto > 599) {
  19302.                                 this.pd.setMessage("Il valore inserito nel campo "+ CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE + " non &egrave; valido, sono ammessi valori compresi tra 200 e 599.");
  19303.                                 return false;
  19304.                             }
  19305.                         }catch(Exception e) {
  19306.                             this.pd.setMessage("Il formato del campo "+ CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_RETURN_CODE + " non &egrave; valido.");
  19307.                             return false;
  19308.                         }
  19309.                     }
  19310.                    
  19311.                     if(trasformazioneContenutoRispostaTipo.isTrasformazioneProtocolloEnabled() && trasformazioneRichiestaRestAbilitato) {
  19312.                    
  19313.                         String trasformazioneSoapAbilitatoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_TRANSFORMATION);
  19314.                         boolean trasformazioneSoapAbilitato =  trasformazioneSoapAbilitatoS != null ? ServletUtils.isCheckBoxEnabled(trasformazioneSoapAbilitatoS) : false;
  19315.                        
  19316.                         if(trasformazioneSoapAbilitato) {
  19317.                             String trasformazioneSoapEnvelope = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE);
  19318.                            
  19319.                             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneSoapEnvelope)) {
  19320.                                
  19321.                                 // content-type obbligatorio
  19322.                                 if (StringUtils.isEmpty(trasformazioneRispostaContentType)) {
  19323.                                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19324.                                             CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE_ATTACHMENT));
  19325.                                     return false;
  19326.                                 }
  19327.                                 if(!this.checkLength255(trasformazioneRispostaContentType, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE_ATTACHMENT)) {
  19328.                                     return false;
  19329.                                 }
  19330.                                
  19331.                                 String trasformazioneSoapEnvelopeTipoS = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO);
  19332.                                 org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneSoapEnvelopeTipo =
  19333.                                         trasformazioneSoapEnvelopeTipoS != null ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(trasformazioneSoapEnvelopeTipoS) :
  19334.                                         org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  19335.                                        
  19336.                                 if(trasformazioneSoapEnvelopeTipo.isTemplateRequired()) {
  19337.                                     BinaryParameter trasformazioneSoapEnvelopeTemplate = this.getBinaryParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE);
  19338.                                    
  19339.                                     String trasformazioneSoapEnvelopeTipoCheck = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TIPO_CHECK);
  19340.                                    
  19341.                                     if(StringUtils.isNotEmpty(trasformazioneSoapEnvelopeTipoCheck)) { // ho cambiato il tipo conversione
  19342.                                         if((trasformazioneSoapEnvelopeTemplate.getValue() == null || trasformazioneSoapEnvelopeTemplate.getValue().length == 0)) {
  19343.                                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19344.                                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE));
  19345.                                             return false;
  19346.                                         }
  19347.                                     } else { // non ho cambiato il template
  19348.                                         if(oldRegolaRisposta.getTrasformazioneSoap().getEnvelopeBodyConversioneTemplate() == null) {
  19349.                                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
  19350.                                                     CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_SOAP_ENVELOPE_TEMPLATE));
  19351.                                             return false;
  19352.                                         }
  19353.                                     }
  19354.                                 }
  19355.                             }
  19356.                         } else {
  19357.                             // dimensione content-type
  19358.                             if(!this.checkLength255(trasformazioneRispostaContentType, PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_TRASFORMAZIONI_RISPOSTA_CONTENT_TYPE)) {
  19359.                                 return false;
  19360.                             }
  19361.                         }
  19362.                      
  19363.                     }
  19364.                 }
  19365.             }
  19366.            
  19367.             return true;
  19368.         } catch (Exception e) {
  19369.             this.logError("Exception: " + e.getMessage(), e);
  19370.             throw new DriverControlStationException(e);
  19371.         }
  19372.     }
  19373.    
  19374.     public List<DataElement> addTrasformazioneToDatiOpAdd(List<DataElement> dati, Object oggetto, String nome,
  19375.             String stato, boolean azioniAll, String[] azioniDisponibiliList, String[] azioniDisponibiliLabelList, String[] azioni, String pattern, String contentType,
  19376.             String [] connettoriDisponibiliList, String [] connettoriDisponibiliLabelList, String [] connettori,
  19377.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding, boolean isPortaDelegata) throws DriverControlStationException {
  19378.         return addTrasformazioneToDati(TipoOperazione.ADD, dati, oggetto, null, nome,
  19379.                 stato, azioniAll, azioniDisponibiliList, azioniDisponibiliLabelList, azioni, pattern, contentType,
  19380.                 connettoriDisponibiliList, connettoriDisponibiliLabelList, connettori,
  19381.                 serviceBinding,
  19382.                 null, null, null, null, 0, isPortaDelegata, null,null,0,null,null,0);
  19383.     }
  19384.    
  19385.     public List<DataElement> addTrasformazioneToDati(TipoOperazione tipoOP, List<DataElement> dati, Object oggetto, String idTrasformazione, String nome,
  19386.             String stato, boolean azioniAll, String[] azioniDisponibiliList, String[] azioniDisponibiliLabelList, String[] azioni, String pattern, String contentType,
  19387.             String [] connettoriDisponibiliList, String [] connettoriDisponibiliLabelList, String [] connettori,
  19388.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding,
  19389.             String servletTrasformazioniRichiesta, List<Parameter> parametriInvocazioneServletTrasformazioniRichiesta, String servletTrasformazioniRispostaList, List<Parameter> parametriInvocazioneServletTrasformazioniRisposta,
  19390.             int numeroTrasformazioniRisposte, boolean isPortaDelegata, String servletTrasformazioniAutorizzazioneAutenticati,  List<Parameter> parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati , int numAutenticati,
  19391.             String servletTrasformazioniApplicativiAutenticati,  List<Parameter> parametriInvocazioneServletTrasformazioniApplicativiAutenticati , int numApplicativiAutenticati) throws DriverControlStationException {
  19392.        
  19393.         // Id hidden
  19394.         DataElement de = new DataElement();
  19395.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19396.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19397.         de.setType(DataElementType.HIDDEN);
  19398.         de.setValue(idTrasformazione);
  19399.         dati.add(de);
  19400.        
  19401.         // First
  19402.         de = new DataElement();
  19403.         de.setValue("first");
  19404.         de.setType(DataElementType.HIDDEN);
  19405.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_FIRST);
  19406.         dati.add(de);
  19407.        
  19408.         de = new DataElement();
  19409.         de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_TRASFORMAZIONE);
  19410.         de.setType(DataElementType.TITLE);
  19411.         dati.add(de);
  19412.        
  19413.         // Nome
  19414.         de = new DataElement();
  19415.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOME);
  19416.         de.setValue(nome);
  19417.         de.setType(DataElementType.TEXT_EDIT);
  19418.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOME);
  19419.         de.setRequired(true);
  19420.         dati.add(de);
  19421.        
  19422.         // Stato
  19423.         de = new DataElement();
  19424.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_STATO);
  19425.         if(stato==null || "".equals(stato)) {
  19426.             stato = StatoFunzionalita.ABILITATO.getValue();
  19427.         }
  19428.         de.setSelected(stato);
  19429.         de.setType(DataElementType.SELECT);
  19430.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_STATO);
  19431.         de.setValues(ConfigurazioneCostanti.STATI);
  19432.         de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATI);
  19433.         dati.add(de);
  19434.        
  19435.         de = new DataElement();
  19436.         de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA);
  19437.         de.setType(DataElementType.SUBTITLE);
  19438.         dati.add(de);
  19439.                
  19440.         // Azione
  19441.        
  19442.         de = new DataElement();
  19443.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI_ALL);
  19444.         de.setPostBack(true);
  19445.         de.setValues(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI_ALL_VALUES);
  19446.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19447.             de.setLabels(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_RISORSE_ALL_VALUES);
  19448.         }
  19449.         else {
  19450.             de.setLabels(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI_ALL_VALUES);
  19451.         }
  19452.         if(azioniAll) {
  19453.             de.setSelected(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI_ALL_VALUE_TRUE);
  19454.         }
  19455.         else {
  19456.             de.setSelected(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI_ALL_VALUE_FALSE);
  19457.         }
  19458.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19459.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_RISORSE);
  19460.         }
  19461.         else {
  19462.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI);
  19463.         }
  19464.         de.setType(DataElementType.SELECT);
  19465.         dati.add(de);
  19466.        
  19467.         if(!azioniAll) {
  19468.             de = new DataElement();
  19469.             de.setLabel("");
  19470.             de.setValues(azioniDisponibiliList);
  19471.             de.setLabels(azioniDisponibiliLabelList);
  19472.             de.setSelezionati(azioni);
  19473.             de.setType(DataElementType.MULTI_SELECT);
  19474.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_AZIONI);
  19475.             de.setRows(15);
  19476.     //      de.setRequired(true);
  19477.             dati.add(de);
  19478.         }
  19479.        
  19480.         // Content-type
  19481.         de = new DataElement();
  19482.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CT);
  19483.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CT);
  19484.         de.setType(DataElementType.TEXT_EDIT);
  19485.         de.setValue(contentType);
  19486.         de.enableTags();
  19487. //      de.setRequired(true);
  19488.         DataElementInfo dInfoCT = new DataElementInfo(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA+" - "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CT);
  19489.         dInfoCT.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_CONTENT_TYPE);
  19490.         dInfoCT.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_CONTENT_TYPE_VALORI);
  19491.         de.setInfo(dInfoCT);
  19492.         dati.add(de);
  19493.        
  19494.         // Pattern
  19495.         de = new DataElement();
  19496.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  19497.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  19498.         de.setType(DataElementType.TEXT_AREA);
  19499.         de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_SIZE);
  19500.         de.setSize(this.getSize());
  19501.         de.setValue(pattern);
  19502. //      de.setRequired(true);
  19503.         DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA+" - "+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_PATTERN);
  19504.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19505.             dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_REST_RICHIESTA);
  19506.             dInfoPattern.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_VALORI_REST);
  19507.         }
  19508.         else {
  19509.             dInfoPattern.setBody(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_PATTERN_SOAP_RICHIESTA);
  19510.         }
  19511.         de.setInfo(dInfoPattern);
  19512.         dati.add(de);
  19513.        
  19514.         if(connettoriDisponibiliList!=null && connettoriDisponibiliList.length>0) {
  19515.             de = new DataElement();
  19516.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CONNETTORI);
  19517.             de.setValues(connettoriDisponibiliList);
  19518.             de.setLabels(connettoriDisponibiliLabelList);
  19519.             de.setSelezionati(connettori);
  19520.             de.setType(DataElementType.MULTI_SELECT);
  19521.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_CONNETTORI);
  19522.             de.setRows(10);
  19523.     //      de.setRequired(true);
  19524.             dati.add(de);
  19525.         }
  19526.                        
  19527.         // in edit faccio vedere i link per configurare la richiesta e le risposte
  19528.         if(tipoOP.equals(TipoOperazione.CHANGE)) {
  19529.            
  19530.             Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
  19531.             boolean autenticazione = false;
  19532.             String protocollo = null;
  19533.             boolean isSupportatoAutenticazione;
  19534.             boolean autenticazioneToken = false;
  19535.            
  19536.             TrasformazioneRegola tr = null;
  19537.             if(isPortaDelegata){
  19538.                 PortaDelegata pd = (PortaDelegata) oggetto;
  19539.                 if(pd!=null) {
  19540.                     autenticazione = !TipoAutenticazione.DISABILITATO.equals(pd.getAutenticazione());
  19541.                 }
  19542.                 isSupportatoAutenticazione = true;
  19543.                 if(pd!=null && pd.getServizio()!=null && pd.getServizio().getTipo()!=null) {
  19544.                     try {
  19545.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pd.getServizio().getTipo());
  19546.                     }catch(Exception e) {
  19547.                         throw new DriverControlStationException(e.getMessage(),e);
  19548.                     }
  19549.                 }
  19550.                 if(pd!=null && pd.getTrasformazioni()!=null && pd.getTrasformazioni().sizeRegolaList()>0) {
  19551.                     for (TrasformazioneRegola trCheck : pd.getTrasformazioni().getRegolaList()){
  19552.                         if(trCheck.getNome().equals(nome)) {
  19553.                             tr = trCheck;
  19554.                             break;
  19555.                         }
  19556.                     }
  19557.                 }
  19558.                 if(pd!=null) {
  19559.                     autenticazioneToken = pd.getGestioneToken()!=null && pd.getGestioneToken().getPolicy()!=null;
  19560.                 }
  19561.             }else {
  19562.                 PortaApplicativa pa = (PortaApplicativa) oggetto;
  19563.                 if(pa!=null) {
  19564.                     autenticazione = !TipoAutenticazione.DISABILITATO.equals(pa.getAutenticazione());
  19565.                 }
  19566.                 if(pa!=null && pa.getServizio()!=null && pa.getServizio().getTipo()!=null) {
  19567.                     try {
  19568.                         protocollo = this.apsCore.getProtocolloAssociatoTipoServizio(pa.getServizio().getTipo());
  19569.                     }catch(Exception e) {
  19570.                         throw new DriverControlStationException(e.getMessage(),e);
  19571.                     }
  19572.                 }
  19573.                 try {
  19574.                     isSupportatoAutenticazione = this.soggettiCore.isSupportatoAutenticazioneApplicativiErogazione(protocollo);
  19575.                 }catch(Exception e) {
  19576.                     throw new DriverControlStationException(e.getMessage(),e);
  19577.                 }
  19578.                 if(pa!=null && pa.getTrasformazioni()!=null && pa.getTrasformazioni().sizeRegolaList()>0) {
  19579.                     for (TrasformazioneRegola trCheck : pa.getTrasformazioni().getRegolaList()){
  19580.                         if(trCheck.getNome().equals(nome)) {
  19581.                             tr = trCheck;
  19582.                             break;
  19583.                         }
  19584.                     }
  19585.                 }
  19586.                 if(pa!=null) {
  19587.                     autenticazioneToken = pa.getGestioneToken()!=null && pa.getGestioneToken().getPolicy()!=null;
  19588.                 }
  19589.             }
  19590.            
  19591.            
  19592.             // soggetti o applicativi
  19593.             if(servletTrasformazioniAutorizzazioneAutenticati !=null && (autenticazione || autenticazioneToken) ){
  19594.                 de = new DataElement();
  19595.                 de.setType(DataElementType.LINK);
  19596.                 de.setUrl(servletTrasformazioniAutorizzazioneAutenticati, parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.toArray(new Parameter[parametriInvocazioneServletTrasformazioniAutorizzazioneAutenticati.size()]));
  19597.                 if(isPortaDelegata){
  19598.                     String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI;
  19599.                     if(!this.isModalitaCompleta()) {
  19600.                         labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;
  19601.                     }
  19602.                     if (contaListe) {
  19603.                         ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numAutenticati));
  19604.                     } else
  19605.                         ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  19606.                 }
  19607.                 else{
  19608.                     if (contaListe) {
  19609.                         ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI,Long.valueOf(numAutenticati));
  19610.                     } else
  19611.                         ServletUtils.setDataElementCustomLabel(de,PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_SOGGETTI);
  19612.                 }
  19613.                 dati.add(de);
  19614.             }
  19615.            
  19616.             // servizi applicativi
  19617.             boolean showLinkApplicativi = false;
  19618.             if(!isPortaDelegata && servletTrasformazioniApplicativiAutenticati!=null) {
  19619.                 if(autenticazioneToken) {
  19620.                     showLinkApplicativi = true;
  19621.                 }
  19622.                 else {
  19623.                     showLinkApplicativi = autenticazione && isSupportatoAutenticazione; // il link degli applicativi sulla pa deve essere visualizzato SOLO se è abilitata l'autenticazione
  19624.                 }
  19625.             }
  19626.             if(showLinkApplicativi){
  19627.                 de = new DataElement();
  19628.                 de.setType(DataElementType.LINK);
  19629.                 de.setUrl(servletTrasformazioniApplicativiAutenticati, parametriInvocazioneServletTrasformazioniApplicativiAutenticati.toArray(new Parameter[parametriInvocazioneServletTrasformazioniApplicativiAutenticati.size()]));
  19630.                 String labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_SERVIZI_APPLICATIVI; // uso cmq label PD
  19631.                 if(!this.isModalitaCompleta()) {
  19632.                     labelApplicativi = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_APPLICATIVI;// uso cmq label PD
  19633.                 }
  19634.                 if (contaListe) {
  19635.                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi,Long.valueOf(numApplicativiAutenticati));
  19636.                 } else {
  19637.                     ServletUtils.setDataElementCustomLabel(de,labelApplicativi);
  19638.                 }
  19639.                 dati.add(de);
  19640.             }
  19641.        
  19642.             de = new DataElement();
  19643.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_REGOLE_TRASFORMAZIONE);
  19644.             de.setType(DataElementType.TITLE);
  19645.             dati.add(de);
  19646.            
  19647.             // Richiesta
  19648.             de = new DataElement();
  19649.             de.setType(DataElementType.LINK);
  19650.             StringBuilder sb = new StringBuilder();
  19651.             if(tr!=null && tr.getRichiesta()!=null) {
  19652.                 if(tr.getRichiesta().sizeHeaderList()>0
  19653.                         ||
  19654.                         tr.getRichiesta().sizeParametroUrlList()>0
  19655.                         ||
  19656.                         (
  19657.                                 org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding) && tr.getRichiesta().getTrasformazioneRest()!=null
  19658.                                 &&
  19659.                                 (
  19660.                                     (tr.getRichiesta().getTrasformazioneRest().getMetodo()!=null && StringUtils.isNotEmpty(tr.getRichiesta().getTrasformazioneRest().getMetodo()))
  19661.                                     ||
  19662.                                     (tr.getRichiesta().getTrasformazioneRest().getPath()!=null && StringUtils.isNotEmpty(tr.getRichiesta().getTrasformazioneRest().getPath()))
  19663.                                 )
  19664.                         )
  19665.                     ){
  19666.                     if(sb.length()>0) {
  19667.                         sb.append(", ");
  19668.                     }
  19669.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_TRASPORTO.toLowerCase());
  19670.                 }
  19671.                 if(tr.getRichiesta().getConversioneTemplate()!=null) {
  19672.                     if(sb.length()>0) {
  19673.                         sb.append(", ");
  19674.                     }
  19675.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_CONTENUTO.toLowerCase());
  19676.                 }
  19677.                 if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding) && tr.getRichiesta().getTrasformazioneSoap()!=null) {
  19678.                     if(sb.length()>0) {
  19679.                         sb.append(", ");
  19680.                     }
  19681.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_SOAP.toLowerCase());
  19682.                 }
  19683.                 if(org.openspcoop2.core.registry.constants.ServiceBinding.SOAP.equals(serviceBinding) && tr.getRichiesta().getTrasformazioneRest()!=null) {
  19684.                     if(sb.length()>0) {
  19685.                         sb.append(", ");
  19686.                     }
  19687.                     sb.append(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_REST.toLowerCase());
  19688.                 }
  19689.             }
  19690.             if(sb.length()>0) {
  19691.                 //de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA+" (" + sb.toString()+ ")");
  19692.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA+" (" + CostantiConfigurazione.ABILITATO.getValue().toLowerCase()+ ")");
  19693.             }
  19694.             else {
  19695.                 //de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA);
  19696.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA+" (" + CostantiConfigurazione.DISABILITATO.getValue().toLowerCase()+ ")");
  19697.             }
  19698.             de.setUrl(servletTrasformazioniRichiesta, parametriInvocazioneServletTrasformazioniRichiesta.toArray(new Parameter[parametriInvocazioneServletTrasformazioniRichiesta.size()]));
  19699.             dati.add(de);
  19700.            
  19701.             // Risposta
  19702.             de = new DataElement();
  19703.             de.setType(DataElementType.LINK);
  19704.             boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
  19705.             if (contaListeFromSession)
  19706.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTE+" (" + numeroTrasformazioniRisposte + ")");
  19707.             else
  19708.                 de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTE);
  19709.             de.setUrl(servletTrasformazioniRispostaList, parametriInvocazioneServletTrasformazioniRisposta.toArray(new Parameter[parametriInvocazioneServletTrasformazioniRisposta.size()]));
  19710.             dati.add(de);
  19711.         }
  19712.        
  19713.         return dati;
  19714.     }
  19715.    
  19716.     public List<DataElement> addTrasformazioneRichiestaHeaderToDati(TipoOperazione tipoOP, String protocollo, boolean isPortaDelegata, List<DataElement> dati,
  19717.             String idTrasformazione, String idTrasformazioneRichiestaHeader, String nome, String tipo, String valore, String identificazione,
  19718.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding) {
  19719.        
  19720.         DataElement de = new DataElement();
  19721.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER);
  19722.         de.setType(DataElementType.TITLE);
  19723.         dati.add(de);
  19724.        
  19725.         // Id trasformazione hidden
  19726.         de = new DataElement();
  19727.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19728.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19729.         de.setType(DataElementType.HIDDEN);
  19730.         de.setValue(idTrasformazione);
  19731.         dati.add(de);
  19732.        
  19733.         // id trasformazione richiesta header
  19734.         de = new DataElement();
  19735.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19736.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RICHIESTA_HEADER);
  19737.         de.setType(DataElementType.HIDDEN);
  19738.         de.setValue(idTrasformazioneRichiestaHeader);
  19739.         dati.add(de);
  19740.        
  19741.         // Tipo
  19742.         de = new DataElement();
  19743.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO);
  19744.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO);
  19745.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19746.         de.setLabels(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19747.         de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19748.         de.setType(DataElementType.SELECT);
  19749.         de.setSelected(tipo);
  19750.         de.setRequired(true);
  19751.         de.setPostBack(true);
  19752.         //} else {
  19753.         //  de.setType(DataElementType.TEXT);
  19754.         //  de.setValue(tipo);
  19755.         //}
  19756.         dati.add(de);
  19757.        
  19758.         // Nome
  19759.         de = new DataElement();
  19760.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME);
  19761.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME);
  19762.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19763.         de.setType(DataElementType.TEXT_EDIT);
  19764.         de.setRequired(true);
  19765.         //} else {
  19766.         //  de.setType(DataElementType.TEXT);
  19767.         //}
  19768.         de.setValue(nome);
  19769.         dati.add(de);
  19770.        
  19771.         // Valore
  19772.         de = new DataElement();
  19773.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE);
  19774.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE);
  19775.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  19776.             de.setType(DataElementType.TEXT_AREA);
  19777.             de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_SIZE);
  19778.             de.setSize(this.getSize());
  19779.             de.setRequired(true);
  19780.            
  19781.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE);
  19782.             dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  19783.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19784.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  19785.             }
  19786.             else {
  19787.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  19788.             }
  19789.             de.setInfo(dInfoPattern);
  19790.         }
  19791.         else {
  19792.             de.setType(DataElementType.HIDDEN);
  19793.         }
  19794.         de.setValue(valore);
  19795.         dati.add(de);
  19796.        
  19797.         // Identificazione Risorsa Fallita
  19798.         de = new DataElement();
  19799.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_IDENTIFICAZIONE);
  19800.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_IDENTIFICAZIONE);
  19801.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  19802.             de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA_HEADER);
  19803.             de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA);
  19804.             de.setType(DataElementType.SELECT);
  19805.             de.setSelected(identificazione);
  19806.            
  19807.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_IDENTIFICAZIONE);
  19808.             dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE);
  19809.             dInfoPattern.setListBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE_VALORI_HEADER);
  19810.             de.setInfo(dInfoPattern);
  19811.         } else {
  19812.             de.setType(DataElementType.HIDDEN);
  19813.         }
  19814.         de.setValue(identificazione);
  19815.         dati.add(de);
  19816.        
  19817.         return dati;
  19818.     }
  19819.    
  19820.     public List<DataElement> addTrasformazioneRichiestaUrlParameterToDati(TipoOperazione tipoOP, String protocollo, boolean isPortaDelegata, List<DataElement> dati,
  19821.             String idTrasformazione, String idTrasformazioneRichiestaUrlParameter, String nome, String tipo, String valore, String identificazione,
  19822.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding) {
  19823.        
  19824.         DataElement de = new DataElement();
  19825.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO);
  19826.         de.setType(DataElementType.TITLE);
  19827.         dati.add(de);
  19828.        
  19829.         // Id trasformazione hidden
  19830.         de = new DataElement();
  19831.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19832.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19833.         de.setType(DataElementType.HIDDEN);
  19834.         de.setValue(idTrasformazione);
  19835.         dati.add(de);
  19836.        
  19837.         // id trasformazione richiesta header
  19838.         de = new DataElement();
  19839.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19840.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RICHIESTA_PARAMETRO);
  19841.         de.setType(DataElementType.HIDDEN);
  19842.         de.setValue(idTrasformazioneRichiestaUrlParameter);
  19843.         dati.add(de);
  19844.        
  19845.         // Tipo
  19846.         de = new DataElement();
  19847.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO);
  19848.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO);
  19849.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19850.         de.setLabels(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19851.         de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19852.         de.setType(DataElementType.SELECT);
  19853.         de.setSelected(tipo);
  19854.         de.setRequired(true);
  19855.         de.setPostBack(true);
  19856.         //} else {
  19857.         //de.setType(DataElementType.TEXT);
  19858.         //de.setValue(tipo);
  19859.         //}
  19860.         dati.add(de);
  19861.        
  19862.         // Nome
  19863.         de = new DataElement();
  19864.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME);
  19865.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME);
  19866.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19867.         de.setType(DataElementType.TEXT_EDIT);
  19868.         de.setRequired(true);
  19869.         //} else {
  19870.         //  de.setType(DataElementType.TEXT);
  19871.         //}
  19872.         de.setValue(nome);
  19873.         dati.add(de);
  19874.        
  19875.         // Valore
  19876.         de = new DataElement();
  19877.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE);
  19878.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE);
  19879.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  19880.             de.setType(DataElementType.TEXT_AREA);
  19881.             de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_SIZE);
  19882.             de.setSize(this.getSize());
  19883.             de.setRequired(true);
  19884.            
  19885.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE);
  19886.             dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  19887.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19888.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  19889.             }
  19890.             else {
  19891.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  19892.             }
  19893.             de.setInfo(dInfoPattern);
  19894.         }
  19895.         else {
  19896.             de.setType(DataElementType.HIDDEN);
  19897.         }
  19898.         de.setValue(valore);
  19899.         dati.add(de);
  19900.        
  19901.         // Identificazione Risorsa Fallita
  19902.         de = new DataElement();
  19903.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_IDENTIFICAZIONE);
  19904.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_IDENTIFICAZIONE);
  19905.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  19906.             de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA_PARAMETRO);
  19907.             de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA);
  19908.             de.setType(DataElementType.SELECT);
  19909.             de.setSelected(identificazione);
  19910.            
  19911.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_IDENTIFICAZIONE);
  19912.             dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE);
  19913.             dInfoPattern.setListBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE_VALORI_PARAMETRO);
  19914.             de.setInfo(dInfoPattern);
  19915.         } else {
  19916.             de.setType(DataElementType.HIDDEN);
  19917.         }
  19918.         de.setValue(identificazione);
  19919.         dati.add(de);
  19920.        
  19921.         return dati;
  19922.     }
  19923.    
  19924.     public List<DataElement> addTrasformazioneRispostaHeaderToDati(TipoOperazione tipoOP, String protocollo, boolean isPortaDelegata, List<DataElement> dati,
  19925.             String idTrasformazione, String idTrasformazioneRisposta, String idTrasformazioneRispostaHeader, String nome, String tipo, String valore, String identificazione,
  19926.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding) {
  19927.        
  19928.         DataElement de = new DataElement();
  19929.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER);
  19930.         de.setType(DataElementType.TITLE);
  19931.         dati.add(de);
  19932.        
  19933.         // Id trasformazione hidden
  19934.         de = new DataElement();
  19935.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19936.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19937.         de.setType(DataElementType.HIDDEN);
  19938.         de.setValue(idTrasformazione);
  19939.         dati.add(de);
  19940.        
  19941.         // id trasformazione risposta
  19942.         de = new DataElement();
  19943.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19944.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RISPOSTA);
  19945.         de.setType(DataElementType.HIDDEN);
  19946.         de.setValue(idTrasformazioneRisposta);
  19947.         dati.add(de);
  19948.        
  19949.         // id trasformazione risposta header
  19950.         de = new DataElement();
  19951.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  19952.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE_RISPOSTA_HEADER);
  19953.         de.setType(DataElementType.HIDDEN);
  19954.         de.setValue(idTrasformazioneRispostaHeader);
  19955.         dati.add(de);
  19956.        
  19957.         // Tipo
  19958.         de = new DataElement();
  19959.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO);
  19960.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO);
  19961.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19962.         de.setLabels(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19963.         de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO);
  19964.         de.setType(DataElementType.SELECT);
  19965.         de.setSelected(tipo);
  19966.         de.setPostBack(true);
  19967.         //} else {
  19968.         //  de.setType(DataElementType.TEXT);
  19969.         //  de.setValue(tipo);
  19970.         //}
  19971.         dati.add(de);
  19972.        
  19973.         // Nome
  19974.         de = new DataElement();
  19975.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME);
  19976.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME);
  19977.         //if(tipoOP.equals(TipoOperazione.ADD)) {
  19978.         de.setType(DataElementType.TEXT_EDIT);
  19979.         de.setRequired(true);
  19980.         //} else {
  19981.         //  de.setType(DataElementType.TEXT);
  19982.         //}
  19983.        
  19984.         de.setValue(nome);
  19985.         dati.add(de);
  19986.        
  19987.         // Valore
  19988.         de = new DataElement();
  19989.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  19990.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  19991.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  19992.             de.setType(DataElementType.TEXT_AREA);
  19993.             de.setRows(CostantiControlStation.LABEL_PARAMETRO_TEXT_AREA_SIZE);
  19994.             de.setRequired(true);
  19995.            
  19996.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  19997.             dInfoPattern.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  19998.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  19999.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20000.             }
  20001.             else {
  20002.                 dInfoPattern.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20003.             }
  20004.             de.setInfo(dInfoPattern);
  20005.         }
  20006.         else {
  20007.             de.setType(DataElementType.HIDDEN);
  20008.         }
  20009.         de.setValue(valore);
  20010.         dati.add(de);
  20011.        
  20012.         // Identificazione Risorsa Fallita
  20013.         de = new DataElement();
  20014.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_IDENTIFICAZIONE);
  20015.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_IDENTIFICAZIONE);
  20016.         if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  20017.             de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA_HEADER);
  20018.             de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_IDENTIFICAZIONE_FALLITA);
  20019.             de.setType(DataElementType.SELECT);
  20020.             de.setSelected(identificazione);
  20021.            
  20022.             DataElementInfo dInfoPattern = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_IDENTIFICAZIONE);
  20023.             dInfoPattern.setHeaderBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE);
  20024.             dInfoPattern.setListBody(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_NOTE_VALORI_HEADER);
  20025.             de.setInfo(dInfoPattern);
  20026.         } else {
  20027.             de.setType(DataElementType.HIDDEN);
  20028.         }
  20029.         de.setValue(identificazione);
  20030.         dati.add(de);
  20031.        
  20032.         return dati;
  20033.     }
  20034.    
  20035.     public DataElement getHttpMethodDataElementTrasformazione(TipoOperazione tipoOperazione, String httpMethod) {
  20036.         return this.getHttpMethodDataElement(tipoOperazione, httpMethod, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD,
  20037.                 CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD,
  20038.                 false, null, null);
  20039.     }
  20040.    
  20041.     public List<DataElement> addTrasformazioneRichiestaToDati(TipoOperazione tipoOP, String protocollo, List<DataElement> dati, long idPorta, TrasformazioneRegolaRichiesta richiesta, boolean isPortaDelegata, String idTrasformazione,
  20042.             boolean trasformazioneContenutoAbilitato, org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneContenutoTipo, BinaryParameter trasformazioneContenutoTemplate, String trasformazioneContenutoTipoCheck,
  20043.             String trasformazioneRichiestaContentType,
  20044.             ServiceBinding serviceBindingMessage, boolean trasformazioneRestAbilitato, String trasformazioneRestMethod, String trasformazioneRestPath,
  20045.             boolean trasformazioneSoapAbilitato, String trasformazioneSoapAction, String trasformazioneSoapVersion, String trasformazioneSoapEnvelope,  
  20046.             org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneSoapEnvelopeTipo, BinaryParameter trasformazioneSoapEnvelopeTemplate, String trasformazioneSoapEnvelopeTipoCheck,
  20047.             String servletTrasformazioniRichiestaHeadersList, List<Parameter> parametriInvocazioneServletTrasformazioniRichiestaHeaders, int numeroTrasformazioniRichiestaHeaders,
  20048.             String servletTrasformazioniRichiestaParametriList, List<Parameter> parametriInvocazioneServletTrasformazioniRichiestaParametri, int numeroTrasformazioniRichiestaParametri,
  20049.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding) throws DriverControlStationException {
  20050.        
  20051.         DataElementInfo dInfoPatternTrasporto = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  20052.         dInfoPatternTrasporto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TRASPORTO);
  20053.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  20054.             dInfoPatternTrasporto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20055.         }
  20056.         else {
  20057.             dInfoPatternTrasporto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20058.         }
  20059.        
  20060.         // Id trasformazione hidden
  20061.         DataElement  de = new DataElement();
  20062.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20063.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20064.         de.setType(DataElementType.HIDDEN);
  20065.         de.setValue(idTrasformazione);
  20066.         dati.add(de);
  20067.        
  20068.         de = new DataElement();
  20069.         de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_TRASFORMAZIONE);
  20070.         de.setType(DataElementType.TITLE);
  20071.         dati.add(de);
  20072.        
  20073.         // sezione trasporto
  20074.         de = new DataElement();
  20075.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_TRASPORTO);
  20076.         de.setType(DataElementType.SUBTITLE);
  20077.         dati.add(de);
  20078.        
  20079.         if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding) && !trasformazioneSoapAbilitato) {
  20080.            
  20081.             // method
  20082.             de = new DataElement();
  20083.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD);
  20084.             de.setValue(trasformazioneRestMethod);
  20085.             de.setType(DataElementType.TEXT_EDIT);
  20086.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_METHOD);
  20087.             de.setSize(this.getSize());
  20088.             de.setInfo(dInfoPatternTrasporto);
  20089.             dati.add(de);
  20090.            
  20091.             //  path
  20092.             de = new DataElement();
  20093.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  20094.             de.setValue(trasformazioneRestPath);
  20095.             de.setType(DataElementType.TEXT_AREA);
  20096.             de.setRows(1);
  20097.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  20098.             de.setSize(this.getSize());
  20099.             de.setInfo(dInfoPatternTrasporto);
  20100.             de.setNote(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH_NOTE);
  20101.             dati.add(de);
  20102.                        
  20103.         }
  20104.        
  20105.        
  20106.         // Header
  20107.         de = new DataElement();
  20108.         de.setType(DataElementType.LINK);
  20109.         boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
  20110.         if (contaListeFromSession)
  20111.             de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADERS+" (" + numeroTrasformazioniRichiestaHeaders + ")");
  20112.         else
  20113.             de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADERS);
  20114.         de.setUrl(servletTrasformazioniRichiestaHeadersList, parametriInvocazioneServletTrasformazioniRichiestaHeaders.toArray(new Parameter[parametriInvocazioneServletTrasformazioniRichiestaHeaders.size()]));
  20115.         dati.add(de);
  20116.        
  20117.         // url parameters
  20118.         de = new DataElement();
  20119.         de.setType(DataElementType.LINK);
  20120.         if (contaListeFromSession)
  20121.             de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRI+" (" + numeroTrasformazioniRichiestaParametri + ")");
  20122.         else
  20123.             de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRI);
  20124.         de.setUrl(servletTrasformazioniRichiestaParametriList, parametriInvocazioneServletTrasformazioniRichiestaParametri.toArray(new Parameter[parametriInvocazioneServletTrasformazioniRichiestaParametri.size()]));
  20125.         dati.add(de);
  20126.        
  20127.        
  20128.        
  20129.        
  20130.         // sezione contenuto
  20131.         de = new DataElement();
  20132.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_CONTENUTO);
  20133.         de.setType(DataElementType.SUBTITLE);
  20134.         dati.add(de);
  20135.        
  20136.         // abilitato
  20137.         de = new DataElement();
  20138.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_ENABLED);
  20139.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_ENABLED);
  20140.         de.setType(DataElementType.CHECKBOX);
  20141.         de.setSelected(trasformazioneContenutoAbilitato);
  20142.         de.setValue(trasformazioneContenutoAbilitato+"");
  20143.         de.setPostBack(true);
  20144.         dati.add(de);
  20145.        
  20146.         String postbackElement = this.getPostBackElementName();
  20147.        
  20148.         boolean old_trasformazioneContenutoTemplate = false;
  20149.         boolean old_trasformazioneSoapEnvelopeTemplate = false;
  20150.        
  20151.         if(trasformazioneContenutoAbilitato) {
  20152.             // tipo
  20153.             de = new DataElement();
  20154.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO);
  20155.             List<String> labels = org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toLabelList(serviceBindingMessage, false);
  20156.             if(trasformazioneRestAbilitato) {
  20157.                 List<String> newLabels = new ArrayList<>();
  20158.                 String payloadVuotoSoap = org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY.getLabel(ServiceBinding.SOAP);
  20159.                 for (String l : labels) {
  20160.                     if(l.equals(payloadVuotoSoap)) {
  20161.                         newLabels.add(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY.getLabel(ServiceBinding.REST));
  20162.                     }
  20163.                     else {
  20164.                         newLabels.add(l);
  20165.                     }
  20166.                 }
  20167.                 labels = newLabels;
  20168.             }
  20169.             else if(trasformazioneSoapAbilitato) {
  20170.                 List<String> newLabels = new ArrayList<>();
  20171.                 String payloadVuotoSoap = org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY.getLabel(ServiceBinding.REST);
  20172.                 for (String l : labels) {
  20173.                     if(l.equals(payloadVuotoSoap)) {
  20174.                         newLabels.add(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY.getLabel(ServiceBinding.SOAP));
  20175.                     }
  20176.                     else {
  20177.                         newLabels.add(l);
  20178.                     }
  20179.                 }
  20180.                 labels = newLabels;
  20181.             }
  20182.             de.setLabels(labels);
  20183.             de.setValues(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toStringList(serviceBindingMessage, false));
  20184.             de.setType(DataElementType.SELECT);
  20185.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO);
  20186.             de.setPostBack(true);
  20187.             de.setSelected(trasformazioneContenutoTipo.getValue());
  20188.             setTemplateInfo(de, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO, trasformazioneContenutoTipo, serviceBinding, false,
  20189.                     protocollo, isPortaDelegata);
  20190.             dati.add(de);
  20191.            
  20192.             if(trasformazioneContenutoTipo.isTemplateRequired()) {
  20193.                
  20194.                 // richiesta null in add
  20195.                 boolean templateRequired = true;
  20196.                
  20197.                 if(richiesta!=null){
  20198.                     old_trasformazioneContenutoTemplate = richiesta.getConversioneTemplate() != null && richiesta.getConversioneTemplate().length > 0;
  20199.                     TipoTrasformazione oldTrasformazioneContenutoTipo = StringUtils.isNotEmpty(richiesta.getConversioneTipo())
  20200.                             ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(richiesta.getConversioneTipo()) : org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  20201.                     if(trasformazioneContenutoTipo.equals(oldTrasformazioneContenutoTipo)) {
  20202.                         templateRequired = false;
  20203.                     }
  20204.                 }
  20205.                            
  20206.                 if(postbackElement != null) {
  20207.                     if(postbackElement.equals(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO)) {
  20208.                         old_trasformazioneContenutoTemplate = false;
  20209.                         templateRequired = true;
  20210.                     }
  20211. //                  if(postbackElement.equals(trasformazioneContenutoTemplate.getName())) {
  20212. //                      if(StringUtils.isEmpty(trasformazioneContenutoTipoCheck))
  20213. //                          trasformazioneContenutoTipoCheck = CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_FILE;
  20214. //                  }
  20215.                 }
  20216.                
  20217.                 de = new DataElement();
  20218.                 de.setLabel("");
  20219.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK);
  20220.                 de.setType(DataElementType.HIDDEN);
  20221.                 de.setValue(trasformazioneContenutoTipoCheck);
  20222.                 dati.add(de);
  20223.                
  20224.                 if(StringUtils.isNotEmpty(trasformazioneContenutoTipoCheck) && trasformazioneContenutoTipoCheck.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_TIPO))
  20225.                     templateRequired = true;
  20226.                
  20227.                 String trasformazioneContenutoLabel = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE;
  20228.                 if(old_trasformazioneContenutoTemplate && StringUtils.isEmpty(trasformazioneContenutoTipoCheck)) {
  20229.                     trasformazioneContenutoLabel = "";
  20230.                     DataElement saveAs = new DataElement();
  20231.                     saveAs.setValue(CostantiControlStation.LABEL_DOWNLOAD_DOCUMENTO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE);
  20232.                     saveAs.setType(DataElementType.LINK);
  20233.                
  20234.                     Parameter pIdTrasformazioneRegola = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE, idTrasformazione);
  20235.                     Parameter pIdAccordo = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_ID_ACCORDO, idPorta+"");
  20236.                     Parameter pTipoAllegato = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, isPortaDelegata ? "pd" : "pa");
  20237.                     Parameter pTipoDoc = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, isPortaDelegata ?
  20238.                             ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_DELEGATA_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE :
  20239.                                 ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_APPLICATIVA_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TEMPLATE);
  20240.                     saveAs.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT, pIdAccordo, pTipoAllegato, pTipoDoc, pIdTrasformazioneRegola);
  20241.                     saveAs.setDisabilitaAjaxStatus();
  20242.                     dati.add(saveAs);
  20243.                 }
  20244.                
  20245.                 // template
  20246.                 DataElement trasformazioneContenutoTemplateDataElement = trasformazioneContenutoTemplate.getFileDataElement(trasformazioneContenutoLabel, "", getSize());
  20247.                 trasformazioneContenutoTemplateDataElement.setRequired(templateRequired);
  20248.                 dati.add(trasformazioneContenutoTemplateDataElement);
  20249.                 dati.addAll(trasformazioneContenutoTemplate.getFileNameDataElement());
  20250.                 dati.add(trasformazioneContenutoTemplate.getFileIdDataElement());
  20251.             }
  20252.            
  20253.             boolean contentTypePerAttachmentSOAP = false;
  20254.             if(trasformazioneContenutoTipo.isTrasformazioneProtocolloEnabled()) {
  20255.                 if(ServiceBinding.REST.equals(serviceBindingMessage) &&
  20256.                         trasformazioneSoapAbilitato &&
  20257.                         (!TipoTrasformazione.EMPTY.equals(trasformazioneContenutoTipo)) &&
  20258.                         CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneSoapEnvelope)) {
  20259.                     contentTypePerAttachmentSOAP = true;
  20260.                 }
  20261.             }
  20262.            
  20263.             if(!contentTypePerAttachmentSOAP && trasformazioneContenutoTipo.isContentTypeEnabled()) {
  20264.                 // Content-type
  20265.                 de = new DataElement();
  20266.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE);
  20267.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE);
  20268.                 de.setType(DataElementType.TEXT_EDIT);
  20269.                 de.setValue(StringEscapeUtils.escapeHtml(trasformazioneRichiestaContentType));
  20270.            
  20271.                 switch (serviceBindingMessage) {
  20272.                 case REST:
  20273.                     if(trasformazioneSoapAbilitato) {
  20274.                         de.setType(DataElementType.HIDDEN);
  20275.                         de.setValue("");
  20276.                     }
  20277.                     else {
  20278.                         de.setInfo(dInfoPatternTrasporto);
  20279.                     }
  20280.                     break;
  20281.                 case SOAP:
  20282.                     de.setInfo(dInfoPatternTrasporto);
  20283.                     if(trasformazioneRestAbilitato) {
  20284.                         de.setRequired(true);
  20285.                     }
  20286.                     break;
  20287.                 }
  20288.        
  20289.                 dati.add(de);
  20290.             }
  20291.            
  20292.             if(trasformazioneContenutoTipo.isTrasformazioneProtocolloEnabled()) {
  20293.                 switch (serviceBindingMessage) {
  20294.                 case REST:
  20295.                     // sezione trasformazione SOAP
  20296.                     de = new DataElement();
  20297.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_SOAP);
  20298.                     de.setType(DataElementType.SUBTITLE);
  20299.                     dati.add(de);
  20300.                    
  20301.                     // abilitato
  20302.                     de = new DataElement();
  20303.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_TRANSFORMATION);
  20304.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_TRANSFORMATION);
  20305.                     de.setType(DataElementType.CHECKBOX);
  20306.                     de.setSelected(trasformazioneSoapAbilitato);
  20307.                     de.setValue(trasformazioneSoapAbilitato+"");
  20308.                     de.setPostBack(true);
  20309.                     dati.add(de);
  20310.                    
  20311.                     if(trasformazioneSoapAbilitato) {
  20312.                         // soap versione
  20313.                         de = new DataElement();
  20314.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_VERSION);
  20315.                         String soapVersionLabels[] = {CostantiControlStation.LABEL_SOAP_11, CostantiControlStation.LABEL_SOAP_12};
  20316.                         String soapVersionValues[] = {CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_SOAP_VERSION_11, CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_SOAP_VERSION_12};
  20317.                         de.setLabels(soapVersionLabels);
  20318.                         de.setValues(soapVersionValues);
  20319.                         de.setType(DataElementType.SELECT);
  20320.                         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_VERSION);
  20321.                         de.setSelected(trasformazioneSoapVersion);
  20322.                         dati.add(de);
  20323.                        
  20324.                         // soap action
  20325.                         de = new DataElement();
  20326.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION);
  20327.                         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ACTION);
  20328.                         de.setType(DataElementType.TEXT_EDIT);
  20329.                         de.setValue(trasformazioneSoapAction);
  20330.                         de.setInfo(dInfoPatternTrasporto);
  20331.                         dati.add(de);
  20332.                        
  20333.                         if(!TipoTrasformazione.EMPTY.equals(trasformazioneContenutoTipo)) {
  20334.                             // Envelope
  20335.                             de = new DataElement();
  20336.                             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  20337.                             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  20338.                             de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  20339.                             de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE);
  20340.                             de.setType(DataElementType.SELECT);
  20341.                             de.setSelected(trasformazioneSoapEnvelope);
  20342.                             de.setPostBack(true);
  20343.                             dati.add(de);
  20344.                                                    
  20345.                             if(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_AS_ATTACHMENT.equals(trasformazioneSoapEnvelope)) {
  20346.                                
  20347.                                 // Content-type
  20348.                                 de = new DataElement();
  20349.                                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE_ATTACHMENT);
  20350.                                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONTENT_TYPE);
  20351.                                 de.setType(DataElementType.TEXT_EDIT);
  20352.                                 de.setValue(trasformazioneRichiestaContentType);
  20353.                                 de.setInfo(dInfoPatternTrasporto);
  20354.                                 de.setRequired(true);
  20355.                                 dati.add(de);
  20356.                                
  20357.                                 de = new DataElement();
  20358.                                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TITLE_BODY);
  20359.                                 de.setType(DataElementType.SUBTITLE);
  20360.                                 dati.add(de);                          
  20361.                                
  20362.                                 // tipo envelope attachement
  20363.                                 de = new DataElement();
  20364.                                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO);
  20365.                                 de.setLabels(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toLabelList(ServiceBinding.SOAP, true));
  20366.                                 de.setValues(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toStringList(ServiceBinding.SOAP, true));
  20367.                                 de.setType(DataElementType.SELECT);
  20368.                                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO);
  20369.                                 de.setSelected(trasformazioneSoapEnvelopeTipo.getValue());
  20370.                                 de.setPostBack(true);
  20371.                                 setTemplateInfo(de, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO, trasformazioneSoapEnvelopeTipo, serviceBinding, false,
  20372.                                         protocollo, isPortaDelegata);
  20373.                                 dati.add(de);
  20374.                                
  20375.                                 if(trasformazioneSoapEnvelopeTipo.isTemplateRequired()) {
  20376.                                    
  20377.                                     // richiesta null in add
  20378.                                     boolean templateRequired = true;
  20379.                                     if(richiesta!=null){
  20380.                                         TrasformazioneSoap oldTrasformazioneSoap = richiesta.getTrasformazioneSoap();
  20381.                                         old_trasformazioneSoapEnvelopeTemplate = oldTrasformazioneSoap != null && oldTrasformazioneSoap.getEnvelopeBodyConversioneTemplate() != null && oldTrasformazioneSoap.getEnvelopeBodyConversioneTemplate().length > 0;
  20382.                                         String oldTrasformazioneSoapEnvelopeTipoS = oldTrasformazioneSoap != null ? oldTrasformazioneSoap.getEnvelopeBodyConversioneTipo() : null;
  20383.                                         TipoTrasformazione oldTrasformazioneSoapEnvelopeTipo = StringUtils.isNotEmpty(oldTrasformazioneSoapEnvelopeTipoS)
  20384.                                                 ? org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.toEnumConstant(oldTrasformazioneSoapEnvelopeTipoS) : org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.EMPTY;
  20385.                                         if(trasformazioneSoapEnvelopeTipo.equals(oldTrasformazioneSoapEnvelopeTipo)) {
  20386.                                             templateRequired = false;
  20387.                                         }  
  20388.                                     }
  20389.                                    
  20390.                                     if(postbackElement != null) {
  20391.                                         if(postbackElement.equals(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO)) {
  20392.                                             old_trasformazioneSoapEnvelopeTemplate = false;
  20393.                                             templateRequired = true;
  20394.                                         }
  20395.                                        
  20396. //                                      if(postbackElement.equals(trasformazioneSoapEnvelopeTemplate.getName())) {
  20397. //                                          trasformazioneSoapEnvelopeTipoCheck = CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_FILE;
  20398. //                                      }
  20399.                                     }
  20400.                                    
  20401.                                     de = new DataElement();
  20402.                                     de.setLabel("");
  20403.                                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TIPO_CHECK);
  20404.                                     de.setType(DataElementType.HIDDEN);
  20405.                                     de.setValue(trasformazioneSoapEnvelopeTipoCheck);
  20406.                                     dati.add(de);
  20407.                                    
  20408.                                     if(StringUtils.isNotEmpty(trasformazioneSoapEnvelopeTipoCheck) && trasformazioneSoapEnvelopeTipoCheck.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REQ_CONVERSIONE_TIPO_CHECK_UPDATE_TIPO))
  20409.                                         templateRequired = true;
  20410.                                    
  20411.                                     String trasformazioneSoapEnvelopeTemplateLabel = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE;
  20412.                                     if(old_trasformazioneSoapEnvelopeTemplate && StringUtils.isEmpty(trasformazioneSoapEnvelopeTipoCheck)) {
  20413.                                         trasformazioneSoapEnvelopeTemplateLabel = "";
  20414.                                         DataElement saveAs = new DataElement();
  20415.                                         saveAs.setValue(CostantiControlStation.LABEL_DOWNLOAD_DOCUMENTO_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE);
  20416.                                         saveAs.setType(DataElementType.LINK);

  20417.                                         Parameter pIdTrasformazioneRegola = new Parameter(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE, idTrasformazione);
  20418.                                         Parameter pIdAccordo = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_ID_ACCORDO, idPorta+"");
  20419.                                         Parameter pTipoAllegato = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, isPortaDelegata ? "pd" : "pa");
  20420.                                         Parameter pTipoDoc = new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, isPortaDelegata
  20421.                                                 ? ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_DELEGATA_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE
  20422.                                                         : ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_DOCUMENTO_PORTA_APPLICATIVA_CONFIGURAZIONE_TRASFORMAZIONI_SOAP_ENVELOPE_TEMPLATE);
  20423.                                         saveAs.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT, pIdAccordo, pTipoAllegato, pTipoDoc,pIdTrasformazioneRegola);
  20424.                                         dati.add(saveAs);
  20425.                                     }
  20426.                                    
  20427.                                     //  template envelope attachement
  20428.                                     DataElement trasformazioneSoapEnvelopeTemplateDataElement = trasformazioneSoapEnvelopeTemplate.getFileDataElement(trasformazioneSoapEnvelopeTemplateLabel, "", getSize());
  20429.                                     trasformazioneSoapEnvelopeTemplateDataElement.setRequired(templateRequired);
  20430.                                     dati.add(trasformazioneSoapEnvelopeTemplateDataElement);
  20431.                                     dati.addAll(trasformazioneSoapEnvelopeTemplate.getFileNameDataElement());
  20432.                                     dati.add(trasformazioneSoapEnvelopeTemplate.getFileIdDataElement());
  20433.                                 }
  20434.                             }
  20435.                         }
  20436.                     }
  20437.                     break;
  20438.                 case SOAP:
  20439.                 default:
  20440.                     // sezione trasformazione REST
  20441.                     de = new DataElement();
  20442.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_REST);
  20443.                     de.setType(DataElementType.SUBTITLE);
  20444.                     dati.add(de);
  20445.    
  20446.                     // abilitato
  20447.                     de = new DataElement();
  20448.                     de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_TRANSFORMATION);
  20449.                     de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_TRANSFORMATION);
  20450.                     de.setType(DataElementType.CHECKBOX);
  20451.                     de.setSelected(trasformazioneRestAbilitato);
  20452.                     de.setValue(trasformazioneRestAbilitato+"");
  20453.                     de.setPostBack(true);
  20454.                     dati.add(de);
  20455.                    
  20456.                     if(trasformazioneRestAbilitato) {
  20457.                         //  path
  20458.                         de = new DataElement();
  20459.                         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  20460.                         de.setValue(trasformazioneRestPath);
  20461.                         de.setType(DataElementType.TEXT_AREA);
  20462.                         de.setRows(3);
  20463.                         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_REST_PATH);
  20464.                         de.setSize(this.getSize());
  20465.                         de.setRequired(true);
  20466.                         de.setInfo(dInfoPatternTrasporto);
  20467.                         dati.add(de);
  20468.                        
  20469.                         // method
  20470.                         de = getHttpMethodDataElementTrasformazione(tipoOP, trasformazioneRestMethod);
  20471.                         dati.add(de);
  20472.                        
  20473.                     }
  20474.                    
  20475.                     break;
  20476.                 }
  20477.             }
  20478.         }
  20479.        
  20480.         return dati;
  20481.     }
  20482.    
  20483.     private void setTemplateInfo(DataElement de, String label, org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione trasformazioneContenutoTipo,
  20484.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding, boolean risposta,
  20485.             String protocollo, boolean isPortaDelegata) throws DriverControlStationException {
  20486.        
  20487.         if(trasformazioneContenutoTipo==null) {
  20488.             throw new DriverControlStationException("Param trasformazioneContenutoTipo is null");
  20489.         }
  20490.        
  20491.         switch (trasformazioneContenutoTipo) {
  20492.         case TEMPLATE:
  20493.             DataElementInfo dInfoPatternContenuto = new DataElementInfo(label);
  20494.             dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE);
  20495.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  20496.                 if(risposta) {
  20497.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20498.                 }
  20499.                 else {
  20500.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_REST_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20501.                 }
  20502.             }
  20503.             else {
  20504.                 if(risposta) {
  20505.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI_CON_RISPOSTE(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20506.                 }
  20507.                 else {
  20508.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_TRASFORMAZIONI_TRASPORTO_SOAP_VALORI(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20509.                 }
  20510.             }
  20511.             de.setInfo(dInfoPatternContenuto);
  20512.             break;
  20513.         case FREEMARKER_TEMPLATE:
  20514.         case CONTEXT_FREEMARKER_TEMPLATE:
  20515.         case FREEMARKER_TEMPLATE_ZIP:
  20516.             dInfoPatternContenuto = new DataElementInfo(label);
  20517.             if(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.FREEMARKER_TEMPLATE.equals(trasformazioneContenutoTipo) ||
  20518.                     org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.CONTEXT_FREEMARKER_TEMPLATE.equals(trasformazioneContenutoTipo)) {
  20519.                 dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER);
  20520.             }
  20521.             else {
  20522.                 dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_FREEMARKER_ZIP);
  20523.             }
  20524.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  20525.                 if(risposta) {
  20526.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_CON_RISPOSTE_FREEMARKER(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20527.                 }
  20528.                 else {
  20529.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20530.                 }
  20531.             }
  20532.             else {
  20533.                 if(risposta) {
  20534.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_CON_RISPOSTE_FREEMARKER(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20535.                 }
  20536.                 else {
  20537.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_FREEMARKER(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20538.                 }
  20539.             }
  20540.             de.setInfo(dInfoPatternContenuto);
  20541.             break;
  20542.         case VELOCITY_TEMPLATE:
  20543.         case CONTEXT_VELOCITY_TEMPLATE:
  20544.         case VELOCITY_TEMPLATE_ZIP:
  20545.             dInfoPatternContenuto = new DataElementInfo(label);
  20546.             if(org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.VELOCITY_TEMPLATE.equals(trasformazioneContenutoTipo) ||
  20547.                     org.openspcoop2.pdd.core.trasformazioni.TipoTrasformazione.CONTEXT_VELOCITY_TEMPLATE.equals(trasformazioneContenutoTipo)) {
  20548.                 dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY);
  20549.             }
  20550.             else {
  20551.                 dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_OBJECT_TEMPLATE_VELOCITY_ZIP);
  20552.             }
  20553.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  20554.                 if(risposta) {
  20555.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_CON_RISPOSTE_VELOCITY(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20556.                 }
  20557.                 else {
  20558.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_REST_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20559.                 }
  20560.             }
  20561.             else {
  20562.                 if(risposta) {
  20563.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_CON_RISPOSTE_VELOCITY(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20564.                 }
  20565.                 else {
  20566.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.getLABEL_CONFIGURAZIONE_INFO_OBJECT_SOAP_VALORI_VELOCITY(this.isProfiloModIPA(protocollo), isPortaDelegata, false));
  20567.                 }
  20568.             }
  20569.             de.setInfo(dInfoPatternContenuto);
  20570.             break;
  20571.         case ZIP:
  20572.         case TGZ:
  20573.         case TAR:
  20574.             dInfoPatternContenuto = new DataElementInfo(label);
  20575.             dInfoPatternContenuto.setHeaderBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE_COMPRESS);
  20576.             if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(serviceBinding)) {
  20577.                 if(risposta) {
  20578.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE_COMPRESS_REST_VALORI_CON_RISPOSTE);
  20579.                 }
  20580.                 else {
  20581.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE_COMPRESS_REST_VALORI);
  20582.                 }
  20583.             }
  20584.             else {
  20585.                 if(risposta) {
  20586.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE_COMPRESS_SOAP_VALORI_CON_RISPOSTE);
  20587.                 }
  20588.                 else {
  20589.                     dInfoPatternContenuto.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_INFO_TEMPLATE_COMPRESS_SOAP_VALORI);
  20590.                 }
  20591.             }
  20592.             de.setInfo(dInfoPatternContenuto);
  20593.             break;
  20594.         case EMPTY:
  20595.         case XSLT:
  20596.             break;
  20597.         }
  20598.     }
  20599.    
  20600.     public boolean trasformazioniRispostaHeaderCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
  20601.         try{
  20602.             String tipo = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO);
  20603.             String nome = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME);
  20604.             String valore = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE);
  20605.            
  20606.             // Campi obbligatori
  20607.             if (StringUtils.isEmpty(nome)) {
  20608.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME));
  20609.                 return false;
  20610.             }
  20611.             if ((nome.indexOf(" ") != -1) ) {
  20612.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEL_CAMPO_NOME);
  20613.                 return false;
  20614.             }
  20615.             if(!this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_NOME)) {
  20616.                 return false;
  20617.             }
  20618.            
  20619.             if (StringUtils.isEmpty(tipo)) {
  20620.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO));
  20621.                 return false;
  20622.             }
  20623.             if(!this.checkLength255(tipo, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_TIPO)) {
  20624.                 return false;
  20625.             }
  20626.            
  20627.             if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  20628.                 if (StringUtils.isEmpty(valore)) {
  20629.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE));
  20630.                     return false;
  20631.                 }
  20632.                 try{
  20633.                     DynamicUtils.validate(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE, valore, false);
  20634.                 }catch(Exception e){
  20635.                     this.pd.setMessage("Il valore indicato nel parametro '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RISPOSTA_HEADER_VALORE+"' non risulta corretto: "+e.getMessage());
  20636.                     return false;
  20637.                 }
  20638.             }
  20639.            
  20640.             return true;
  20641.         } catch (Exception e) {
  20642.             this.logError("Exception: " + e.getMessage(), e);
  20643.             throw new DriverControlStationException(e);
  20644.         }
  20645.     }
  20646.    
  20647.     public boolean trasformazioniRichiestaHeaderCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
  20648.         try{
  20649.             String tipo = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO);
  20650.             String nome = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME);
  20651.             String valore = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE);
  20652.            
  20653.             // Campi obbligatori
  20654.             if (StringUtils.isEmpty(nome)) {
  20655.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME));
  20656.                 return false;
  20657.             }
  20658.             if ((nome.indexOf(" ") != -1) ) {
  20659.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEL_CAMPO_NOME);
  20660.                 return false;
  20661.             }
  20662.             if(!this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_NOME)) {
  20663.                 return false;
  20664.             }
  20665.            
  20666.             if (StringUtils.isEmpty(tipo)) {
  20667.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO));
  20668.                 return false;
  20669.             }
  20670.             if(!this.checkLength255(tipo, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_TIPO)) {
  20671.                 return false;
  20672.             }
  20673.            
  20674.             if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  20675.                 if (StringUtils.isEmpty(valore)) {
  20676.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE));
  20677.                     return false;
  20678.                 }
  20679.                 try{
  20680.                     DynamicUtils.validate(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE, valore, false);
  20681.                 }catch(Exception e){
  20682.                     this.pd.setMessage("Il valore indicato nel parametro '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE+"' non risulta corretto: "+e.getMessage());
  20683.                     return false;
  20684.                 }
  20685.             }
  20686.            
  20687.             return true;
  20688.         } catch (Exception e) {
  20689.             this.logError("Exception: " + e.getMessage(), e);
  20690.             throw new DriverControlStationException(e);
  20691.         }
  20692.     }
  20693.    
  20694.     public boolean trasformazioniRichiestaUrlParameterCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
  20695.         try{
  20696.             String tipo = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO);
  20697.             String nome = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME);
  20698.             String valore = this.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE);
  20699.            
  20700.             // Campi obbligatori
  20701.             if (StringUtils.isEmpty(nome)) {
  20702.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME));
  20703.                 return false;
  20704.             }
  20705.             if ((nome.indexOf(" ") != -1) ) {
  20706.                 this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_NON_INSERIRE_SPAZI_NEL_CAMPO_NOME);
  20707.                 return false;
  20708.             }
  20709.             if(!this.checkLength255(nome, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_NOME)) {
  20710.                 return false;
  20711.             }
  20712.            
  20713.             if (StringUtils.isEmpty(tipo)) {
  20714.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO));
  20715.                 return false;
  20716.             }
  20717.             if(!this.checkLength255(tipo, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_TIPO)) {
  20718.                 return false;
  20719.             }
  20720.            
  20721.             if(!CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_PARAMETRO_DELETE.equals(tipo)) {
  20722.                 if (StringUtils.isEmpty(valore)) {
  20723.                     this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_HEADER_VALORE));
  20724.                     return false;
  20725.                 }
  20726.                 try{
  20727.                     DynamicUtils.validate(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE, valore, false);
  20728.                 }catch(Exception e){
  20729.                     this.pd.setMessage("Il valore indicato nel parametro '"+CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_RICHIESTA_PARAMETRO_VALORE+"' non risulta corretto: "+e.getMessage());
  20730.                     return false;
  20731.                 }
  20732.             }
  20733.            
  20734.             return true;
  20735.         } catch (Exception e) {
  20736.             this.logError("Exception: " + e.getMessage(), e);
  20737.             throw new DriverControlStationException(e);
  20738.         }
  20739.     }
  20740.    
  20741.     public List<DataElement> addPorteTrasformazioniServizioApplicativoToDati(TipoOperazione tipoOp, List<DataElement> dati, String idTrasformazione, boolean fromList,
  20742.         String servizioApplicativo, String[] servizioApplicativoList, int sizeAttuale,
  20743.         boolean addMsgServiziApplicativoNonDisponibili, boolean addTitle) {
  20744.        
  20745.         if(fromList) {
  20746.             DataElement de = new DataElement();
  20747.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_LIST);
  20748.             de.setType(DataElementType.HIDDEN);
  20749.             de.setValue(fromList+"");
  20750.             dati.add(de);
  20751.         }
  20752.        
  20753.         DataElement  de = new DataElement();
  20754.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20755.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20756.         de.setType(DataElementType.HIDDEN);
  20757.         de.setValue(idTrasformazione);
  20758.         dati.add(de);
  20759.        
  20760.         if(servizioApplicativoList!=null && servizioApplicativoList.length>0){
  20761.        
  20762.             String labelApplicativo = CostantiControlStation.LABEL_PARAMETRO_SERVIZIO_APPLICATIVO;
  20763.             if(!this.isModalitaCompleta()) {
  20764.                 labelApplicativo = CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO;
  20765.             }
  20766.            
  20767.             if(addTitle) {
  20768.                 de = new DataElement();
  20769.                 de.setType(DataElementType.TITLE);
  20770.                 de.setLabel(labelApplicativo);
  20771.                 dati.add(de);
  20772.             }
  20773.            
  20774.             de = new DataElement();
  20775.             de.setLabel( CostantiControlStation.LABEL_PARAMETRO_NOME );
  20776.             de.setType(DataElementType.SELECT);
  20777.             de.setName(CostantiControlStation.PARAMETRO_SERVIZIO_APPLICATIVO);
  20778.             de.setValues(servizioApplicativoList);
  20779.             de.setSelected(servizioApplicativo);
  20780.             dati.add(de);
  20781.            
  20782.         }else{
  20783.             if(addMsgServiziApplicativoNonDisponibili){
  20784.                 if(sizeAttuale>0){
  20785.                     this.pd.setMessage("Non esistono ulteriori servizi applicativi associabili alla trasformazione",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20786.                 }
  20787.                 else{
  20788.                     this.pd.setMessage("Non esistono servizi applicativi associabili alla trasformazione",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20789.                 }
  20790.                 this.pd.disableEditMode();
  20791.             }
  20792.         }

  20793.         return dati;
  20794.     }
  20795.    
  20796.     public List<DataElement> addPorteTrasformazioniSoggettoToDati(TipoOperazione tipoOp, List<DataElement> dati, String idTrasformazione, boolean fromList,
  20797.         String[] soggettiLabelList, String[] soggettiList, String soggetto, int sizeAttuale,
  20798.             boolean addMsgSoggettiNonDisponibili, boolean addTitle) {
  20799.        
  20800.         if(fromList) {
  20801.             DataElement de = new DataElement();
  20802.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_LIST);
  20803.             de.setType(DataElementType.HIDDEN);
  20804.             de.setValue(fromList+"");
  20805.             dati.add(de);
  20806.         }
  20807.        
  20808.         DataElement  de = new DataElement();
  20809.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20810.         de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20811.         de.setType(DataElementType.HIDDEN);
  20812.         de.setValue(idTrasformazione);
  20813.         dati.add(de);
  20814.            
  20815.         if(soggettiList!=null && soggettiList.length>0){
  20816.        
  20817.             if(addTitle) {
  20818.                   de = new DataElement();
  20819.                 de.setType(DataElementType.TITLE);
  20820.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SOGGETTO);
  20821.                 dati.add(de);
  20822.             }
  20823.            
  20824.               de = new DataElement();
  20825.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  20826.             de.setType(DataElementType.SELECT);
  20827.             de.setName(CostantiControlStation.PARAMETRO_SOGGETTO);
  20828.             de.setLabels(soggettiLabelList);
  20829.             de.setValues(soggettiList);
  20830.             de.setSelected(soggetto);
  20831.             dati.add(de);
  20832.            
  20833.         }else{
  20834.             if(addMsgSoggettiNonDisponibili){
  20835.                 if(sizeAttuale>0){
  20836.                     this.pd.setMessage("Non esistono ulteriori soggetti associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20837.                 }
  20838.                 else{
  20839.                     this.pd.setMessage("Non esistono soggetti associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20840.                 }
  20841.                 this.pd.disableEditMode();
  20842.             }
  20843.         }

  20844.         return dati;
  20845.     }

  20846.     public List<DataElement> addPorteTrasformazioniServizioApplicativoAutorizzatiToDati(TipoOperazione tipoOp, List<DataElement> dati, String idTrasformazione, boolean fromList,
  20847.         String[] soggettiLabelList, String[] soggettiList, String soggetto, int sizeAttuale,
  20848.         Map<String,List<IDServizioApplicativoDB>> listServiziApplicativi, String sa,
  20849.             boolean addMsgApplicativiNonDisponibili) {
  20850.        
  20851.         if(fromList) {
  20852.             DataElement de = new DataElement();
  20853.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_LIST);
  20854.             de.setType(DataElementType.HIDDEN);
  20855.             de.setValue(fromList+"");
  20856.             dati.add(de);
  20857.         }
  20858.        
  20859.         if(soggettiList!=null && soggettiList.length>0 && listServiziApplicativi!=null && listServiziApplicativi.size()>0){
  20860.        
  20861.             DataElement de = new DataElement();
  20862.             de.setType(DataElementType.TITLE);
  20863.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_APPLICATIVO);
  20864.             dati.add(de);
  20865.            
  20866.             de = new DataElement();
  20867.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20868.             de.setName(CostantiControlStation.PARAMETRO_ID_CONFIGURAZIONE_TRASFORMAZIONE);
  20869.             de.setType(DataElementType.HIDDEN);
  20870.             de.setValue(idTrasformazione);
  20871.             dati.add(de);
  20872.            
  20873.             de = new DataElement();
  20874.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_SOGGETTO);
  20875.             de.setName(CostantiControlStation.PARAMETRO_SOGGETTO);
  20876.             de.setValue(soggetto);
  20877.             if(this.core.isMultitenant()) {
  20878.                 de.setType(DataElementType.SELECT);
  20879.                 de.setLabels(soggettiLabelList);
  20880.                 de.setValues(soggettiList);
  20881.                 de.setSelected(soggetto);
  20882.                 de.setPostBack(true);
  20883.             }
  20884.             else {
  20885.                 de.setType(DataElementType.HIDDEN);
  20886.             }
  20887.             dati.add(de);
  20888.            
  20889.             List<IDServizioApplicativoDB> listSA = null;
  20890.             if(soggetto!=null && !"".equals(soggetto)) {
  20891.                 listSA = listServiziApplicativi.get(soggetto);
  20892.             }
  20893.            
  20894.             if(listSA!=null && !listSA.isEmpty()) {
  20895.                
  20896.                 String [] saValues = new String[listSA.size()];
  20897.                 String [] saLabels = new String[listSA.size()];
  20898.                 int index =0;
  20899.                 for (IDServizioApplicativoDB saObject : listSA) {
  20900.                     saValues[index] = saObject.getId().longValue()+"";
  20901.                     saLabels[index] = saObject.getNome();
  20902.                     index++;
  20903.                 }
  20904.                
  20905.                 de = new DataElement();
  20906.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  20907.                 de.setType(DataElementType.SELECT);
  20908.                 de.setName(CostantiControlStation.PARAMETRO_SERVIZIO_APPLICATIVO_AUTORIZZATO);
  20909.                 de.setLabels(saLabels);
  20910.                 de.setValues(saValues);
  20911.                 de.setSelected(sa);
  20912.                 dati.add(de);
  20913.                
  20914.             }
  20915.             else {
  20916.                 this.pd.setMessage("Non esistono applicativi associabili per il soggetto selezionato",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20917.                 this.pd.disableEditMode();
  20918.             }
  20919.            
  20920.         }else{
  20921.             if(addMsgApplicativiNonDisponibili){
  20922.                 if(sizeAttuale>0){
  20923.                     this.pd.setMessage("Non esistono ulteriori applicativi associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20924.                 }
  20925.                 else{
  20926.                     this.pd.setMessage("Non esistono applicativi associabili",org.openspcoop2.web.lib.mvc.MessageType.INFO);
  20927.                 }
  20928.                 this.pd.disableEditMode();
  20929.             }
  20930.         }

  20931.         return dati;
  20932.     }
  20933.    
  20934.     public DataElement getHttpMethodDataElement(TipoOperazione tipoOperazione, String httpMethod, String label, String name, boolean addQualsiasi, String labelQualsiasi, String valueQualsiasi) {
  20935.         DataElement de = new DataElement();
  20936.        
  20937.         de.setLabel(label);
  20938.         de.setSelected(httpMethod);
  20939.         de.setType(DataElementType.SELECT);
  20940.         de.setName(name);
  20941.         de.setSize(this.getSize());
  20942.         de.setPostBack(true);
  20943.        
  20944.         HttpMethod[] httpMethods = HttpMethod.values();
  20945.         int numeroOptions = !addQualsiasi ? httpMethods.length : httpMethods.length + 1;
  20946.        
  20947.         String [] values = new String[numeroOptions];
  20948.         String [] labels = new String[numeroOptions];

  20949.         if(addQualsiasi) {
  20950.             labels[0] = labelQualsiasi;
  20951.             values[0] = valueQualsiasi;
  20952.         }
  20953.        
  20954.         for (int i = 0; i < httpMethods.length; i++) {
  20955.             HttpMethod method = httpMethods[i];
  20956.             labels[(addQualsiasi ? i+1 : i)] = method.name();
  20957.             values[(addQualsiasi ? i+1 : i)] = method.name();
  20958.         }
  20959.        
  20960.         de.setLabels(labels);
  20961.         de.setValues(values);
  20962.        
  20963.         return de;
  20964.     }
  20965.    
  20966.     public boolean checkAzioniUtilizzateErogazione(AccordiServizioParteSpecificaPorteApplicativeMappingInfo mappingInfo, String [] azioni) throws DriverControlStationException {
  20967.         List<MappingErogazionePortaApplicativa> list = mappingInfo.getListaMappingErogazione();
  20968.         return checkAzioniUtilizzateErogazione(list, azioni);
  20969.     }
  20970.     public boolean checkAzioniUtilizzateErogazione(List<MappingErogazionePortaApplicativa> list, String [] azioni) throws DriverControlStationException {
  20971.         if(azioni==null || azioni.length<=0) {
  20972.             return true;
  20973.         }
  20974.         if(list!=null && !list.isEmpty()) {
  20975.             for (MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa : list) {
  20976.                 IDPortaApplicativa idPA = mappingErogazionePortaApplicativa.getIdPortaApplicativa();
  20977.                 List<AttivazionePolicy> listPolicies = this.confCore.attivazionePolicyList(null, RuoloPolicy.APPLICATIVA, idPA.getNome());
  20978.                 List<ConfigurazioneAllarmeBean> listAllarmi = null;
  20979.                 if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  20980.                     listAllarmi = this.confCore.allarmiList(new ConsoleSearch(true), RuoloPorta.APPLICATIVA, idPA.getNome());
  20981.                 }
  20982.                 try {
  20983.                     PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idPA);
  20984.                     if(this._checkAzioniUtilizzate(listPolicies, listAllarmi, pa.getTrasformazioni(), azioni,
  20985.                             mappingErogazionePortaApplicativa.getDescrizione(), list.size())==false) {
  20986.                         return false;
  20987.                     }
  20988.                 }catch(Exception e) {
  20989.                     throw new DriverControlStationException(e.getMessage(),e);
  20990.                 }
  20991.             }
  20992.         }
  20993.        
  20994.         return true;
  20995.     }
  20996.    
  20997.     public boolean checkAzioniUtilizzateFruizione(AccordiServizioParteSpecificaFruitoriPorteDelegateMappingInfo mappingInfo, String [] azioni) throws DriverControlStationException {
  20998.         List<MappingFruizionePortaDelegata> list = mappingInfo.getListaMappingFruizione();
  20999.         return this.checkAzioniUtilizzateFruizione(list, azioni);
  21000.     }
  21001.     public boolean checkAzioniUtilizzateFruizione(List<MappingFruizionePortaDelegata> list, String [] azioni) throws DriverControlStationException {
  21002.         if(azioni==null || azioni.length<=0) {
  21003.             return true;
  21004.         }
  21005.         if(list!=null && !list.isEmpty()) {
  21006.             for (MappingFruizionePortaDelegata mappingFruizionePortaDelegata : list) {
  21007.                 IDPortaDelegata idPD = mappingFruizionePortaDelegata.getIdPortaDelegata();
  21008.                 List<AttivazionePolicy> listPolicies = this.confCore.attivazionePolicyList(null, RuoloPolicy.DELEGATA, idPD.getNome());
  21009.                 List<ConfigurazioneAllarmeBean> listAllarmi = null;
  21010.                 if(this.confCore.isConfigurazioneAllarmiEnabled()) {
  21011.                     listAllarmi = this.confCore.allarmiList(new ConsoleSearch(true), RuoloPorta.DELEGATA, idPD.getNome());
  21012.                 }
  21013.                 try {
  21014.                     PortaDelegata pd = this.porteDelegateCore.getPortaDelegata(idPD);
  21015.                     if(this._checkAzioniUtilizzate(listPolicies, listAllarmi, pd.getTrasformazioni(), azioni,
  21016.                             mappingFruizionePortaDelegata.getDescrizione(), list.size())==false) {
  21017.                         return false;
  21018.                     }
  21019.                 }catch(Exception e) {
  21020.                     throw new DriverControlStationException(e.getMessage(),e);
  21021.                 }
  21022.             }
  21023.         }
  21024.        
  21025.         return true;
  21026.     }
  21027.    
  21028.     private boolean _checkAzioniUtilizzate(List<AttivazionePolicy> listPolicies, List<ConfigurazioneAllarmeBean> listAllarmi, Trasformazioni trasformazioni, String [] azioni, String descrizioneGruppo, int sizeGruppi) {
  21029.        
  21030.         // verifico rate limiting
  21031.         if(listPolicies!=null && !listPolicies.isEmpty()) {
  21032.             for (AttivazionePolicy policy : listPolicies) {
  21033.                 if(policy.getFiltro()!=null && policy.getFiltro().getAzione()!=null) {
  21034.                     for (String azioneTmp : azioni) {
  21035.                        
  21036.                         String [] tmp = policy.getFiltro().getAzione().split(",");
  21037.                         if(tmp!=null && tmp.length>0) {
  21038.                             for (String az : tmp) {
  21039.                                 if(azioneTmp.equals(az)) {
  21040.                                     String nomePolicy = policy.getAlias();
  21041.                                     if(nomePolicy==null || "".equals(nomePolicy)) {
  21042.                                         nomePolicy = policy.getIdActivePolicy();
  21043.                                     }
  21044.                                     if(sizeGruppi>1) {
  21045.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_RATE_LIMITING_GRUPPO,
  21046.                                                 azioneTmp, nomePolicy, descrizioneGruppo));
  21047.                                     }
  21048.                                     else {
  21049.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_RATE_LIMITING,
  21050.                                                 azioneTmp, nomePolicy, descrizioneGruppo));
  21051.                                     }
  21052.                                     return false;  
  21053.                                 }
  21054.                             }
  21055.                         }
  21056.                        
  21057.                     }
  21058.                 }
  21059.             }
  21060.         }
  21061.        
  21062.         // verifico allarmi
  21063.         if(listAllarmi!=null && !listAllarmi.isEmpty()) {
  21064.             for (Allarme allarme : listAllarmi) {
  21065.                 if(allarme.getFiltro()!=null && allarme.getFiltro().getAzione()!=null) {
  21066.                     for (String azioneTmp : azioni) {
  21067.                        
  21068.                         String [] tmp = allarme.getFiltro().getAzione().split(",");
  21069.                         if(tmp!=null && tmp.length>0) {
  21070.                             for (String az : tmp) {
  21071.                                 if(azioneTmp.equals(az)) {
  21072.                                     String nomeAllarme = allarme.getAlias();
  21073.                                     if(nomeAllarme==null || "".equals(nomeAllarme)) {
  21074.                                         nomeAllarme = allarme.getNome();
  21075.                                     }
  21076.                                     if(sizeGruppi>1) {
  21077.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_ALLARME_GRUPPO,
  21078.                                                 azioneTmp, nomeAllarme, descrizioneGruppo));
  21079.                                     }
  21080.                                     else {
  21081.                                         this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_ALLARME,
  21082.                                                 azioneTmp, nomeAllarme, descrizioneGruppo));
  21083.                                     }
  21084.                                     return false;  
  21085.                                 }
  21086.                             }
  21087.                         }
  21088.                        
  21089.                     }
  21090.                 }
  21091.             }
  21092.         }
  21093.        
  21094.         // verifico trasformazioni
  21095.         List<TrasformazioneRegola> trasformazione = null;
  21096.         if(trasformazioni!=null) {
  21097.             trasformazione = trasformazioni.getRegolaList();
  21098.         }
  21099.         if(trasformazione!=null && !trasformazione.isEmpty()) {
  21100.             for (TrasformazioneRegola regola : trasformazione) {
  21101.                 if(regola.getApplicabilita()!=null && regola.getApplicabilita().sizeAzioneList()>0) {
  21102.                     List<String> azioniTrasf = regola.getApplicabilita().getAzioneList();
  21103.                     for (String azioneTmp : azioni) {
  21104.                         if(azioniTrasf.contains(azioneTmp)) {
  21105.                             String nomeRegola = regola.getNome();
  21106.                             if(sizeGruppi>1) {
  21107.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_TRASFORMAZIONE_GRUPPO,
  21108.                                         azioneTmp, nomeRegola, descrizioneGruppo));
  21109.                             }
  21110.                             else {
  21111.                                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_AZIONE_NON_ASSEGNABILE_TRASFORMAZIONE,
  21112.                                         azioneTmp, nomeRegola, descrizioneGruppo));
  21113.                             }
  21114.                             return false;  
  21115.                         }
  21116.                     }
  21117.                 }
  21118.             }
  21119.         }
  21120.         return true;
  21121.     }
  21122.    
  21123.     public DataElement getHttpReturnCodeDataElement(String label, String name, String value, boolean required) {
  21124.         DataElement de = new DataElement();
  21125.         de.setLabel(label);
  21126.         de.setValue(value);
  21127.         de.setType(DataElementType.NUMBER);
  21128.         de.setName(name);
  21129.         de.setMinValue(200);
  21130.         de.setMaxValue(599);
  21131.         de.setSize(getSize());
  21132.         de.reloadMinValue(false);
  21133.         de.setRequired(required);
  21134.         return de;
  21135.     }
  21136.    
  21137.     public DataElement getHttpReturnCodeIntervallDataElement(String label,
  21138.             String nameMin, String nameMax,
  21139.             String valueMin, String valueMax,
  21140.             boolean required) {
  21141.         DataElement de = new DataElement();
  21142.         de.setLabel("&nbsp;");
  21143.         de.setValues(Arrays.asList(valueMin + "", valueMax + ""));
  21144.         de.setType(DataElementType.INTERVAL_NUMBER);
  21145.         de.setNames(Arrays.asList(nameMin, nameMax));
  21146.         de.setMinValue(200);
  21147.         de.setMaxValue(599);
  21148.         de.setSize(getSize());
  21149.         de.reloadMinValue(false);
  21150.         de.setRequired(required);
  21151.         return de;
  21152.     }
  21153.    
  21154.     public DataElement getVersionDataElement(String label, String name, String value, boolean required) {
  21155.         DataElement de = new DataElement();
  21156.         de.setLabel(label);
  21157.         de.setValue(value);
  21158.         de.setType(DataElementType.NUMBER);
  21159.         de.setName(name);
  21160.         de.setMinValue(1);
  21161.         de.setMaxValue(999);
  21162.         de.setSize(getSize());
  21163.         //de.reloadMinValue(false);
  21164.         de.setRequired(required);
  21165.         return de;
  21166.     }
  21167.    
  21168.     public String getUpperFirstChar(String value) {
  21169.         return (value.charAt(0)+"").toUpperCase() + value.substring(1);
  21170.     }
  21171.    
  21172.     public boolean isFunzionalitaProtocolloSupportataDalProtocollo(String protocollo, ServiceBinding serviceBinding,FunzionalitaProtocollo funzionalitaProtocollo)
  21173.             throws DriverRegistroServiziNotFound, DriverRegistroServiziException, DriverConfigurazioneException {
  21174.         if(serviceBinding == null) {
  21175.             List<ServiceBinding> serviceBindingListProtocollo = this.core.getServiceBindingListProtocollo(protocollo);
  21176.            
  21177.             boolean supportato = true;
  21178.             if(serviceBindingListProtocollo != null && serviceBindingListProtocollo.size() > 0) {
  21179.                 for (ServiceBinding serviceBinding2 : serviceBindingListProtocollo) {
  21180.                     boolean supportatoTmp = this.core.isFunzionalitaProtocolloSupportataDalProtocollo(protocollo, serviceBinding2, funzionalitaProtocollo);
  21181.                     supportato = supportato || supportatoTmp;
  21182.                 }
  21183.             }
  21184.             return supportato;
  21185.         } else {
  21186.             return this.core.isFunzionalitaProtocolloSupportataDalProtocollo(protocollo, serviceBinding, funzionalitaProtocollo);
  21187.         }
  21188.     }
  21189.    
  21190.     public List<DataElement>  addProprietaAutorizzazioneCustomToDati(List<DataElement> dati, TipoOperazione tipoOp, String nome, String valore) {

  21191.         DataElement de = new DataElement();
  21192.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTORIZZAZIONE_CUSTOM_PROPERTIES);
  21193.         de.setType(DataElementType.TITLE);
  21194.         dati.add(de);
  21195.        
  21196.         de = new DataElement();
  21197.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  21198.         de.setValue(nome);
  21199.         if(TipoOperazione.ADD.equals(tipoOp)){
  21200.             de.setType(DataElementType.TEXT_EDIT);
  21201.             de.setRequired(true);
  21202.         }
  21203.         else{
  21204.             de.setType(DataElementType.TEXT);
  21205.         }
  21206.         de.setName(CostantiControlStation.PARAMETRO_NOME);
  21207.         de.setSize(this.getSize());
  21208.         dati.add(de);

  21209.         de = new DataElement();
  21210.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  21211.         de.setName(CostantiControlStation.PARAMETRO_VALORE);
  21212.         this.core.getLockUtilities().lockProperty(de, valore);
  21213.         de.setRequired(true);
  21214.         de.setSize(this.getSize());
  21215.         dati.add(de);

  21216.         return dati;
  21217.     }
  21218.    
  21219.     public List<DataElement>  addProprietaAutenticazioneCustomToDati(List<DataElement> dati, TipoOperazione tipoOp, String nome, String valore) {

  21220.         DataElement de = new DataElement();
  21221.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_AUTENTICAZIONE_CUSTOM_PROPERTIES);
  21222.         de.setType(DataElementType.TITLE);
  21223.         dati.add(de);
  21224.        
  21225.         de = new DataElement();
  21226.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_NOME);
  21227.         de.setValue(nome);
  21228.         if(TipoOperazione.ADD.equals(tipoOp)){
  21229.             de.setType(DataElementType.TEXT_EDIT);
  21230.             de.setRequired(true);
  21231.         }
  21232.         else{
  21233.             de.setType(DataElementType.TEXT);
  21234.         }
  21235.         de.setName(CostantiControlStation.PARAMETRO_NOME);
  21236.         de.setSize(this.getSize());
  21237.         dati.add(de);

  21238.         de = new DataElement();
  21239.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_VALORE);
  21240.         de.setName(CostantiControlStation.PARAMETRO_VALORE);
  21241.         this.core.getLockUtilities().lockProperty(de, valore);
  21242.         de.setRequired(true);
  21243.         de.setSize(this.getSize());
  21244.         dati.add(de);

  21245.         return dati;
  21246.        
  21247.     }
  21248.    
  21249.    
  21250.     // ****** PROFILO MODI ******
  21251.    
  21252.     public boolean isProfiloModIPA(String protocollo) {
  21253.         return this.core.isProfiloModIPA(protocollo);
  21254.     }
  21255.    
  21256.     public boolean forceHttpsProfiloModiPA() {
  21257.         return true;
  21258.     }
  21259.     public void readModIConfiguration(BooleanNullable forceHttpsClient, BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21260.             IDAccordo idAccordoParteComune, String portType,
  21261.             List<String> azioneGruppo) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
  21262.         AccordoServizioParteComune aspc = this.apcCore.getAccordoServizioFull(idAccordoParteComune,false);
  21263.        
  21264.         // Sicurezza canale
  21265.         readForceHttpsClient(aspc, forceHttpsClient);
  21266.        
  21267.         // SorgenteToken
  21268.         String propertyNameSicurezzaRidefinita = CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE;
  21269.        
  21270.         BooleanNullable forcePDNDApi=null;
  21271.         BooleanNullable forceOAuthApi=null;
  21272.         if(azioneGruppo==null || azioneGruppo.isEmpty()) {
  21273.             readForceTokenPolicy(aspc.getProtocolPropertyList(), forcePDND, forceOAuth);
  21274.             if(forcePDND.getValue()!=null && forceOAuth.getValue()!=null) {
  21275.                 return;
  21276.             }
  21277.         }
  21278.         else {
  21279.             forcePDNDApi=BooleanNullable.NULL();
  21280.             forceOAuthApi=BooleanNullable.NULL();
  21281.             readForceTokenPolicy(aspc.getProtocolPropertyList(), forcePDNDApi, forceOAuthApi);
  21282.         }
  21283.        
  21284.         if(org.openspcoop2.core.registry.constants.ServiceBinding.SOAP.equals(aspc.getServiceBinding())) {
  21285.             readForceTokenPolicySoap(forcePDND, forceOAuth,
  21286.                     aspc, portType, azioneGruppo,
  21287.                     propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21288.         }
  21289.         else {
  21290.             readForceTokenPolicyRest(forcePDND, forceOAuth,
  21291.                     aspc, azioneGruppo,
  21292.                     propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21293.         }
  21294.        
  21295.         if(forcePDND.getValue()==null) {
  21296.             forcePDND.setValue(false);
  21297.         }
  21298.         if(forceOAuth.getValue()==null) {
  21299.             forceOAuth.setValue(false);
  21300.         }
  21301.     }
  21302.     private void readForceHttpsClient(AccordoServizioParteComune aspc, BooleanNullable forceHttpsClient) {
  21303.         String propertyName = CostantiDB.MODIPA_PROFILO_SICUREZZA_CANALE;
  21304.         for (ProtocolProperty pp : aspc.getProtocolPropertyList()) {
  21305.             if(pp.getName().equals(propertyName)) {
  21306.                 String value = pp.getValue();
  21307.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_CANALE_VALUE_IDAC02.equals(value)) {
  21308.                     forceHttpsClient.setValue(true);
  21309.                     return;
  21310.                 }
  21311.                 break;
  21312.             }
  21313.         }
  21314.         forceHttpsClient.setValue(false);
  21315.     }
  21316.     private void readForceTokenPolicySoap(BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21317.             AccordoServizioParteComune aspc, String portType, List<String> azioneGruppo,
  21318.             String propertyNameSicurezzaRidefinita, BooleanNullable forcePDNDApi, BooleanNullable forceOAuthApi) {
  21319.         if(portType!=null) {
  21320.             if(aspc.sizePortTypeList()>0) {
  21321.                 for (PortType pt : aspc.getPortTypeList()) {
  21322.                     if(portType.equals(pt.getNome()) &&
  21323.                         pt.sizeAzioneList()>0) {
  21324.                         readForceTokenPolicySoapOperation(forcePDND, forceOAuth,
  21325.                                 pt, azioneGruppo,
  21326.                                 propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21327.                     }
  21328.                 }
  21329.             }
  21330.         }
  21331.         else {
  21332.             readForceTokenPolicySoapAzione(forcePDND, forceOAuth,
  21333.                     aspc, azioneGruppo,
  21334.                     propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21335.         }
  21336.     }
  21337.     private void readForceTokenPolicySoapOperation(BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21338.             PortType pt, List<String> azioneGruppo,
  21339.             String propertyNameSicurezzaRidefinita, BooleanNullable forcePDNDApi, BooleanNullable forceOAuthApi) {
  21340.         for (Operation op : pt.getAzioneList()) {
  21341.             if(azioneGruppo==null || azioneGruppo.contains(op.getNome())) {
  21342.                 readForceTokenPolicy(op.getProtocolPropertyList(), forcePDND, forceOAuth,  
  21343.                         propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21344.                 if(forcePDND.getValue()!=null && forceOAuth.getValue()!=null) {
  21345.                     return;
  21346.                 }
  21347.             }
  21348.         }
  21349.     }
  21350.     private void readForceTokenPolicySoapAzione(BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21351.             AccordoServizioParteComune aspc, List<String> azioneGruppo,
  21352.             String propertyNameSicurezzaRidefinita, BooleanNullable forcePDNDApi, BooleanNullable forceOAuthApi) {
  21353.         if(aspc.sizeAzioneList()>0) {
  21354.             for (Azione az : aspc.getAzioneList()) {
  21355.                 if(azioneGruppo==null || azioneGruppo.contains(az.getNome())) {
  21356.                     readForceTokenPolicy(az.getProtocolPropertyList(), forcePDND, forceOAuth,  
  21357.                             propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21358.                     if(forcePDND.getValue()!=null && forceOAuth.getValue()!=null) {
  21359.                         return;
  21360.                     }
  21361.                 }
  21362.             }
  21363.         }
  21364.     }
  21365.     private void readForceTokenPolicyRest(BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21366.             AccordoServizioParteComune aspc, List<String> azioneGruppo,
  21367.             String propertyNameSicurezzaRidefinita, BooleanNullable forcePDNDApi, BooleanNullable forceOAuthApi) {
  21368.         if(aspc.sizeResourceList()>0) {
  21369.             for (Resource res : aspc.getResource()) {
  21370.                 if(azioneGruppo==null || azioneGruppo.contains(res.getNome())) {
  21371.                     readForceTokenPolicy(res.getProtocolPropertyList(), forcePDND, forceOAuth,
  21372.                             propertyNameSicurezzaRidefinita, forcePDNDApi, forceOAuthApi);
  21373.                     if(forcePDND.getValue()!=null && forceOAuth.getValue()!=null) {
  21374.                         return;
  21375.                     }
  21376.                 }
  21377.             }
  21378.         }
  21379.     }
  21380.     private void readForceTokenPolicy(List<ProtocolProperty> list, BooleanNullable forcePDND, BooleanNullable forceOAuth,
  21381.             String propertyNameSicurezzaRidefinita, BooleanNullable forcePDNDApi, BooleanNullable forceOAuthApi) {
  21382.         if(list!=null && !list.isEmpty()) {
  21383.             boolean leggiSorgente = true;
  21384.             if(propertyNameSicurezzaRidefinita!=null) {
  21385.                 leggiSorgente = false;
  21386.                 for (ProtocolProperty pp : list) {
  21387.                     if(pp.getName().equals(propertyNameSicurezzaRidefinita)) {
  21388.                         if(CostantiDB.MODIPA_PROFILO_RIDEFINISCI.equals(pp.getValue())) {
  21389.                             leggiSorgente = true;
  21390.                         }
  21391.                         else {
  21392.                             if(forcePDNDApi!=null && forcePDNDApi.getValue()!=null) {
  21393.                                 forcePDND.setValue(forcePDNDApi.getValue());
  21394.                             }
  21395.                             if(forceOAuthApi!=null && forceOAuthApi.getValue()!=null) {
  21396.                                 forceOAuth.setValue(forceOAuthApi.getValue());
  21397.                             }
  21398.                         }
  21399.                     }
  21400.                 }
  21401.             }
  21402.             if(leggiSorgente) {
  21403.                 readForceTokenPolicy(list, forcePDND, forceOAuth);
  21404.             }
  21405.         }
  21406.     }
  21407.     private void readForceTokenPolicy(List<ProtocolProperty> list, BooleanNullable forcePDND, BooleanNullable forceOAuth) {
  21408.         String propertyNameSorgenteToken = CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH;
  21409.         for (ProtocolProperty pp : list) {
  21410.             if(pp.getName().equals(propertyNameSorgenteToken)) {
  21411.                 String value = pp.getValue();
  21412.                 setForceTokenPolicy(forcePDND, forceOAuth, value);
  21413.                 if(forcePDND.getValue()!=null && forceOAuth.getValue()!=null) {
  21414.                     break;
  21415.                 }
  21416.             }
  21417.         }
  21418.     }
  21419.     private void setForceTokenPolicy(BooleanNullable forcePDND, BooleanNullable forceOAuth, String value) {
  21420.         if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(value)) {
  21421.             forcePDND.setValue(true);
  21422.         }
  21423.         else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH.equals(value)) {
  21424.             forceOAuth.setValue(true);
  21425.         }
  21426.     }

  21427.     public List<DataElement> addProxyPassConfigurazioneRegola(TipoOperazione tipoOp, List<DataElement> dati,
  21428.             String idRegolaS, String nome, String descrizione, String stato, boolean regExpr, String regolaText,
  21429.             String contestoEsterno, String baseUrl, String protocollo, List<String> protocolli, String soggetto,
  21430.             List<IDSoggetto> soggetti, String ruolo, String serviceBinding, boolean multiTenant) throws DriverControlStationException {
  21431.        
  21432.         DataElement dataElement = new DataElement();
  21433.         dataElement.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA);
  21434.         dataElement.setType(DataElementType.TITLE);
  21435.         dati.add(dataElement);
  21436.        
  21437.         DataElement de = new DataElement();
  21438.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_ID_REGOLA);
  21439.         de.setType(DataElementType.HIDDEN);
  21440.         de.setValue(idRegolaS);
  21441.         dati.add(de);
  21442.        
  21443.         // nome
  21444.         de = new DataElement();
  21445.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME);
  21446.         de.setValue(nome);
  21447. //      if(TipoOperazione.ADD.equals(tipoOp)){
  21448.             de.setType(DataElementType.TEXT_EDIT);
  21449.             de.setRequired(true);
  21450. //      }
  21451. //      else{
  21452. //          de.setType(DataElementType.TEXT);
  21453. //      }
  21454.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME);
  21455.         de.setSize(this.getSize());
  21456.         dati.add(de);
  21457.        
  21458.         // stato
  21459.         de = new DataElement();
  21460.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO);
  21461.         String [] labelsStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
  21462.         String [] valuesStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
  21463.         de.setLabels(labelsStato);
  21464.         de.setValues(valuesStato);
  21465.         de.setType(DataElementType.SELECT);
  21466.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO);
  21467.         de.setSelected(stato);
  21468.         dati.add(de);
  21469.        
  21470.         // descrizione
  21471.         de = new DataElement();
  21472.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_DESCRIZIONE);
  21473.         de.setValue(descrizione);
  21474.         de.setType(DataElementType.TEXT_AREA);
  21475.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_DESCRIZIONE);
  21476.         de.setSize(this.getSize());
  21477.         dati.add(de);
  21478.        
  21479.        
  21480.         dataElement = new DataElement();
  21481.         dataElement.setLabel(CostantiControlStation.LABEL_PROXY_PASS_REGOLA_CRITERI_APPLICABILITA);
  21482.         dataElement.setType(DataElementType.TITLE);
  21483.         dati.add(dataElement);
  21484.        
  21485.         // regExpr
  21486.         de = new DataElement();
  21487.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REG_EXPR);
  21488.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REG_EXPR);
  21489.         de.setType(DataElementType.CHECKBOX);
  21490.         de.setSelected(regExpr);
  21491.         de.setValue(regExpr+"");
  21492.         de.setPostBack(true);
  21493.         dati.add(de);
  21494.        
  21495.         // regola
  21496.         de = new DataElement();
  21497.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT);
  21498.         de.setValue(regolaText);
  21499.         de.setType(DataElementType.TEXT_EDIT);
  21500.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT);
  21501.         de.setSize(this.getSize());
  21502.         de.setRequired(true);
  21503.         DataElementInfo deInfo = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT);
  21504.         if(regExpr) {
  21505.             deInfo.setHeaderBody(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT_REGEXP);
  21506.         }
  21507.         else {
  21508.             deInfo.setHeaderBody(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT_STRINGA_LIBERA);
  21509.         }
  21510.         de.setInfo(deInfo);
  21511.        
  21512.         dati.add(de);
  21513.                
  21514.         // profilo
  21515.         de = new DataElement();
  21516.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_PROFILO);
  21517.        
  21518.         String [] labelsProfili = new String[protocolli.size() + 1];
  21519.         String [] valuesProfili = new String[protocolli.size() + 1];
  21520.        
  21521.         labelsProfili[0] = CostantiControlStation.LABEL_QUALSIASI;
  21522.         valuesProfili[0] = "";
  21523.        
  21524.         int i = 1;
  21525.         for (String protocolloS : protocolli) {
  21526.             labelsProfili[i] = _getLabelProtocollo(protocolloS);
  21527.             valuesProfili[i] = protocolloS;
  21528.             i++;
  21529.         }
  21530.                
  21531.         de.setLabels(labelsProfili);
  21532.         de.setValues(valuesProfili);
  21533.         de.setType(DataElementType.SELECT);
  21534.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_PROFILO);
  21535.         de.setPostBack(true);
  21536.         de.setSelected(protocollo);
  21537.         dati.add(de);
  21538.        
  21539.         // soggetto
  21540.         de = new DataElement();
  21541.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SOGGETTO);
  21542.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SOGGETTO);
  21543.         if(!"".equals(protocollo) && multiTenant) {
  21544.             String [] labelsSoggetti = new String[soggetti.size() + 1];
  21545.             String [] valuesSoggetti = new String[soggetti.size() + 1];
  21546.            
  21547.             labelsSoggetti[0] = CostantiControlStation.LABEL_QUALSIASI;
  21548.             valuesSoggetti[0] = "";
  21549.            
  21550.             i = 1;
  21551.             for (IDSoggetto idSoggetto : soggetti) {
  21552.                 labelsSoggetti[i] = _getLabelNomeSoggetto(idSoggetto);
  21553.                 valuesSoggetti[i] = idSoggetto.toString();
  21554.                 i++;
  21555.             }
  21556.            
  21557.             de.setLabels(labelsSoggetti);
  21558.             de.setValues(valuesSoggetti);
  21559.             de.setType(DataElementType.SELECT);
  21560.             de.setSelected(soggetto);
  21561.         } else {
  21562.             de.setType(DataElementType.HIDDEN);
  21563.             de.setValue(soggetto);
  21564.         }
  21565.         dati.add(de);
  21566.        
  21567.         // ruolo
  21568.         de = new DataElement();
  21569.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_RUOLO);
  21570.         de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_PROXY_PASS_REGOLA_RUOLO);
  21571.         de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_PROXY_PASS_REGOLA_RUOLO);
  21572.         de.setType(DataElementType.SELECT);
  21573.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_RUOLO);
  21574.         de.setSelected(ruolo);
  21575.         dati.add(de);
  21576.        
  21577.         // serviceBinding
  21578.         de = new DataElement();
  21579.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SERVICE_BINDING);
  21580.         de.setLabels(CostantiControlStation.SELECT_LABELS_PARAMETRO_PROXY_PASS_REGOLA_SERVICE_BINDING);
  21581.         de.setValues(CostantiControlStation.SELECT_VALUES_PARAMETRO_PROXY_PASS_REGOLA_SERVICE_BINDING);
  21582.         de.setType(DataElementType.SELECT);
  21583.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SERVICE_BINDING);
  21584.         de.setSelected(serviceBinding);
  21585.         dati.add(de);

  21586.         dataElement = new DataElement();
  21587.         dataElement.setLabel(CostantiControlStation.LABEL_PROXY_PASS_REGOLA_NUOVA_URL);
  21588.         dataElement.setType(DataElementType.TITLE);
  21589.         dati.add(dataElement);
  21590.        
  21591.         StringBuilder sb = new StringBuilder();
  21592.         if(regExpr) {
  21593.             sb.append(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_EXPR_DATI_DINAMICI_REGXP);
  21594.         }
  21595.         CanaliConfigurazione canali = null;
  21596.         try {
  21597.             canali = this.confCore.getCanaliConfigurazione(false);
  21598.         }catch(Exception e) {
  21599.             throw new DriverControlStationException(e.getMessage(),e);
  21600.         }
  21601.         if(canali!=null && StatoFunzionalita.ABILITATO.equals(canali.getStato())) {
  21602.             sb.append(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_EXPR_DATI_DINAMICI_CANALE);
  21603.         }
  21604.         sb.append(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_EXPR_DATI_DINAMICI_TAG);
  21605.        
  21606.         // baseUrl
  21607.         de = new DataElement();
  21608.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL);
  21609.         de.setValue(baseUrl);
  21610.         de.setType(DataElementType.TEXT_EDIT);
  21611.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL);
  21612.         de.setSize(this.getSize());
  21613.         deInfo = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL);
  21614.         deInfo.setHeaderBody(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL);
  21615.         deInfo.setHeaderBody(deInfo.getHeaderBody()+sb.toString());
  21616.         de.setInfo(deInfo);
  21617.         dati.add(de);
  21618.        
  21619.         // contesto
  21620.         de = new DataElement();
  21621.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO);
  21622.         de.setValue(contestoEsterno);
  21623.         de.setType(DataElementType.TEXT_EDIT);
  21624.         de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO);
  21625.         de.setSize(this.getSize());
  21626.         de.setRequired(false);
  21627.         deInfo = new DataElementInfo(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO);
  21628.         deInfo.setHeaderBody(CostantiControlStation.MESSAGGIO_INFO_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO);
  21629.         deInfo.setHeaderBody(deInfo.getHeaderBody()+sb.toString());
  21630.         de.setInfo(deInfo);
  21631.         dati.add(de);
  21632.                
  21633.         return dati;
  21634.     }
  21635.    
  21636.     public String getStatoConnettoriMultipliPortaApplicativa(PortaApplicativa paAssociata) throws DriverControlStationException, DriverControlStationNotFound {
  21637.        
  21638.         if(paAssociata==null) {
  21639.             throw new DriverControlStationException("Param paAssociata is null");
  21640.         }
  21641.        
  21642.         boolean connettoreMultiploEnabled = paAssociata.getBehaviour() != null;
  21643.         return connettoreMultiploEnabled ? CostantiConfigurazione.ABILITATO.toString() : CostantiConfigurazione.DISABILITATO.toString();
  21644.     }
  21645.    
  21646.     public String getNomiConnettoriMultipliPortaApplicativa(PortaApplicativa paAssociata) throws DriverControlStationException, DriverControlStationNotFound, NotFoundException {
  21647.         StringBuilder sbConnettoriMultipli = new StringBuilder();
  21648.        
  21649.         TipoBehaviour behaviourType = TipoBehaviour.toEnumConstant(paAssociata.getBehaviour().getNome());
  21650.         switch (behaviourType) {
  21651.         case CONSEGNA_LOAD_BALANCE:
  21652.             String loadBalanceStrategia = ConfigurazioneLoadBalancer.readLoadBalancerType(paAssociata.getBehaviour());
  21653.             LoadBalancerType type = LoadBalancerType.toEnumConstant(loadBalanceStrategia, true);
  21654.             sbConnettoriMultipli.append(behaviourType.getLabel()).append(" '");
  21655.             if(StickyUtils.isConfigurazioneSticky(paAssociata, ControlStationLogger.getPddConsoleCoreLogger())){
  21656.                 sbConnettoriMultipli.append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_STICKY).append(" ");
  21657.             }
  21658.             sbConnettoriMultipli.append(type.getLabel()).append("'");
  21659.            
  21660.             boolean condizionale = ConditionalUtils.isConfigurazioneCondizionale(paAssociata, ControlStationLogger.getPddConsoleCoreLogger());
  21661.             if(condizionale) {
  21662.                 sbConnettoriMultipli.append(" ").append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONSEGNA_CONDIZIONALE);
  21663.             }
  21664.            
  21665.             break;
  21666.         case CONSEGNA_MULTIPLA:
  21667.             sbConnettoriMultipli.append(behaviourType.getLabel());
  21668.            
  21669.             condizionale = ConditionalUtils.isConfigurazioneCondizionale(paAssociata, ControlStationLogger.getPddConsoleCoreLogger());
  21670.             if(condizionale) {
  21671.                 sbConnettoriMultipli.append(" ").append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_CONSEGNA_CONDIZIONALE);
  21672.             }
  21673.            
  21674.             break;
  21675.         case CONSEGNA_CON_NOTIFICHE:
  21676.             sbConnettoriMultipli.append(behaviourType.getLabel());
  21677.            
  21678.             condizionale = ConditionalUtils.isConfigurazioneCondizionale(paAssociata, ControlStationLogger.getPddConsoleCoreLogger());
  21679.             if(condizionale) {
  21680.                 sbConnettoriMultipli.append(" ").append(PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_CONNETTORI_MULTIPLI_NOTIFICHE_CONDIZIONALI);
  21681.             }
  21682.            
  21683.             break;
  21684.         case CONSEGNA_CONDIZIONALE:
  21685.             sbConnettoriMultipli.append(behaviourType.getLabel());
  21686.            
  21687.             break;
  21688.         case CUSTOM:
  21689.            
  21690.             String customLabel = paAssociata.getBehaviour().getNome();
  21691.             Plugin plugin = null;
  21692.             try {
  21693.                 plugin = this.confCore.getPlugin(TipoPlugin.BEHAVIOUR,customLabel, false);
  21694.             }catch(Throwable e) {
  21695.                 // ignore
  21696.             }
  21697.             if(plugin!=null) {
  21698.                 customLabel = plugin.getLabel();
  21699.             }
  21700.            
  21701.             sbConnettoriMultipli.append("Consegna Personalizzata '"+customLabel+"'");
  21702.             break;
  21703.         }
  21704.        
  21705.         return sbConnettoriMultipli.toString();
  21706.     }
  21707.    
  21708.     public String getToolTipConnettoriMultipliPortaApplicativa(PortaApplicativa paAssociata) throws DriverControlStationException, DriverControlStationNotFound {
  21709.         StringBuilder sbConnettoriMultipli = new StringBuilder();
  21710.         for (PortaApplicativaServizioApplicativo paSA : paAssociata.getServizioApplicativoList()) {
  21711.             if(sbConnettoriMultipli.length() >0)
  21712.                 sbConnettoriMultipli.append(", ");
  21713.             if(paSA.getDatiConnettore() == null) {
  21714.                 sbConnettoriMultipli.append(CostantiConfigurazione.NOME_CONNETTORE_DEFAULT);
  21715.             } else {
  21716.                 sbConnettoriMultipli.append(paSA.getDatiConnettore().getNome());
  21717.             }
  21718.         }
  21719.         return sbConnettoriMultipli.toString();
  21720.     }
  21721.    
  21722.     public List<DataElement> addInformazioniGruppiAsHiddenToDati(TipoOperazione tipoOp, List<DataElement> dati,
  21723.             String idTabGruppo, String idTabConnettoriMultipli, String accessoDaAPS, String connettoreAccessoDaGruppi, String connettoreRegistro, String connettoreAccessoDaListaConnettoriMultipli) {
  21724.        
  21725.         if(idTabGruppo != null) {
  21726.             DataElement de = new DataElement();
  21727.             de.setName(CostantiControlStation.PARAMETRO_ID_TAB);
  21728.             de.setType(DataElementType.HIDDEN);
  21729.             de.setValue(idTabGruppo);
  21730.             dati.add(de);
  21731.         }
  21732.        
  21733.         if(idTabConnettoriMultipli != null) {
  21734.             DataElement de = new DataElement();
  21735.             de.setName(CostantiControlStation.PARAMETRO_ID_CONN_TAB);
  21736.             de.setType(DataElementType.HIDDEN);
  21737.             de.setValue(idTabConnettoriMultipli);
  21738.             dati.add(de);
  21739.         }
  21740.        
  21741.         if(accessoDaAPS != null) {
  21742.             DataElement de = new DataElement();
  21743.             de.setName(CostantiControlStation.PARAMETRO_CONNETTORE_DA_LISTA_APS);
  21744.             de.setType(DataElementType.HIDDEN);
  21745.             de.setValue(accessoDaAPS);
  21746.             dati.add(de);
  21747.         }
  21748.        
  21749.         if(connettoreAccessoDaGruppi != null) {
  21750.             DataElement de = new DataElement();
  21751.             de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_GRUPPI);
  21752.             de.setType(DataElementType.HIDDEN);
  21753.             de.setValue(connettoreAccessoDaGruppi);
  21754.             dati.add(de);
  21755.         }
  21756.        
  21757.         if(connettoreRegistro != null) {
  21758.             DataElement de = new DataElement();
  21759.             de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_REGISTRO);
  21760.             de.setType(DataElementType.HIDDEN);
  21761.             de.setValue(connettoreRegistro);
  21762.             dati.add(de);
  21763.         }
  21764.        
  21765.         if(connettoreAccessoDaListaConnettoriMultipli != null) {
  21766.             DataElement de = new DataElement();
  21767.             de.setName(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTORE_ACCESSO_DA_LISTA_CONNETTORI_MULTIPLI);
  21768.             de.setType(DataElementType.HIDDEN);
  21769.             de.setValue(connettoreAccessoDaListaConnettoriMultipli);
  21770.             dati.add(de);
  21771.         }
  21772.        
  21773.         return dati;
  21774.     }
  21775.    
  21776.     public boolean isConnettoreDefault(PortaApplicativaServizioApplicativo paSA) {
  21777.         return paSA.getDatiConnettore()!= null ? !paSA.getDatiConnettore().isNotifica() : true;
  21778.     }
  21779.    
  21780.     public String getLabelNomePortaApplicativaServizioApplicativo(PortaApplicativaServizioApplicativo paSA) {
  21781.         String nomePaSA = (paSA!=null && paSA.getDatiConnettore()!= null) ? paSA.getDatiConnettore().getNome() : CostantiConfigurazione.NOME_CONNETTORE_DEFAULT;
  21782.         return nomePaSA;
  21783.     }
  21784.    
  21785.     public int getIdxNuovoConnettoreMultiplo(PortaApplicativa pa) {
  21786.         int idxConfigurazione = 0;
  21787.         int listaMappingErogazioneSize = pa.sizeServizioApplicativoList();
  21788.        
  21789.         for (int i = 0; i < listaMappingErogazioneSize; i++) {
  21790.             PortaApplicativaServizioApplicativo paSA = pa.getServizioApplicativo(i);
  21791.             //if(!this.isConnettoreDefault(paSA)) {
  21792.             int idx = paSA.getNome().indexOf(ConnettoriCostanti.PARAMETRO_CONNETTORI_MULTIPLI_SAX_PREFIX);
  21793.             if(idx > -1) {
  21794.                 String idxTmp = paSA.getNome().substring(idx + ConnettoriCostanti.PARAMETRO_CONNETTORI_MULTIPLI_SAX_PREFIX.length());
  21795.                 int idxMax = -1;
  21796.                 try {
  21797.                     idxMax = Integer.parseInt(idxTmp);
  21798.                 }catch(Exception e) {
  21799.                     idxMax = 0;
  21800.                 }
  21801.                 idxConfigurazione = Math.max(idxConfigurazione, idxMax);
  21802.             }
  21803.             //}
  21804.         }
  21805.                
  21806.         return ( ++ idxConfigurazione);
  21807.     }

  21808.    
  21809.     public boolean allActionsRedefinedMappingErogazione(List<String> azioni, List<MappingErogazionePortaApplicativa> lista) throws DriverConfigurazioneException, DriverConfigurazioneNotFound {
  21810.         // verifico se tutte le azioni sono definite in regole specifiche
  21811.         boolean all = true;
  21812.         if(azioni!=null && azioni.size()>0) {
  21813.             for (String azione : azioni) {
  21814.                 if(lista==null || lista.size()<=0) {
  21815.                     all  = false;
  21816.                     break;
  21817.                 }
  21818.                 boolean found = false;
  21819.                 for (MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa : lista) {
  21820.                     PortaApplicativa paAssociata = this.porteApplicativeCore.getPortaApplicativa(mappingErogazionePortaApplicativa.getIdPortaApplicativa());
  21821.                     if(paAssociata.getAzione() != null && paAssociata.getAzione().getAzioneDelegataList().contains(azione)) {
  21822.                         found = true;
  21823.                         break;
  21824.                     }
  21825.                 }
  21826.                 if(!found) {
  21827.                     all  = false;
  21828.                     break;
  21829.                 }
  21830.             }
  21831.         }
  21832.         return all;
  21833.     }
  21834.    
  21835.     public List<String> getAllActionsNotRedefinedMappingErogazione(List<String> azioni, List<MappingErogazionePortaApplicativa> lista) throws DriverConfigurazioneException, DriverConfigurazioneNotFound {
  21836.         // verifico se tutte le azioni sono definite in regole specifiche
  21837.         List<String> l = new ArrayList<>();
  21838.         if(lista==null || lista.size()<=0) {
  21839.             return azioni;
  21840.         }
  21841.         l.addAll(azioni);
  21842.         for (MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa : lista) {
  21843.             PortaApplicativa paAssociata = this.porteApplicativeCore.getPortaApplicativa(mappingErogazionePortaApplicativa.getIdPortaApplicativa());
  21844.             if(paAssociata.getAzione() != null && !paAssociata.getAzione().getAzioneDelegataList().isEmpty()) {
  21845.                 for (String azPA : paAssociata.getAzione().getAzioneDelegataList()) {
  21846.                     l.remove(azPA);
  21847.                 }
  21848.             }
  21849.         }
  21850.         return l;
  21851.     }
  21852.    
  21853.     public boolean isSoapOneWay(PortaApplicativa portaApplicativa, MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa,
  21854.             AccordoServizioParteSpecifica asps, AccordoServizioParteComuneSintetico as, ServiceBinding serviceBinding)
  21855.                     throws DriverControlStationException, DriverRegistroServiziException, DriverConfigurazioneException, DriverConfigurazioneNotFound {
  21856.         boolean isSoapOneWay = false;
  21857.        
  21858.         if(serviceBinding.equals(ServiceBinding.SOAP)) {
  21859.             // controllo che tutte le azioni del gruppo siano oneway
  21860.             // se c'e' almeno un'azione non oneway visualizzo la sezione notifiche
  21861.             if(mappingErogazionePortaApplicativa.isDefault()) {
  21862.                 Map<String,String> azioni = null;
  21863.                 try{
  21864.                     azioni =this.porteApplicativeCore.getAzioniConLabel(asps, as, false, true, new ArrayList<>());
  21865.                 }catch(Exception e) {
  21866.                     throw new DriverControlStationException(e.getMessage(),e);
  21867.                 }
  21868.                 IDServizio idServizio2 = IDServizioFactory.getInstance().getIDServizioFromAccordo(asps);
  21869.                 List<MappingErogazionePortaApplicativa> lista = this.apsCore.mappingServiziPorteAppList(idServizio2,asps.getId(), null);
  21870.        
  21871.                 boolean allActionRedefined = false;
  21872.                 List<String> actionNonRidefinite = null;
  21873.        
  21874.                 List<String> azioniL = new ArrayList<>();
  21875.                 if(azioni != null && azioni.size() > 0)
  21876.                     azioniL.addAll(azioni.keySet());
  21877.                 allActionRedefined = this.allActionsRedefinedMappingErogazione(azioniL, lista);
  21878.                 if(!allActionRedefined) {
  21879.                     actionNonRidefinite = this.getAllActionsNotRedefinedMappingErogazione(azioniL, lista);
  21880.                     isSoapOneWay = this.porteApplicativeCore.azioniTutteOneway(asps, as, actionNonRidefinite);
  21881.                 } else {
  21882.                     isSoapOneWay = false;
  21883.                 }
  21884.             } else {
  21885.                 List<String> listaAzioni = portaApplicativa.getAzione()!= null ?  portaApplicativa.getAzione().getAzioneDelegataList() : new ArrayList<>();
  21886.                 isSoapOneWay = this.porteApplicativeCore.azioniTutteOneway(asps, as, listaAzioni);
  21887.             }
  21888.         } else {
  21889.             isSoapOneWay = false;
  21890.         }
  21891.        
  21892.         return isSoapOneWay;
  21893.     }

  21894.     public DataElement newDataElementVisualizzaInNuovoTab(DataElement deParam, String url, String tooltip ) {
  21895.            
  21896.         DataElement de = deParam;
  21897.         if(de==null)
  21898.             de = new DataElement();
  21899.        
  21900.         de.setUrl(url);
  21901.         de.setTarget(TargetType.BLANK);
  21902.         if(tooltip != null)
  21903.             de.setToolTip(MessageFormat.format(CostantiControlStation.ICONA_VISUALIZZA_TOOLTIP_CON_PARAMETRO, tooltip));
  21904.         else  
  21905.             de.setToolTip(CostantiControlStation.ICONA_VISUALIZZA_TOOLTIP);
  21906.        
  21907.         de.setIcon(CostantiControlStation.ICONA_VISUALIZZA);
  21908.         de.setDisabilitaAjaxStatus();
  21909.         // link apri nuovo tab
  21910.         de.setVisualizzaLinkApriNuovaFinestra(true);
  21911.            
  21912.         return de;
  21913.     }
  21914.    
  21915.     public void setSecretPleaseCopy(String secret_password, String secret_user, boolean appId, String tipoAuth, OggettoDialogEnum oggettoDialog, String nome) {

  21916.         String nomeP = nome!=null ? " "+nome : "";
  21917.         String tipoOggetto = null;
  21918.         switch (oggettoDialog) {
  21919.         case UTENTE:
  21920.             tipoOggetto = "all'utente"+nomeP;
  21921.             break;
  21922.         case SOGGETTO:
  21923.             tipoOggetto = "al soggetto"+nomeP;
  21924.             break;
  21925.         case APPLICATIVO:
  21926.             tipoOggetto = "all'applicativo"+nomeP;
  21927.             break;
  21928.         case EROGAZIONE:
  21929.             tipoOggetto = "all'erogazione";
  21930.             break;
  21931.         case CONNETTORE_MULTIPLO:
  21932.             tipoOggetto = "al connettore"+nomeP+" dell'erogazione";
  21933.             break;
  21934.         }
  21935.        
  21936.         String header1= "";
  21937.         BodyElement utente = Dialog.newBodyElement();
  21938.         if(utente!=null) {
  21939.             utente.setVisualizzaCopyAction(true);
  21940.         }
  21941.         BodyElement password = Dialog.newBodyElement();
  21942.         if(password!=null) {
  21943.             password.setVisualizzaCopyAction(true);
  21944.         }
  21945.        
  21946.         if (ConnettoriCostanti.AUTENTICAZIONE_TIPO_BASIC.equals(tipoAuth)) {
  21947.             if(utente!=null) {
  21948.                 utente.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_USERNAME);
  21949.                 utente.setType(DataElementType.TEXT_EDIT);
  21950.                 utente.setValue(StringEscapeUtils.escapeHtml(secret_user));
  21951.                 utente.setTooltipCopyAction(MessageFormat.format(Costanti.TOOLTIP_ICONA_COPIA, ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_USERNAME));
  21952.             }
  21953.            
  21954.             if(password!=null) {
  21955.                 password.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_PASSWORD);
  21956.                 password.setType(DataElementType.TEXT_EDIT);
  21957.                 password.setValue(StringEscapeUtils.escapeHtml(secret_password));
  21958.                 password.setTooltipCopyAction(MessageFormat.format(Costanti.TOOLTIP_ICONA_COPIA, ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_PASSWORD));
  21959.             }
  21960.            
  21961.             header1 = ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_USERNAME+" e " + ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_PASSWORD + " generata" ;
  21962.         }
  21963.         else if (ConnettoriCostanti.AUTENTICAZIONE_TIPO_APIKEY.equals(tipoAuth)) {
  21964.             if(appId) {
  21965.                 if(utente!=null) {
  21966.                     utente.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID);
  21967.                     utente.setType(DataElementType.TEXT_EDIT);
  21968.                     utente.setValue(StringEscapeUtils.escapeHtml(secret_user));
  21969.                     utente.setTooltipCopyAction(MessageFormat.format(Costanti.TOOLTIP_ICONA_COPIA, ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID));
  21970.                 }
  21971.             } else {
  21972.                 utente = null;
  21973.             }
  21974.            
  21975.             if(password!=null) {
  21976.                 password.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY);
  21977.                 password.setType(DataElementType.TEXT_AREA);
  21978.                 password.setValue(StringEscapeUtils.escapeHtml(secret_password));
  21979.                 password.setTooltipCopyAction(MessageFormat.format(Costanti.TOOLTIP_ICONA_COPIA, ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY));
  21980.                 password.setCols(44);
  21981.             }
  21982.            
  21983.             header1 = ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_API_KEY + " generata" ;
  21984.             if(appId) {
  21985.                 header1 = ConnettoriCostanti.LABEL_PARAMETRO_CREDENZIALI_AUTENTICAZIONE_APP_ID+" e " + header1;
  21986.             }
  21987.         }
  21988.        
  21989.         boolean unaCredenziale = (ConnettoriCostanti.AUTENTICAZIONE_TIPO_APIKEY.equals(tipoAuth) && !appId);
  21990.         String singolare = unaCredenziale ? "a" : "e";
  21991.         String verbo = unaCredenziale ? "viene" : "vengono";
  21992.         String oggetto = unaCredenziale ? "la chiave" : "le credenziali";
  21993.         String intestazione = StringEscapeUtils.escapeHtml("Di seguito "+verbo+" riportat"+singolare+" "+oggetto+" associat"+singolare+" "+tipoOggetto+".")
  21994.                 +org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE+
  21995.                 StringEscapeUtils.escapeHtml("L'informazione viene visualizzata in questo avviso e successivamente non sarà più consultabile.");
  21996.         String attenzione = StringEscapeUtils.escapeHtml("Si prega di copiarl"+singolare+" e custodirl"+singolare+" attentamente.");
  21997.        
  21998.         Dialog dialog = new Dialog();
  21999.        
  22000.         dialog.setTitolo(Costanti.MESSAGE_TYPE_WARN_TITLE);
  22001.         dialog.setHeaderRiga1(header1);
  22002.         dialog.setHeaderRiga2(intestazione);
  22003.        
  22004.         if(utente!=null) {
  22005.             dialog.addBodyElement(utente);
  22006.         }
  22007.         if(password!=null) {
  22008.             dialog.addBodyElement(password);
  22009.         }

  22010.         dialog.setNotaFinale(attenzione);
  22011.        
  22012.        
  22013.         String[][] bottoni = {
  22014.                 { Costanti.LABEL_MONITOR_BUTTON_CHIUDI, "" }
  22015.                 };
  22016.        
  22017.         this.pd.setBottoni(bottoni);
  22018.        
  22019.         this.pd.setDialog(dialog);
  22020.        
  22021.     }
  22022.    
  22023.     public void addInUsoButtonVisualizzazioneClassica(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22024.         this.addInUsoButton(e, DataElementType.BUTTON, titolo, id, inUsoType,
  22025.                 CostantiControlStation.LABEL_IN_USO_TOOLTIP, Costanti.ICON_USO,
  22026.                 CostantiControlStation.LABEL_IN_USO_BODY_HEADER_RISULTATI,
  22027.                 true, true);
  22028.     }
  22029.     public void addInUsoButton(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22030.         this.addInUsoButton(e, DataElementType.IMAGE, titolo, id, inUsoType,
  22031.                 CostantiControlStation.LABEL_IN_USO_TOOLTIP, Costanti.ICON_USO,
  22032.                 CostantiControlStation.LABEL_IN_USO_BODY_HEADER_RISULTATI,
  22033.                 true, true);
  22034.     }
  22035.     public void addInUsoInfoButton(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22036.         this.addInUsoButton(e, DataElementType.IMAGE, titolo, id, inUsoType,
  22037.                 CostantiControlStation.LABEL_IN_USO_INFORMAZIONI_TOOLTIP, Costanti.ICON_USO_INFO,
  22038.                 CostantiControlStation.LABEL_IN_USO_BODY_HEADER_INFORMAZIONI,
  22039.                 true, true);
  22040.     }
  22041.     private void addInUsoButton(List<DataElement> e, DataElementType deType, String titolo, String id, InUsoType inUsoType,
  22042.             String tooltip, String icon, String headerRiga1,
  22043.             Boolean resizable, Boolean draggable) {
  22044.        
  22045.         ServletUtils.addInUsoButton(UtilsCostanti.SERVLET_NAME_INFORMAZIONI_UTILIZZO_OGGETTO, e, deType, titolo, id, inUsoType.toString(),
  22046.                 tooltip, icon, headerRiga1,
  22047.                 resizable, draggable, true);
  22048.        
  22049.     }
  22050.    
  22051.     public void addComandoInUsoButton(String titolo, String id, InUsoType inUsoType) {
  22052.          addComandoInUsoElementoButton(titolo, id, inUsoType,
  22053.                  CostantiControlStation.LABEL_IN_USO_TOOLTIP, Costanti.ICON_USO,
  22054.                     CostantiControlStation.LABEL_IN_USO_BODY_HEADER_RISULTATI,
  22055.                     true, true);
  22056.     }
  22057.     public void addComandoInUsoInfoButton(String titolo, String id, InUsoType inUsoType) {
  22058.          addComandoInUsoElementoButton(titolo, id, inUsoType,
  22059.                  CostantiControlStation.LABEL_IN_USO_INFORMAZIONI_TOOLTIP, Costanti.ICON_USO_INFO,
  22060.                     CostantiControlStation.LABEL_IN_USO_BODY_HEADER_INFORMAZIONI,
  22061.                     true, true);
  22062.     }
  22063.     private void addComandoInUsoElementoButton(String titolo, String id, InUsoType inUsoType,
  22064.             String tooltip, String icon, String headerRiga1,
  22065.             Boolean resizable, Boolean draggable) {
  22066.         this.pd.addComandoInUsoElementoButton(UtilsCostanti.SERVLET_NAME_INFORMAZIONI_UTILIZZO_OGGETTO,
  22067.                 titolo, id, inUsoType.toString(),
  22068.                 tooltip, icon, headerRiga1,
  22069.                 resizable, draggable);
  22070.     }
  22071.    
  22072.    
  22073.    
  22074.     public void addProprietaOggettoButtonVisualizzazioneClassica(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22075.         this.addProprietaOggettoButton(e, DataElementType.BUTTON, titolo, id, inUsoType,
  22076.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_TOOLTIP, Costanti.ICON_USO,
  22077.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_BODY_HEADER_RISULTATI,
  22078.                 true, true);
  22079.     }
  22080.     public void addProprietaOggettoButton(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22081.         this.addProprietaOggettoButton(e, DataElementType.IMAGE, titolo, id, inUsoType,
  22082.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_TOOLTIP, Costanti.ICON_USO,
  22083.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_BODY_HEADER_RISULTATI,
  22084.                 true, true);
  22085.     }
  22086.     public void addProprietaOggettoInfoButton(List<DataElement> e, String titolo, String id, InUsoType inUsoType) {
  22087.         this.addProprietaOggettoButton(e, DataElementType.IMAGE, titolo, id, inUsoType,
  22088.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_INFORMAZIONI_TOOLTIP, Costanti.ICON_USO_INFO,
  22089.                 CostantiControlStation.LABEL_PROPRIETA_OGGETTO_BODY_HEADER_INFORMAZIONI,
  22090.                 true, true);
  22091.     }
  22092.     private void addProprietaOggettoButton(List<DataElement> e, DataElementType deType, String titolo, String id, InUsoType inUsoType,
  22093.             String tooltip, String icon, String headerRiga1,
  22094.             Boolean resizable, Boolean draggable) {
  22095.        
  22096.         ServletUtils.addInUsoButton(UtilsCostanti.SERVLET_NAME_PROPRIETA_OGGETTO, e, deType, titolo, id, inUsoType.toString(),
  22097.                 tooltip, icon, headerRiga1,
  22098.                 resizable, draggable, true);
  22099.        
  22100.     }
  22101.    
  22102.     public void addComandoProprietaOggettoButton(String titolo, String id, InUsoType inUsoType) {
  22103.          addComandoProprietaOggettoElementoButton(titolo, id, inUsoType,
  22104.                  CostantiControlStation.LABEL_PROPRIETA_OGGETTO_TOOLTIP, Costanti.ICON_USO,
  22105.                     CostantiControlStation.LABEL_PROPRIETA_OGGETTO_BODY_HEADER_RISULTATI,
  22106.                     true, true);
  22107.     }
  22108.     public void addComandoProprietaOggettoInfoButton(String titolo, String id, InUsoType inUsoType) {
  22109.          addComandoProprietaOggettoElementoButton(titolo, id, inUsoType,
  22110.                  CostantiControlStation.LABEL_PROPRIETA_OGGETTO_INFORMAZIONI_TOOLTIP, Costanti.ICON_USO_INFO,
  22111.                     CostantiControlStation.LABEL_PROPRIETA_OGGETTO_BODY_HEADER_INFORMAZIONI,
  22112.                     true, true);
  22113.     }
  22114.     private void addComandoProprietaOggettoElementoButton(String titolo, String id, InUsoType inUsoType,
  22115.             String tooltip, String icon, String headerRiga1,
  22116.             Boolean resizable, Boolean draggable) {
  22117.         this.pd.addComandoInUsoElementoButton(UtilsCostanti.SERVLET_NAME_PROPRIETA_OGGETTO,
  22118.                 titolo, id, inUsoType.toString(),
  22119.                 tooltip, icon, headerRiga1,
  22120.                 resizable, draggable);
  22121.     }
  22122.    
  22123.     public void addComandoResetCacheElementoButton(boolean utilizzaServizioCondiviso, String servletName, List<Parameter> parameters, InUsoType inUsoType) {
  22124.         if(utilizzaServizioCondiviso) {
  22125.             String titoloModale = "";
  22126.             String bodyModale = "";
  22127.             this.addComandoResetCacheCheUtilizzaServizioCondivisoButton(titoloModale, bodyModale, UtilsCostanti.SERVLET_NAME_CACHE_MANAGER, parameters, inUsoType);
  22128.         } else {
  22129.             this.pd.addComandoResetCacheElementoButton(servletName, parameters);
  22130.         }
  22131.     }
  22132.    
  22133.     public void addComandoResetCacheCheUtilizzaServizioCondivisoButton(String titoloModale, String bodyModale, String servletName, List<Parameter> parameters, InUsoType inUsoType) {
  22134.         this.pd.addComandoElementoCheUtilizzaServizioCondivisoButton(Costanti.ICONA_RESET_CACHE_ELEMENTO, Costanti.ICONA_RESET_CACHE_ELEMENTO_TOOLTIP, titoloModale, bodyModale, servletName, parameters, inUsoType.toString());        
  22135.        
  22136.     }
  22137.    
  22138.     public void addComandoVerificaCertificatiElementoButton(boolean utilizzaServizioCondiviso, String servletName, List<Parameter> parameters, InUsoType inUsoType) {
  22139.         if(utilizzaServizioCondiviso) {
  22140.             String titoloModale = "";
  22141.             String bodyModale = "";
  22142.             this.addComandoVerificaCertificatiCheUtilizzaServizioCondivisoButton(titoloModale, bodyModale, UtilsCostanti.SERVLET_NAME_VERIFICA_CERTIFICATI, parameters, inUsoType);
  22143.         } else {
  22144.             this.pd.addComandoVerificaCertificatiElementoButton(servletName, parameters);
  22145.         }
  22146.     }
  22147.    
  22148.     public void addComandoVerificaCertificatiCheUtilizzaServizioCondivisoButton(String titoloModale, String bodyModale, String servletName, List<Parameter> parameters, InUsoType inUsoType) {
  22149.         this.pd.addComandoElementoCheUtilizzaServizioCondivisoButton(Costanti.ICONA_VERIFICA_CERTIFICATI, Costanti.ICONA_VERIFICA_CERTIFICATI_TOOLTIP, titoloModale, bodyModale, servletName, parameters, inUsoType.toString());        
  22150.     }
  22151.    
  22152.     protected boolean existsProprietaOggetto(org.openspcoop2.core.registry.beans.ProprietaOggettoSintetico p, String descrizione) {
  22153.         return (p!=null &&
  22154.                     (
  22155.                             (p.getUtenteRichiedente()!=null && StringUtils.isNotEmpty(p.getUtenteRichiedente()))
  22156.                             ||
  22157.                             p.getDataCreazione()!=null
  22158.                             ||
  22159.                             (p.getUtenteUltimaModifica()!=null && StringUtils.isNotEmpty(p.getUtenteUltimaModifica()))  
  22160.                             ||
  22161.                             p.getDataUltimaModifica()!=null
  22162.                     )
  22163.                 )
  22164.                 ||
  22165.                 (descrizione!=null && StringUtils.isNotEmpty(descrizione));
  22166.     }
  22167.     protected boolean existsProprietaOggetto(org.openspcoop2.core.registry.ProprietaOggetto p, String descrizione) {
  22168.         return (p!=null &&
  22169.                 (
  22170.                         (p.getUtenteRichiedente()!=null && StringUtils.isNotEmpty(p.getUtenteRichiedente()))
  22171.                         ||
  22172.                         p.getDataCreazione()!=null
  22173.                         ||
  22174.                         (p.getUtenteUltimaModifica()!=null && StringUtils.isNotEmpty(p.getUtenteUltimaModifica()))  
  22175.                         ||
  22176.                         p.getDataUltimaModifica()!=null
  22177.                 )
  22178.             )
  22179.             ||
  22180.             (descrizione!=null && StringUtils.isNotEmpty(descrizione));
  22181.     }
  22182.     protected boolean existsProprietaOggetto(org.openspcoop2.core.config.ProprietaOggetto p, String descrizione) {
  22183.         return (p!=null &&
  22184.                 (
  22185.                         (p.getUtenteRichiedente()!=null && StringUtils.isNotEmpty(p.getUtenteRichiedente()))
  22186.                         ||
  22187.                         p.getDataCreazione()!=null
  22188.                         ||
  22189.                         (p.getUtenteUltimaModifica()!=null && StringUtils.isNotEmpty(p.getUtenteUltimaModifica()))  
  22190.                         ||
  22191.                         p.getDataUltimaModifica()!=null
  22192.                 )
  22193.             )
  22194.             ||
  22195.             (descrizione!=null && StringUtils.isNotEmpty(descrizione));
  22196.     }
  22197.    
  22198.    
  22199.    
  22200.     public void addComandoVerificaCertificatiButton(List<DataElement> e, String nomeElementoSuCuiEffettuareLaVerifica, String servletName, List<Parameter> parameters) {
  22201.         if(parameters == null) {
  22202.             parameters = new ArrayList<>();
  22203.         }

  22204.         if(nomeElementoSuCuiEffettuareLaVerifica!=null) {
  22205.             // nop
  22206.         }
  22207.         this.addAzioneButton(e, DataElementType.IMAGE,  CostantiControlStation.ICONA_VERIFICA_CERTIFICATI_TOOLTIP,
  22208. //              MessageFormat.format(Costanti.ICONA_RESET_CACHE_ELEMENTO_TOOLTIP_CON_PARAMETRO, nomeElementoSuCuiEffettuareLaVerifica),
  22209.                 CostantiControlStation.ICONA_VERIFICA_CERTIFICATI, servletName,parameters);
  22210.     }
  22211.    
  22212.     public void addComandoResetCacheButton(List<DataElement> e, String nomeElementoSuCuiEffettuareIlReset, String servletName, List<Parameter> parameters) {
  22213.         if(parameters == null) {
  22214.             parameters = new ArrayList<>();
  22215.         }
  22216.        
  22217.         parameters.add(new Parameter(CostantiControlStation.PARAMETRO_ELIMINA_ELEMENTO_DALLA_CACHE, "true"));
  22218.        
  22219.         if(nomeElementoSuCuiEffettuareIlReset!=null) {
  22220.             // nop
  22221.         }
  22222.         this.addAzioneButton(e, DataElementType.IMAGE,  Costanti.ICONA_RESET_CACHE_ELEMENTO_TOOLTIP,
  22223. //              MessageFormat.format(Costanti.ICONA_RESET_CACHE_ELEMENTO_TOOLTIP_CON_PARAMETRO, nomeElementoSuCuiEffettuareIlReset),
  22224.                 Costanti.ICONA_RESET_CACHE_ELEMENTO, servletName,parameters);
  22225.     }
  22226.    
  22227.     public void addVerificaCertificatiButton(List<DataElement> e, String servletName, List<Parameter> parameters) {
  22228.         this.addAzioneButton(e, DataElementType.IMAGE,
  22229.                 MessageFormat.format(CostantiControlStation.ICONA_VERIFICA_TOOLTIP_CON_PARAMETRO, CostantiControlStation.LABEL_CERTIFICATI.toLowerCase()),
  22230.                 CostantiControlStation.ICONA_VERIFICA_CERTIFICATI, servletName,parameters);
  22231.     }
  22232.    
  22233.     public void addVerificaConnettivitaButton(List<DataElement> e, String servletName, List<Parameter> parameters) {
  22234.         this.addAzioneButton(e, DataElementType.IMAGE,
  22235.                 MessageFormat.format(CostantiControlStation.ICONA_VERIFICA_TOOLTIP_CON_PARAMETRO, CostantiControlStation.LABEL_CONFIGURAZIONE_CONNETTIVITA.toLowerCase()),
  22236.                 CostantiControlStation.ICONA_VERIFICA, servletName,parameters);
  22237.     }
  22238.    
  22239.     protected void addAzioneButton(List<DataElement> e, DataElementType deType, String tooltip, String icon, String servletName, List<Parameter> parameters) {
  22240.         DataElement de = new DataElement();
  22241.         de.setType(deType);
  22242.         de.setToolTip(tooltip);
  22243.         if(parameters != null && !parameters.isEmpty()) {
  22244.             de.setUrl(servletName, parameters.toArray(new Parameter[parameters.size()]));
  22245.         } else {
  22246.             de.setUrl(servletName);
  22247.         }
  22248.         de.setIcon(icon);
  22249.        
  22250.         e.add(de);
  22251.     }
  22252.    
  22253.     public void addCanaleToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String canaleStato, String canale, String canaleAPI,
  22254.             List<CanaleConfigurazione> canaleList, boolean gestioneCanaliEnabled) throws DriverConfigurazioneNotFound {
  22255.         this.addCanaleToDati(dati, tipoOperazione, canaleStato, canale, canaleAPI, canaleList, gestioneCanaliEnabled, true);
  22256.     }
  22257.    
  22258.     public void addCanaleToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String canaleStato, String canale, String canaleAPI,
  22259.             List<CanaleConfigurazione> canaleList, boolean gestioneCanaliEnabled, boolean addTitle) throws DriverConfigurazioneNotFound {
  22260.         DataElement de;
  22261.         // canale
  22262.         if(gestioneCanaliEnabled) {
  22263.             if(addTitle) {
  22264.                 DataElement dataElement = new DataElement();
  22265.                 dataElement.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_CANALE);
  22266.                 dataElement.setType(DataElementType.TITLE);
  22267.                 dati.add(dataElement);
  22268.             }
  22269.            
  22270.             de = new DataElement();
  22271.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO);
  22272.             de.setValues(CostantiControlStation.VALUES_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO);
  22273.            
  22274.             List<String> labelsCanaleStato = new ArrayList<>();
  22275.            
  22276.             CanaleConfigurazione canaleConfigurazioneDefault = getCanaleDefault(canaleList);
  22277.            
  22278.             String nomeCanaleDefault = MessageFormat.format(CostantiControlStation.LABEL_DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO_DEFAULT, canaleConfigurazioneDefault.getNome());
  22279.             if(canaleAPI != null) {
  22280.                 nomeCanaleDefault = MessageFormat.format(CostantiControlStation.LABEL_DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO_DEFAULT_API, canaleAPI);
  22281.             }
  22282.             labelsCanaleStato.add(nomeCanaleDefault);
  22283.             labelsCanaleStato.add(CostantiControlStation.LABEL_DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO_RIDEFINITO);
  22284.            
  22285.             de.setLabels(labelsCanaleStato);
  22286.             de.setType(DataElementType.SELECT);
  22287.             de.setSelected(canaleStato);
  22288.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO);
  22289.             de.setSize(this.getSize());
  22290.             de.setPostBack(true);
  22291.             dati.add(de);
  22292.            
  22293.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CANALE_STATO_RIDEFINITO.equals(canaleStato)) {
  22294.                 de = new DataElement();
  22295.                 de.setLabel(""); //(AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_CANALE);
  22296.                 List<String> canaliListValues = canaleList.stream().map(CanaleConfigurazione::getNome).collect(Collectors.toList());
  22297.                 de.setValues(canaliListValues);
  22298.                 de.setLabels(canaliListValues);
  22299.                 de.setType(DataElementType.SELECT);
  22300.                 de.setSelected(canale);
  22301.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CANALI_CANALE);
  22302.                 de.setSize(this.getSize());
  22303.                 dati.add(de);
  22304.             }
  22305.         }
  22306.     }
  22307.    
  22308.     public void addCanaleToDatiAsHidden(List<DataElement> dati, TipoOperazione tipoOperazione, String canaleStato, String canale, boolean gestioneCanaliEnabled) {
  22309.         DataElement de;
  22310.         // canale
  22311.         if(gestioneCanaliEnabled) {
  22312.             de = new DataElement();
  22313.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO);
  22314.             de.setType(DataElementType.HIDDEN);
  22315.             de.setValue(canaleStato);
  22316.             de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CANALI_CANALE_STATO);
  22317.             de.setSize(this.getSize());
  22318.             dati.add(de);
  22319.            
  22320.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CANALE_STATO_RIDEFINITO.equals(canaleStato)) {
  22321.                 de = new DataElement();
  22322.                 de.setLabel(""); //(AccordiServizioParteComuneCostanti.LABEL_PARAMETRO_APC_CANALE);
  22323.                 de.setType(DataElementType.HIDDEN);
  22324.                 de.setValue(canale);
  22325.                 de.setName(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CANALI_CANALE);
  22326.                 de.setSize(this.getSize());
  22327.                 dati.add(de);
  22328.             }
  22329.         }
  22330.     }
  22331.    
  22332.     public boolean canaleCheckData(String canaleStato, String canale, boolean gestioneCanaliEnabled) throws DriverControlStationException {
  22333.         // validazione canale
  22334.         if(gestioneCanaliEnabled) {
  22335.             if(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_CANALE_STATO_RIDEFINITO.equals(canaleStato)) {
  22336.                 if(this.checkNCName(canale, CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALE)==false){
  22337.                     return false;
  22338.                 }
  22339.             }
  22340.         }
  22341.        
  22342.         return true;
  22343.     }
  22344.    
  22345.     public void addCustomFieldSearchForm(TipoPlugin tipoPlugin,
  22346.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22347.             String fase,
  22348.             String nomeParametroSelezioneTipo,
  22349.             String nomeParametro, String label, String value, boolean hidden, List<DataElement> dati,
  22350.             boolean postBack_viaPOST) throws DriverControlStationException {
  22351.         addCustomField(tipoPlugin,
  22352.                 ruolo,
  22353.                 fase,
  22354.                 nomeParametroSelezioneTipo,
  22355.                 nomeParametro, label,
  22356.                 value, null, false,
  22357.                 hidden, dati,
  22358.                 postBack_viaPOST, false, null, null, true, null, null);
  22359.     }
  22360.    
  22361.     public void addCustomField(TipoPlugin tipoPlugin,
  22362.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22363.             String fase,
  22364.             String nomeParametroSelezioneTipo,
  22365.             String nomeParametro, String label, String value, boolean hidden, List<DataElement> dati,
  22366.             boolean postBack_viaPOST) throws DriverControlStationException {
  22367.         this.addCustomFieldConValoreDefault(tipoPlugin,
  22368.                 ruolo,
  22369.                 fase,
  22370.                 nomeParametroSelezioneTipo,
  22371.                 nomeParametro, label,
  22372.                 value,
  22373.                 hidden, dati,
  22374.                 postBack_viaPOST, null);
  22375.     }
  22376.    
  22377.     public void addCustomFieldConValoreDefault(TipoPlugin tipoPlugin,
  22378.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22379.             String fase,
  22380.             String nomeParametroSelezioneTipo,
  22381.             String nomeParametro, String label, String value, boolean hidden, List<DataElement> dati,
  22382.             boolean postBack_viaPOST, String valoreDefault) throws DriverControlStationException {
  22383.         addCustomField(tipoPlugin,
  22384.                 ruolo,
  22385.                 fase,
  22386.                 nomeParametroSelezioneTipo,
  22387.                 nomeParametro, label,
  22388.                 value, null, false,
  22389.                 hidden, dati,
  22390.                 postBack_viaPOST, false, null, null, false, valoreDefault, null);
  22391.     }
  22392.     public void addCustomFieldConValoriDaEscludere(TipoPlugin tipoPlugin,
  22393.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22394.             String fase,
  22395.             String nomeParametroSelezioneTipo,
  22396.             String nomeParametro, String label, String value, boolean hidden, List<DataElement> dati,
  22397.             boolean postBack_viaPOST, List<String> listaValuesDaEscludere, String messaggioErroreValoriDisponibiliTerminati) throws DriverControlStationException {
  22398.         this.addCustomFieldConValoriDaEscludereConValoreDefault(tipoPlugin,ruolo,fase,nomeParametroSelezioneTipo,nomeParametro, label,
  22399.                 value, hidden, dati,postBack_viaPOST, listaValuesDaEscludere, messaggioErroreValoriDisponibiliTerminati, null);
  22400.     }
  22401.     public void addCustomFieldConValoriDaEscludereConValoreDefault(TipoPlugin tipoPlugin,
  22402.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22403.             String fase,
  22404.             String nomeParametroSelezioneTipo,
  22405.             String nomeParametro, String label, String value, boolean hidden, List<DataElement> dati,
  22406.             boolean postBack_viaPOST, List<String> listaValuesDaEscludere, String messaggioErroreValoriDisponibiliTerminati, String valoreDefault) throws DriverControlStationException {
  22407.         addCustomField(tipoPlugin,
  22408.                 ruolo,
  22409.                 fase,
  22410.                 nomeParametroSelezioneTipo,
  22411.                 nomeParametro, label,
  22412.                 value, null, false,
  22413.                 hidden, dati,
  22414.                 postBack_viaPOST, true, listaValuesDaEscludere, messaggioErroreValoriDisponibiliTerminati,false, valoreDefault, null);
  22415.     }
  22416.    
  22417.     public void addMultiSelectCustomField(TipoPlugin tipoPlugin,
  22418.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22419.             String fase,
  22420.             String nomeParametroSelezioneTipo,
  22421.             String nomeParametro, String label, String [] value, boolean hidden, List<DataElement> dati,
  22422.             boolean postBack_viaPOST) throws DriverControlStationException {
  22423.         addMultiSelectCustomFieldConValoreDefault(tipoPlugin,
  22424.                 ruolo,
  22425.                 fase,
  22426.                 nomeParametroSelezioneTipo,
  22427.                 nomeParametro, label,
  22428.                 value,
  22429.                 hidden, dati,
  22430.                 postBack_viaPOST, null);
  22431.     }
  22432.    
  22433.     public void addMultiSelectCustomFieldConValoreDefault(TipoPlugin tipoPlugin,
  22434.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin
  22435.             String fase,
  22436.             String nomeParametroSelezioneTipo,
  22437.             String nomeParametro, String label, String [] value, boolean hidden, List<DataElement> dati,
  22438.             boolean postBack_viaPOST, String [] valoriDefault) throws DriverControlStationException {
  22439.         addCustomField(tipoPlugin,
  22440.                 ruolo,
  22441.                 fase,
  22442.                 nomeParametroSelezioneTipo,
  22443.                 nomeParametro, label,
  22444.                 null, value, true,
  22445.                 hidden, dati,
  22446.                 postBack_viaPOST, false, null, null, false, null, valoriDefault);
  22447.     }
  22448.     private void addCustomField(TipoPlugin tipoPlugin,
  22449.             String ruolo, // applicativa/delegata o richiesta/risposta a seconda del tipo di plugin (o anche configurazione per gli allarmi)
  22450.             String fase,
  22451.             String nomeParametroSelezioneTipo,
  22452.             String nomeParametro, String label,
  22453.             String value, String [] multiValue, boolean multiSelect,
  22454.             boolean hidden, List<DataElement> dati,
  22455.             boolean postBack_viaPOST, boolean mostraSempreLabel, List<String> listaValuesDaEscludere,
  22456.             String messaggioErroreValoriDisponibiliTerminati, boolean isSearch, String valoreDefault, String[] valoriDefault) throws DriverControlStationException {
  22457.        
  22458.         List<String> values = new ArrayList<>();
  22459.         List<String> labels = new ArrayList<>();
  22460.         String note = null;
  22461.        
  22462.         if( this.confCore.isConfigurazionePluginsEnabled() ) {
  22463.             ConsoleSearch ricerca = new ConsoleSearch(true);
  22464.             ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  Filtri.FILTRO_TIPO_PLUGIN_CLASSI, tipoPlugin.toString());
  22465.             switch (tipoPlugin) {
  22466.             case AUTENTICAZIONE:
  22467.             case AUTORIZZAZIONE:
  22468.             case AUTORIZZAZIONE_CONTENUTI:
  22469.             case INTEGRAZIONE:
  22470.                 if(ruolo!=null && !"".equals(ruolo)) {
  22471.                     ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  Filtri.FILTRO_RUOLO_NOME, ruolo);
  22472.                 }
  22473.                 break;
  22474.             case SERVICE_HANDLER:{
  22475.                 if(fase!=null && !"".equals(fase)) {
  22476.                     ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  PluginCostanti.FILTRO_SERVICE_HANDLER_NOME, fase);
  22477.                 }
  22478.                 break;
  22479.             }
  22480.             case MESSAGE_HANDLER:{
  22481.                 // message handler e ruolo
  22482.                 if(ruolo!=null && !"".equals(ruolo)) {
  22483.                     ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_NOME, ruolo);
  22484.                 }
  22485.                 if(fase!=null && !"".equals(fase)) {
  22486.                     ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_NOME, fase);
  22487.                 }
  22488.                 break;
  22489.             }
  22490.             case ALLARME:
  22491.                 if(ruolo!=null && !"".equals(ruolo)) {
  22492.                     ricerca.addFilter(Liste.CONFIGURAZIONE_PLUGINS_CLASSI,  Filtri.FILTRO_APPLICABILITA_NOME, ruolo);
  22493.                 }
  22494.                 break;
  22495.             case BEHAVIOUR:
  22496.             case CONNETTORE:
  22497.             case RATE_LIMITING:
  22498.             case RICERCA:
  22499.             case STATISTICA:
  22500.             case TRANSAZIONE:
  22501.             case TOKEN_DYNAMIC_DISCOVERY:
  22502.             case TOKEN_VALIDAZIONE:
  22503.             case TOKEN_NEGOZIAZIONE:
  22504.             case ATTRIBUTE_AUTHORITY:
  22505.                 break;
  22506.             }
  22507.            
  22508.            
  22509.             List<Plugin> listaTmp = null;
  22510.             try{
  22511.                 listaTmp = this.confCore.pluginsClassiList(ricerca);
  22512.             }catch(Exception e) {
  22513.                 throw new DriverControlStationException(e.getMessage(),e);
  22514.             }
  22515.             boolean nessunValueDisponibile = false;
  22516.             if(listaTmp!=null && !listaTmp.isEmpty()) {
  22517.                 if(listaValuesDaEscludere != null && !listaValuesDaEscludere.isEmpty()) {
  22518.                     for(int i = listaTmp.size() -1; i >= 0 ; i--) {
  22519.                         if(listaValuesDaEscludere.contains(listaTmp.get(i).getTipo())) {
  22520.                             listaTmp.remove(i);
  22521.                         }
  22522.                     }
  22523.                 }
  22524.                
  22525.                 for (Plugin plugin : listaTmp) {
  22526.                     if(plugin.isStato()) {
  22527.                        
  22528.                         if(values.isEmpty()) {
  22529.                             // se uso il componente in una form di ricerca imposto il valore qualsiasi
  22530.                             if(isSearch) {
  22531.                                 values.add(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SOGGETTO_QUALSIASI);
  22532.                                 labels.add(CostantiControlStation.LABEL_PARAMETRO_SOGGETTO_QUALSIASI);
  22533.                             } else {
  22534.                                 values.add(CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED);
  22535.                                 labels.add(CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_LABEL_UNDEFINED);
  22536.                             }
  22537.                         }
  22538.                        
  22539.                         values.add(plugin.getTipo());
  22540.                         labels.add(plugin.getLabel());
  22541.                        
  22542.                         if(value!=null) {
  22543.                             if(plugin.getTipo().equals(value)) {
  22544.                                 note = plugin.getDescrizione();
  22545.                                 if(note!=null) {
  22546.                                     note = note.trim();
  22547.                                     if("".equals(note)) {
  22548.                                         note = null;
  22549.                                     }
  22550.                                 }
  22551.                             }
  22552.                         }
  22553.                     }
  22554.                 }
  22555.             }
  22556.            
  22557.             if(listaTmp ==null || listaTmp.isEmpty()) {
  22558.                 nessunValueDisponibile = true;
  22559.             }
  22560.            
  22561.             // se non ci sono valori disponibili e voglio comunicarlo all'utente imposto il messaggio di info
  22562.             if(messaggioErroreValoriDisponibiliTerminati != null && nessunValueDisponibile) {
  22563.                 this.pd.setMessage(messaggioErroreValoriDisponibiliTerminati, Costanti.MESSAGE_TYPE_INFO);
  22564.                 this.pd.disableEditMode();
  22565.             }
  22566.            
  22567.             if(values.size()==2) {
  22568.                 // se c'e' solo un plugin elimino la non selezione
  22569.                 values.remove(0);
  22570.                 labels.remove(0);
  22571.             }
  22572.         }
  22573.            
  22574.         boolean customValidType = true;
  22575.         if( this.confCore.isConfigurazionePluginsEnabled() ) {
  22576.        
  22577.             if(!multiSelect) {
  22578.                 if(value!=null && !"".equals(value) && !CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(value)) {
  22579.                     customValidType = values.contains(value); // backward compatibility
  22580.                 }
  22581.                
  22582.                 String postBackElementName = this.getPostBackElementName();
  22583.                 if(nomeParametroSelezioneTipo.equals(postBackElementName) && !customValidType) {
  22584.                     value = null;
  22585.                     customValidType = true;
  22586.                 }
  22587.             }
  22588.         }
  22589.         else {
  22590.             customValidType = false;
  22591.         }
  22592.        
  22593.         DataElement de = new DataElement();
  22594.         de.setName(nomeParametro);
  22595.         if(!multiSelect) {
  22596.             de.setValue(value);
  22597.         }
  22598.         if (hidden)
  22599.             de.setType(DataElementType.HIDDEN);
  22600.         else{
  22601.             de.setRequired(true);
  22602.             if(!customValidType) {
  22603.                 de.setLabel(label);
  22604.                 de.setType(DataElementType.TEXT_EDIT);
  22605.                 de.setValoreDefault(valoreDefault);
  22606.             }
  22607.             else {
  22608.                 if(multiSelect) {
  22609.                     de.setLabel(label);
  22610.                     de.setType(DataElementType.MULTI_SELECT);
  22611.                 }
  22612.                 else {
  22613.                     de.setType(DataElementType.SELECT);
  22614.                 }
  22615.                 de.setValues(values);
  22616.                 de.setLabels(labels);
  22617.                 if(multiSelect) {
  22618.                     de.setSelezionati(multiValue);
  22619.                     de.setValoreDefaultMultiSelect(valoriDefault);
  22620.                 }
  22621.                 else {
  22622.                     de.setSelected(value);
  22623.                     de.setValoreDefaultSelect(valoreDefault);
  22624.                 }
  22625.                 de.setNote(note);
  22626.                 if(postBack_viaPOST) {
  22627.                     de.setPostBack_viaPOST(true);
  22628.                 }
  22629.                 else {
  22630.                     de.setPostBack(true);
  22631.                 }
  22632.                 if(!multiSelect && values.size()==1) {
  22633.                     de.setRequired(false);
  22634.                 }
  22635.                 if(mostraSempreLabel) {
  22636.                     de.setLabel(label);
  22637.                 }
  22638.             }
  22639.         }
  22640.        
  22641.         dati.add(de);
  22642.        
  22643.     }
  22644.    
  22645.     public void addOpzioniAvanzateRateLimitingToDati(List<DataElement> dati,
  22646.             boolean addTitle,
  22647.             boolean nascondiSezioneOpzioniAvanzate,
  22648.             String ctModalitaSincronizzazione, String ctImplementazione, String ctContatori, String ctTipologia,
  22649.             String ctHeaderHttp, String ctHeaderHttp_limit, String ctHeaderHttp_remaining, String ctHeaderHttp_reset,
  22650.             String ctHeaderHttp_retryAfter, String ctHeaderHttp_retryAfterBackoff) throws DriverControlStationException {
  22651.        
  22652.         if(addTitle) {
  22653.             DataElement de = new DataElement();
  22654.             de.setType(DataElementType.TITLE);
  22655.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING);
  22656.             dati.add(de);
  22657.         }
  22658.        
  22659.         DataElement de = new DataElement();
  22660.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_SINCRONIZZAZIONE);
  22661.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE);
  22662.         de.setValue(ctModalitaSincronizzazione);
  22663.         if(nascondiSezioneOpzioniAvanzate ){
  22664.             de.setType(DataElementType.HIDDEN);
  22665.         } else {
  22666.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.getVALUES_MODALITA_SINCRONIZZAZIONE(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori()));
  22667.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.getLABELS_MODALITA_SINCRONIZZAZIONE(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori()));
  22668.             de.setSelected(ctModalitaSincronizzazione);
  22669.             de.setType(DataElementType.SELECT);
  22670.             de.setPostBack(true);
  22671.         }
  22672.         dati.add(de);
  22673.        
  22674.        
  22675.         de = new DataElement();
  22676.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP);
  22677.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP);
  22678.         de.setValue(ctHeaderHttp);
  22679.         if(nascondiSezioneOpzioniAvanzate ){
  22680.             de.setType(DataElementType.HIDDEN);
  22681.         } else {
  22682.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUES_MODALITA_GENERAZIONE_HEADER_HTTP);
  22683.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABELS_MODALITA_GENERAZIONE_HEADER_HTTP);
  22684.             de.setSelected(ctHeaderHttp);
  22685.             de.setType(DataElementType.SELECT);
  22686.             de.setPostBack(true);
  22687.         }
  22688.         dati.add(de);
  22689.        
  22690.        
  22691.         List<String> implValues = null;
  22692.         if(!nascondiSezioneOpzioniAvanzate &&
  22693.                 org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA.equals(ctModalitaSincronizzazione)) {
  22694.             implValues = org.openspcoop2.core.controllo_traffico.constants.Costanti.getVALUES_MODALITA_IMPLEMENTAZIONE(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori());
  22695.                
  22696.             if(implValues.size()>1 || (implValues.size()==1 && org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_IMPLEMENTAZIONE_HAZELCAST.equals(implValues.get(0)))) {
  22697.                 de = new DataElement();
  22698.                 de.setType(DataElementType.SUBTITLE);
  22699.                 de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY_CONFIGURAZIONE_SICRONIZZAZIONE_DISTRIBUITA);
  22700.                 dati.add(de);
  22701.             }
  22702.         }
  22703.        
  22704.         de = new DataElement();
  22705.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_IMPLEMENTAZIONE);
  22706.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_IMPLEMENTAZIONE);
  22707.         de.setValue(ctImplementazione);
  22708.         if(nascondiSezioneOpzioniAvanzate ||
  22709.                 !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA.equals(ctModalitaSincronizzazione)){
  22710.             de.setType(DataElementType.HIDDEN);
  22711.         } else {
  22712.             if(implValues.size()==1) {
  22713.                 ctImplementazione = implValues.get(0);
  22714.                 de.setValue(ctImplementazione);
  22715.                 de.setType(DataElementType.HIDDEN);
  22716.             }
  22717.             else {
  22718.                 de.setValues(implValues);
  22719.                 de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.getLABELS_MODALITA_IMPLEMENTAZIONE(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori()));
  22720.                 if(ctImplementazione==null || StringUtils.isEmpty(ctImplementazione)) {
  22721.                     ctImplementazione = implValues.get(0);
  22722.                 }
  22723.                 de.setSelected(ctImplementazione);
  22724.                 de.setType(DataElementType.SELECT);
  22725.                 de.setPostBack(true);
  22726.             }
  22727.         }
  22728.         dati.add(de);
  22729.        
  22730.        
  22731.         de = new DataElement();
  22732.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_CONTATORI);
  22733.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_CONTATORI);
  22734.         de.setValue(ctContatori);
  22735.         if(nascondiSezioneOpzioniAvanzate ||
  22736.                 !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA.equals(ctModalitaSincronizzazione) ||
  22737.                 (!org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_IMPLEMENTAZIONE_HAZELCAST.equals(ctImplementazione) &&
  22738.                         !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_IMPLEMENTAZIONE_REDIS.equals(ctImplementazione))){
  22739.             de.setType(DataElementType.HIDDEN);
  22740.         } else {
  22741.             List<String> values = org.openspcoop2.core.controllo_traffico.constants.Costanti.getVALUES_MODALITA_CONTATORI(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(),ctImplementazione);
  22742.             if(values==null || values.size()<=0) {
  22743.                 de.setType(DataElementType.HIDDEN);
  22744.             }
  22745.             else if(values.size()==1){
  22746.                 ctContatori = values.get(0);
  22747.                 de.setValue(ctContatori);
  22748.                 de.setType(DataElementType.HIDDEN);
  22749.                
  22750.                 List<String> labels = org.openspcoop2.core.controllo_traffico.constants.Costanti.getLABELS_MODALITA_CONTATORI(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(),ctImplementazione);
  22751.                 String label = ctContatori;
  22752.                 if(ctContatori!=null) {
  22753.                     if(label!=null && !label.isEmpty() && values.size()==labels.size()) {
  22754.                         for (int i = 0; i < values.size(); i++) {
  22755.                             if(ctContatori.equals(values.get(i))){
  22756.                                 label = labels.get(i);
  22757.                             }
  22758.                         }
  22759.                     }
  22760.                 }
  22761.                 DataElement deLABEL = new DataElement();
  22762.                 deLABEL.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_CONTATORI+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
  22763.                 deLABEL.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_CONTATORI);
  22764.                 deLABEL.setValue(label);
  22765.                 deLABEL.setType(DataElementType.TEXT);
  22766.                 dati.add(deLABEL);
  22767.             }
  22768.             else {
  22769.                 de.setValues(values);
  22770.                 de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.getLABELS_MODALITA_CONTATORI(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(),ctImplementazione));
  22771.                 if(ctContatori==null || StringUtils.isEmpty(ctContatori)) {
  22772.                     ctContatori = values.get(0);
  22773.                 }
  22774.                 de.setSelected(ctContatori);
  22775.                 de.setType(DataElementType.SELECT);
  22776.                 de.setPostBack(true);
  22777.             }
  22778.         }
  22779.         dati.add(de);
  22780.        
  22781.        
  22782.         de = new DataElement();
  22783.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_TIPOLOGIA);
  22784.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_TIPOLOGIA);
  22785.         de.setValue(ctTipologia);
  22786.         if(nascondiSezioneOpzioniAvanzate ||
  22787.                 !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_MODALITA_SINCRONIZZAZIONE_DISTRIBUITA.equals(ctModalitaSincronizzazione)){
  22788.             de.setType(DataElementType.HIDDEN);
  22789.         } else {
  22790.             List<String> values = org.openspcoop2.core.controllo_traffico.constants.Costanti.getVALUES_MODALITA_TIPOLOGIA(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(),ctImplementazione, ctContatori);
  22791.             if(values==null || values.size()<=0) {
  22792.                 de.setType(DataElementType.HIDDEN);
  22793.             }
  22794.             else if(values.size()==1){
  22795.                 ctTipologia = values.get(0);
  22796.                 de.setValue(ctTipologia);
  22797.                 de.setType(DataElementType.TEXT);
  22798.             }
  22799.             else {
  22800.                 de.setValues(values);
  22801.                 de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.getLABELS_MODALITA_TIPOLOGIA(this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(), ctImplementazione, ctContatori));
  22802.                 if(ctTipologia==null || StringUtils.isEmpty(ctTipologia)) {
  22803.                     ctTipologia = values.get(0);
  22804.                 }
  22805.                 de.setSelected(ctTipologia);
  22806.                 de.setType(DataElementType.SELECT);
  22807.                 de.setPostBack(false);
  22808.             }
  22809.         }
  22810.         dati.add(de);
  22811.        
  22812.        
  22813.        
  22814.         if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp)) {
  22815.             de = new DataElement();
  22816.             de.setType(DataElementType.SUBTITLE);
  22817.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY_CONFIGURAZIONE_HEADER_HTTP);
  22818.             dati.add(de);
  22819.         }
  22820.        
  22821.        
  22822.         de = new DataElement();
  22823.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
  22824.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
  22825.         de.setValue(ctHeaderHttp_limit);
  22826.         if(nascondiSezioneOpzioniAvanzate || !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) ){
  22827.             de.setType(DataElementType.HIDDEN);
  22828.         } else {
  22829.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUES_MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
  22830.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABELS_MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
  22831.             de.setSelected(ctHeaderHttp_limit);
  22832.             de.setType(DataElementType.SELECT);
  22833.             de.setPostBack(false);
  22834.         }
  22835.         dati.add(de);
  22836.        
  22837.            
  22838.         de = new DataElement();
  22839.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
  22840.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
  22841.         de.setValue(ctHeaderHttp_remaining);
  22842.         if(nascondiSezioneOpzioniAvanzate || !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) ){
  22843.             de.setType(DataElementType.HIDDEN);
  22844.         } else {
  22845.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUES_MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
  22846.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABELS_MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
  22847.             de.setSelected(ctHeaderHttp_remaining);
  22848.             de.setType(DataElementType.SELECT);
  22849.             de.setPostBack(false);
  22850.         }
  22851.         dati.add(de);
  22852.        
  22853.        
  22854.         de = new DataElement();
  22855.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
  22856.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
  22857.         de.setValue(ctHeaderHttp_reset);
  22858.         if(nascondiSezioneOpzioniAvanzate || !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) ){
  22859.             de.setType(DataElementType.HIDDEN);
  22860.         } else {
  22861.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUES_MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
  22862.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABELS_MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
  22863.             de.setSelected(ctHeaderHttp_reset);
  22864.             de.setType(DataElementType.SELECT);
  22865.             de.setPostBack(false);
  22866.         }
  22867.         dati.add(de);
  22868.        
  22869.        
  22870.         de = new DataElement();
  22871.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
  22872.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
  22873.         de.setValue(ctHeaderHttp_retryAfter);
  22874.         if(nascondiSezioneOpzioniAvanzate || !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) ){
  22875.             de.setType(DataElementType.HIDDEN);
  22876.         } else {
  22877.             de.setValues(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUES_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
  22878.             de.setLabels(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABELS_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
  22879.             de.setSelected(ctHeaderHttp_retryAfter);
  22880.             de.setType(DataElementType.SELECT);
  22881.             de.setPostBack(true);
  22882.         }
  22883.         dati.add(de);
  22884.        
  22885.        

  22886.         de = new DataElement();
  22887.         de.setName(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS);
  22888.         de.setLabel(org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS);
  22889.         de.setValue(ctHeaderHttp_retryAfterBackoff);
  22890.         if(nascondiSezioneOpzioniAvanzate ||
  22891.                 !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) ||
  22892.                 !org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_ABILITATO_BACKOFF.equals(ctHeaderHttp_retryAfter) ){
  22893.             de.setType(DataElementType.HIDDEN);
  22894.         } else {
  22895.             de.setType(DataElementType.NUMBER);
  22896.             de.setMinValue(1);
  22897.             de.setRequired(true);
  22898.         }
  22899.         dati.add(de);
  22900.        
  22901.     }
  22902.    
  22903.    
  22904.     public boolean validaOpzioniAvanzateRateLimiting(RuoloPolicy ruoloPolicy, String nome) throws DriverControlStationException {
  22905.    
  22906.         String ctModalitaSincronizzazione = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_SINCRONIZZAZIONE);
  22907.         String ctImplementazione = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_IMPLEMENTAZIONE);
  22908.         String ctContatori = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_CONTATORI);
  22909.         String ctTipologia = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_TIPOLOGIA);
  22910.         String ctHeaderHttp = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP);
  22911.         String ctHeaderHttp_limit = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
  22912.         String ctHeaderHttp_remaining = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
  22913.         String ctHeaderHttp_reset = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
  22914.         String ctHeaderHttp_retryAfter = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
  22915.         String ctHeaderHttp_retryAfterBackoff = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS);
  22916.        
  22917.         return validaOpzioniAvanzateRateLimiting(ruoloPolicy, nome,
  22918.                 ctModalitaSincronizzazione, ctImplementazione, ctContatori, ctTipologia,
  22919.                 ctHeaderHttp, ctHeaderHttp_limit, ctHeaderHttp_remaining, ctHeaderHttp_reset,
  22920.                 ctHeaderHttp_retryAfter, ctHeaderHttp_retryAfterBackoff);
  22921.     }
  22922.     public boolean validaOpzioniAvanzateRateLimiting(RuoloPolicy ruoloPolicy, String nome,
  22923.             String ctModalitaSincronizzazione, String ctImplementazione, String ctContatori, String ctTipologia,
  22924.             String ctHeaderHttp, String ctHeaderHttp_limit, String ctHeaderHttp_remaining, String ctHeaderHttp_reset,
  22925.             String ctHeaderHttp_retryAfter, String ctHeaderHttp_retryAfterBackoff) throws DriverControlStationException {
  22926.        
  22927.         if(org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_RIDEFINITO.equals(ctHeaderHttp) &&
  22928.                 org.openspcoop2.core.controllo_traffico.constants.Costanti.VALUE_HTTP_HEADER_ABILITATO_BACKOFF.equals(ctHeaderHttp_retryAfter) ){
  22929.             int backoffInt = -1;
  22930.             try{
  22931.                 backoffInt = Integer.parseInt(ctHeaderHttp_retryAfterBackoff);
  22932.             }catch(Exception e){
  22933.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_DATI_NON_VALIDI_INSERIRE_UN_NUMERO_INTERO_MAGGIORE_DI_ZERO, org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS));
  22934.                 return false;
  22935.             }
  22936.             if(backoffInt <= 0){
  22937.                 this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_DATI_NON_VALIDI_INSERIRE_UN_NUMERO_INTERO_MAGGIORE_DI_ZERO, org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS));
  22938.                 return false;
  22939.             }
  22940.         }
  22941.        
  22942.        
  22943.         PolicyConfiguration policyConfig = new PolicyConfiguration();
  22944.         policyConfig.setSyncMode(ctModalitaSincronizzazione);
  22945.         policyConfig.setImpl(ctImplementazione);
  22946.         policyConfig.setCount(ctContatori);
  22947.         policyConfig.setEngineType(ctTipologia);
  22948.         policyConfig.setHttpMode(ctHeaderHttp);
  22949.         policyConfig.setHttpMode_limit(ctHeaderHttp_limit);
  22950.         policyConfig.setHttpMode_remaining(ctHeaderHttp_remaining);
  22951.         policyConfig.setHttpMode_reset(ctHeaderHttp_reset);
  22952.         policyConfig.setHttpMode_retry_after(ctHeaderHttp_retryAfter);
  22953.         policyConfig.setHttpMode_retry_after_backoff(ctHeaderHttp_retryAfterBackoff);
  22954.         try {
  22955.             policyConfig.saveIn(new ArrayList<>()); // inizializza il tipo
  22956.         }catch(Exception e) {
  22957.             throw new DriverControlStationException(e.getMessage(),e);
  22958.         }
  22959.         PolicyGroupByActiveThreadsType type = policyConfig.getType();
  22960.        
  22961.        
  22962.         ConsoleSearch ricercaAll = new ConsoleSearch(true);
  22963.         List<TipoRisorsaPolicyAttiva> listaTipoRisorsa = this.confCore.attivazionePolicyTipoRisorsaList(ricercaAll, ruoloPolicy, nome);
  22964.         StringBuilder sb = new StringBuilder();
  22965.         for (TipoRisorsaPolicyAttiva tipoRisorsaPolicyAttiva : listaTipoRisorsa) {
  22966.             if(type!=null && !type.isSupportedResource(tipoRisorsaPolicyAttiva)) {
  22967.                 if(sb.length()>0) {
  22968.                     sb.append(", ");
  22969.                 }
  22970.                 sb.append(tipoRisorsaPolicyAttiva.getValue());
  22971.             }
  22972.         }
  22973.         if(sb.length()>0) {
  22974.             String oggetto = "globalmente";
  22975.             if(ruoloPolicy!=null) {
  22976.                 if(RuoloPolicy.APPLICATIVA.equals(ruoloPolicy)){
  22977.                     oggetto = "sull'erogazione";
  22978.                 }
  22979.                 else if(RuoloPolicy.DELEGATA.equals(ruoloPolicy)){
  22980.                     oggetto = "sulla fruizione";
  22981.                 }
  22982.             }
  22983.             this.pd.setMessage("La "+org.openspcoop2.core.controllo_traffico.constants.Costanti.LABEL_MODALITA_SINCRONIZZAZIONE+
  22984.                     " selezionata non è utilizzabile poichè non compatibile con alcune metriche associate alle policy attive "+oggetto+": "+sb.toString());
  22985.             return false;
  22986.         }
  22987.        
  22988.         return true;
  22989.     }
  22990.    
  22991.    
  22992.     public void addIntegrazioneMetadatiToDati(List<DataElement> dati, String integrazioneStato, String integrazione,
  22993.             String[] integrazioneGruppi, List<GruppoIntegrazione> integrazioneGruppiDaVisualizzare,
  22994.             Map<String, List<String>> integrazioneGruppiValoriDeiGruppi, List<DataElement> deIntegrazione,
  22995.             boolean nascondiSezioneOpzioniAvanzate, boolean isPortaDelegata,
  22996.             ServiceBinding serviceBinding) throws DriverControlStationException {
  22997.         String ruoloConfigurazione = isPortaDelegata ? Filtri.FILTRO_RUOLO_VALORE_FRUIZIONE :   Filtri.FILTRO_RUOLO_VALORE_EROGAZIONE;
  22998.        
  22999.         DataElement de;
  23000.         // stato metadati
  23001.         de = new DataElement();
  23002.         de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI);
  23003.         de.setValue(integrazioneStato);
  23004.         de.setName(CostantiControlStation.PARAMETRO_PORTE_INTEGRAZIONE_STATO);
  23005.         if(nascondiSezioneOpzioniAvanzate ){
  23006.             de.setType(DataElementType.HIDDEN);
  23007.             dati.add(de);
  23008.         } else {
  23009.             de.setType(DataElementType.SELECT);
  23010.             de.setValues(CostantiControlStation.VALUES_PARAMETRO_PORTE_INTEGRAZIONE_STATO);
  23011.             de.setLabels(CostantiControlStation.LABELS_PARAMETRO_PORTE_INTEGRAZIONE_STATO);
  23012.             de.setSelected(integrazioneStato);
  23013.             de.setPostBack(true);
  23014.             DataElementInfo dInfo = new DataElementInfo(CostantiControlStation.LABEL_METADATI);
  23015.             dInfo.setBody(CostantiControlStation.LABEL_METADATI_INFO);
  23016.             de.setInfo(dInfo);
  23017.             deIntegrazione.add(de);
  23018.         }
  23019.        
  23020.         if(nascondiSezioneOpzioniAvanzate ){
  23021.             de = new DataElement();
  23022.             de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI);
  23023.             de.setValue(integrazione);
  23024.             de.setName(CostantiControlStation.PARAMETRO_PORTE_INTEGRAZIONE);
  23025.             de.setType(DataElementType.HIDDEN);
  23026.             dati.add(de);
  23027.         }else{
  23028.             // valore del campo integrazione
  23029.             if(integrazioneStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_INTEGRAZIONE_STATO_DISABILITATO)) {
  23030.                 de = new DataElement();
  23031.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI);
  23032.                 de.setValue(integrazione);
  23033.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_INTEGRAZIONE);
  23034.                 de.setType(DataElementType.HIDDEN);
  23035.                 deIntegrazione.add(de);
  23036.             } else if(integrazioneStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_INTEGRAZIONE_STATO_RIDEFINITO)) {
  23037.                 de = new DataElement();
  23038.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI);
  23039.                 de.setValue(integrazione);
  23040.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_INTEGRAZIONE);
  23041.                 de.setType(DataElementType.HIDDEN);
  23042.                 deIntegrazione.add(de);
  23043.                
  23044.                 de = new DataElement();
  23045.                 de.setLabel(CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI_GRUPPO);
  23046.                 de.setSelezionati(integrazioneGruppi);
  23047.                 de.setName(CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO);
  23048.                 de.setType(DataElementType.MULTI_SELECT);
  23049.                 de.setValues(GruppoIntegrazione.toValues(serviceBinding));
  23050.                 de.setLabels(GruppoIntegrazione.toLabels(true, serviceBinding));
  23051.                 de.setPostBack_viaPOST(true);
  23052.                 de.setRequired(true);
  23053.                 DataElementInfo dInfo = new DataElementInfo(CostantiControlStation.LABEL_METADATI);
  23054.                 switch (serviceBinding) {
  23055.                 case REST:
  23056.                     dInfo.setBody(CostantiControlStation.LABEL_METADATI_RIDEFINITI_INFO_REST);  
  23057.                     break;
  23058.                 case SOAP:
  23059.                     dInfo.setBody(CostantiControlStation.LABEL_METADATI_RIDEFINITI_INFO_SOAP);  
  23060.                     break;
  23061.                 }
  23062.                 de.setInfo(dInfo);
  23063.                 deIntegrazione.add(de);
  23064.                
  23065.                 // gruppi singoli
  23066.                 boolean subtitleOp2 = false;
  23067.                 boolean subtitleOp1 = false;
  23068.                 for (GruppoIntegrazione group : integrazioneGruppiDaVisualizzare) {
  23069.                     String [] valoriMulti = null;
  23070.                     String valoreSingolo = null;
  23071.                     List<String> listaValori = integrazioneGruppiValoriDeiGruppi.get(group.getValue());
  23072.                     if(listaValori != null && listaValori.size() > 0) {
  23073.                         valoriMulti = listaValori.toArray(new String[listaValori.size()]);
  23074.                         if(!group.isMulti()) {
  23075.                             valoreSingolo = valoriMulti[0];
  23076.                         }
  23077.                     }
  23078.                    
  23079.                    
  23080.                     if(!group.getValue().equals(GruppoIntegrazione.PLUGIN.getValue())) {
  23081.                        
  23082.                         de = new DataElement();
  23083.                                                
  23084.                         if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP2_HTTP.getValue())
  23085.                                 ||
  23086.                             group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP2_URL.getValue())
  23087.                                 ||  
  23088.                             group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP2_SOAP.getValue()) ) {
  23089.                             if(!subtitleOp2) {
  23090.                                
  23091.                                 DataElement deSub = new DataElement();
  23092.                                 deSub.setLabel(CostantiControlStation.LABEL_METADATI_BACKWARD_COMPATIBILITY_OPENSPCOOP_2);
  23093.                                 deSub.setType(DataElementType.SUBTITLE);
  23094.                                 deIntegrazione.add(deSub);
  23095.                                
  23096.                                 subtitleOp2 = true;
  23097.                             }
  23098.                             if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP2_HTTP.getValue())) {
  23099.                                 de.setLabel(GruppoIntegrazione.HTTP.getCompactLabel());
  23100.                             }
  23101.                             else if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP2_URL.getValue())) {
  23102.                                 de.setLabel(GruppoIntegrazione.URL.getCompactLabel());  
  23103.                             }
  23104.                             else {
  23105.                                 de.setLabel(CostantiControlStation.LABEL_METADATI_BACKWARD_COMPATIBILITY_HEADER_SOAP);  
  23106.                             }
  23107.                         }
  23108.                         else if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP1_HTTP.getValue())
  23109.                                 ||
  23110.                             group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP1_URL.getValue())
  23111.                                 ||  
  23112.                             group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP1_SOAP.getValue()) ) {
  23113.                             if(!subtitleOp1) {
  23114.                                
  23115.                                 DataElement deSub = new DataElement();
  23116.                                 deSub.setLabel(CostantiControlStation.LABEL_METADATI_BACKWARD_COMPATIBILITY_OPENSPCOOP_1);
  23117.                                 deSub.setType(DataElementType.SUBTITLE);
  23118.                                 deIntegrazione.add(deSub);
  23119.                                
  23120.                                 subtitleOp1 = true;
  23121.                             }
  23122.                             if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP1_HTTP.getValue())) {
  23123.                                 de.setLabel(GruppoIntegrazione.HTTP.getCompactLabel());
  23124.                             }
  23125.                             else if(group.getValue().equals(GruppoIntegrazione.BACKWARD_COMPATIBILITY_OPENSPCOOP1_URL.getValue())) {
  23126.                                 de.setLabel(GruppoIntegrazione.URL.getCompactLabel());  
  23127.                             }
  23128.                             else {
  23129.                                 de.setLabel(CostantiControlStation.LABEL_METADATI_BACKWARD_COMPATIBILITY_HEADER_SOAP);  
  23130.                             }
  23131.                         }
  23132.                         else {
  23133.                             de.setLabel(group.getCompactLabel());  
  23134.                         }
  23135.                        
  23136.                         de.setName(CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO_SINGOLO+group.getValue());
  23137.                        
  23138.                         if(!group.isConfig()) {
  23139.                             de.setType(DataElementType.HIDDEN);
  23140. //                          if(group.isMulti()) {
  23141. //                              de.setValue(Arrays.asList(valoriMulti).toString());
  23142. //                          }
  23143. //                          else {
  23144.                             if(valoreSingolo==null || "".equals(valoreSingolo)) {
  23145.                                 String [] tipo = TipoIntegrazione.toValues(group); // in questo caso con config a false, dovrebbe esisterne uno solo
  23146.                                 if(tipo!=null && tipo.length==1 && tipo[0]!=null) {
  23147.                                     de.setValue(tipo[0]);
  23148.                                 }
  23149.                             }
  23150.                             else {
  23151.                                 de.setValue(valoreSingolo);
  23152.                             }
  23153. //                          }
  23154.                         }
  23155.                         else {
  23156.                             if(group.isMulti()) {
  23157.                                 de.setType(DataElementType.MULTI_SELECT);
  23158.                                 de.setSelezionati(valoriMulti);
  23159.                             } else {
  23160.                                 de.setType(DataElementType.SELECT);
  23161.                                 de.setSelected(valoreSingolo);
  23162.                             }
  23163.                             de.setValues(TipoIntegrazione.toValues(group));
  23164.                             de.setLabels(TipoIntegrazione.toLabels(group));
  23165.                             de.setRequired(true);
  23166.                         }
  23167.                         deIntegrazione.add(de);
  23168.                        
  23169.                     } else {
  23170.                         if(group.isMulti()) {
  23171.                             this.addMultiSelectCustomField(TipoPlugin.INTEGRAZIONE, ruoloConfigurazione, null,
  23172.                                     CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO,
  23173.                                     CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO_SINGOLO+group.getValue(),
  23174.                                     GruppoIntegrazione.PLUGIN.getCompactLabel(), valoriMulti, false, deIntegrazione, false);
  23175.                         } else {
  23176.                             this.addCustomField(TipoPlugin.INTEGRAZIONE, ruoloConfigurazione, null,
  23177.                                     CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO,
  23178.                                     CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO_SINGOLO+group.getValue(),
  23179.                                     GruppoIntegrazione.PLUGIN.getCompactLabel(), valoreSingolo, false, deIntegrazione, false);
  23180.                         }
  23181.                     }
  23182.                 }
  23183.             } else {
  23184.                 // quando e' default ci deve finire null                    
  23185.             }
  23186. //          deIntegrazione.addElement(de);
  23187.         }
  23188.     }
  23189.    
  23190.    
  23191.     public boolean validaIntegrazioneMetadati() throws DriverControlStationException {
  23192.         String integrazioneStato = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_INTEGRAZIONE_STATO);
  23193.                
  23194.         if(integrazioneStato!=null && !"".equals(integrazioneStato)){
  23195.             if(integrazioneStato.equals(CostantiControlStation.VALUE_PARAMETRO_PORTE_INTEGRAZIONE_STATO_RIDEFINITO)) {
  23196.                 String[] integrazioneGruppi = this.getParameterValues(CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO);
  23197.                
  23198.                 if(integrazioneGruppi == null || integrazioneGruppi.length == 0) {
  23199.                     this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_PORTE_INTEGRAZIONE_GRUPPI_VUOTI);
  23200.                     return false;
  23201.                 }
  23202.                
  23203.                 List<GruppoIntegrazione> integrazioneGruppiDaVisualizzare = new ArrayList<GruppoIntegrazione>();  
  23204.                
  23205.                 for (String gruppoSelezionato : integrazioneGruppi) {
  23206.                     integrazioneGruppiDaVisualizzare.add(GruppoIntegrazione.toEnumConstant(gruppoSelezionato));
  23207.                 }
  23208.                
  23209.                 // leggere i valori selezionati per ogni gruppo selezionato
  23210.                 Map<String, List<String>> integrazioneGruppiValoriDeiGruppi = new HashMap<>();
  23211.                 for (GruppoIntegrazione group : integrazioneGruppiDaVisualizzare) {
  23212.                     List<String> valoriGruppoList = new ArrayList<>();
  23213.                     if(group.isMulti()) {
  23214.                         String[] valoriGruppo = this.getParameterValues(CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO_SINGOLO+group.getValue());
  23215.                         if(valoriGruppo == null || valoriGruppo.length == 0) {
  23216.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_PORTE_INTEGRAZIONE_GRUPPO_VUOTO, group.getCompactLabel()));
  23217.                             return false;
  23218.                         }
  23219.                        
  23220.                         valoriGruppoList.addAll(Arrays.asList(valoriGruppo));
  23221.                     } else {
  23222.                         String valoreGruppo = this.getParameter(CostantiControlStation.PARAMETRO_PORTE_METADATI_GRUPPO_SINGOLO+group.getValue());
  23223.                         if(valoreGruppo == null) {
  23224.                             this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_PORTE_INTEGRAZIONE_GRUPPO_VUOTO, group.getCompactLabel()));
  23225.                             return false;
  23226.                         }
  23227.                         valoriGruppoList.add(valoreGruppo);
  23228.                     }
  23229.                    
  23230.                     integrazioneGruppiValoriDeiGruppi.put(group.getValue(), valoriGruppoList);  
  23231.                 }
  23232.                
  23233.                 // controllo sulla lunghezza finale del campo integrazione
  23234.                 List<String> valoriFinaliIntegrazione = new ArrayList<>();
  23235.                 for (GruppoIntegrazione group : integrazioneGruppiDaVisualizzare) {
  23236.                     valoriFinaliIntegrazione.addAll(integrazioneGruppiValoriDeiGruppi.get(group.getValue()));
  23237.                 }
  23238.                
  23239.                 String valoreFinaleCampoItegrazione = StringUtils.join(valoriFinaliIntegrazione.toArray(new String[valoriFinaliIntegrazione.size()]), ",");
  23240.                 if(valoreFinaleCampoItegrazione!=null && valoreFinaleCampoItegrazione.length()>4000) {
  23241.                     this.pd.setMessage("L'informazione fornita nel campo '"+CostantiControlStation.LABEL_PARAMETRO_PORTE_METADATI+"' deve possedere una lunghezza minore di 4000");
  23242.                     return false;
  23243.                 }
  23244.             }
  23245.         }
  23246.        
  23247.         return true;
  23248.     }
  23249.    
  23250.     public void visualizzaLinkHandlers(List<DataElement> dati, boolean isConfigurazione, TipoPdD ruoloPorta, Long idPorta, ServiceBinding serviceBinding) throws DriverConfigurazioneException {
  23251.         DataElement de;
  23252.         boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
  23253.        
  23254.         de = new DataElement();
  23255.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS);
  23256.         de.setType(DataElementType.TITLE);
  23257.         dati.add(de);
  23258.        
  23259.         List<Parameter> listaParametriComuni = new ArrayList<>();
  23260.        
  23261.         Parameter parRuoloPorta = null;
  23262.         if(ruoloPorta!=null) {
  23263.             parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_RUOLO_PORTA, ruoloPorta.getTipo());
  23264.             listaParametriComuni.add(parRuoloPorta);
  23265.         }
  23266.         Parameter parIdPorta = null;
  23267.         if(idPorta!=null) {
  23268.             parIdPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_PORTA, idPorta +"");
  23269.             listaParametriComuni.add(parIdPorta);
  23270.         }
  23271.         Parameter parServiceBinding = null;
  23272.         if(serviceBinding!=null) {
  23273.             parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_SERVICE_BINDING, serviceBinding.name());
  23274.             listaParametriComuni.add(parServiceBinding);
  23275.         }
  23276.        
  23277.        
  23278.         // handler richiesta
  23279.         de = new DataElement();
  23280.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_RICHIESTA);
  23281.         de.setType(DataElementType.SUBTITLE);
  23282.         dati.add(de);
  23283.        
  23284.         for (int i = 0; i < PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_VALORI_RICHIESTA.size(); i++) {
  23285.             String valueRichiesta = PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_VALORI_RICHIESTA.get(i);
  23286.             String labelRichiesta = PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_RICHIESTA.get(i);

  23287.             int numeroHandlersRichiesta = this.confCore.numeroHandlersRichiesta(valueRichiesta, ruoloPorta, idPorta);
  23288.            
  23289.             List<Parameter> listaParametriRichiesta = new ArrayList<>();
  23290.             if(!listaParametriComuni.isEmpty()) {
  23291.                 listaParametriRichiesta.addAll(listaParametriComuni);
  23292.             }
  23293.             listaParametriRichiesta.add(new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, valueRichiesta));
  23294.            
  23295.             de = new DataElement();
  23296.             de.setType(DataElementType.LINK);
  23297.             de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RICHIESTA_LIST, listaParametriRichiesta.toArray(new Parameter [listaParametriRichiesta.size()]));
  23298.             if (contaListeFromSession)
  23299.                 de.setValue(labelRichiesta +" (" + numeroHandlersRichiesta + ")");
  23300.             else
  23301.                 de.setValue(labelRichiesta);
  23302.             dati.add(de);
  23303.         }
  23304.        
  23305.         // handler risposta
  23306.         de = new DataElement();
  23307.         de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_RISPOSTA);
  23308.         de.setType(DataElementType.SUBTITLE);
  23309.         dati.add(de);
  23310.        
  23311.         for (int i = 0; i < PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_VALORI_RISPOSTA.size(); i++) {
  23312.             String valueRisposta = PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_VALORI_RISPOSTA.get(i);
  23313.             String labelRisposta = PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_RISPOSTA.get(i);
  23314.            
  23315.             int numeroHandlersRisposta = this.confCore.numeroHandlersRisposta(valueRisposta, ruoloPorta, idPorta);
  23316.            
  23317.             List<Parameter> listaParametriRisposta = new ArrayList<>();
  23318.             if(!listaParametriComuni.isEmpty()) {
  23319.                 listaParametriRisposta.addAll(listaParametriComuni);
  23320.             }
  23321.             listaParametriRisposta.add(new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, valueRisposta));
  23322.            
  23323.             de = new DataElement();
  23324.             de.setType(DataElementType.LINK);
  23325.             de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RISPOSTA_LIST, listaParametriRisposta.toArray(new Parameter [listaParametriRisposta.size()]));
  23326.             if (contaListeFromSession)
  23327.                 de.setValue(labelRisposta+" (" + numeroHandlersRisposta + ")");
  23328.             else
  23329.                 de.setValue(labelRisposta);
  23330.             dati.add(de);
  23331.         }
  23332.        
  23333.         if(isConfigurazione) {
  23334.             // service handler
  23335.             de = new DataElement();
  23336.             de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_SERVIZIO);
  23337.             de.setType(DataElementType.SUBTITLE);
  23338.             dati.add(de);
  23339.            
  23340.             boolean integrationManagerEnabled = this.confCore.isIntegrationManagerEnabled();
  23341.            
  23342.             if(integrationManagerEnabled) {
  23343.                 for (int i = 0; i < PluginCostanti.FILTRO_SERVICE_HANDLER_VALORI_CON_INTEGRATION_MANAGER.size(); i++) {
  23344.                     String valueServizio = PluginCostanti.FILTRO_SERVICE_HANDLER_VALORI_CON_INTEGRATION_MANAGER.get(i);
  23345.                     String labelServizio = PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_CON_INTEGRATION_MANAGER.get(i);
  23346.                    
  23347.                     int numeroHandlersServizio = this.confCore.numeroHandlersServizio(valueServizio);
  23348.                    
  23349.                     List<Parameter> listaParametriServizio = new ArrayList<>();
  23350.                     if(!listaParametriComuni.isEmpty()) {
  23351.                         listaParametriServizio.addAll(listaParametriComuni);
  23352.                     }
  23353.                     listaParametriServizio.add(new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, valueServizio));
  23354.                    
  23355.                     de = new DataElement();
  23356.                     de.setType(DataElementType.LINK);
  23357.                     de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_SERVIZIO_LIST, listaParametriServizio.toArray(new Parameter [listaParametriServizio.size()]));
  23358.                     if (contaListeFromSession)
  23359.                         de.setValue(labelServizio +" (" + numeroHandlersServizio + ")");
  23360.                     else
  23361.                         de.setValue(labelServizio);
  23362.                     dati.add(de);
  23363.                 }
  23364.             } else {
  23365.                 for (int i = 0; i < PluginCostanti.FILTRO_SERVICE_HANDLER_VALORI_SENZA_INTEGRATION_MANAGER.size(); i++) {
  23366.                     String valueServizio = PluginCostanti.FILTRO_SERVICE_HANDLER_VALORI_SENZA_INTEGRATION_MANAGER.get(i);
  23367.                     String labelServizio = PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_SENZA_INTEGRATION_MANAGER.get(i);
  23368.                    
  23369.                     int numeroHandlersServizio = this.confCore.numeroHandlersServizio(valueServizio);
  23370.                    
  23371.                     List<Parameter> listaParametriServizio = new ArrayList<>();
  23372.                     if(!listaParametriComuni.isEmpty()) {
  23373.                         listaParametriServizio.addAll(listaParametriComuni);
  23374.                     }
  23375.                     listaParametriServizio.add(new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, valueServizio));
  23376.                    
  23377.                     de = new DataElement();
  23378.                     de.setType(DataElementType.LINK);
  23379.                     de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_SERVIZIO_LIST, listaParametriServizio.toArray(new Parameter [listaParametriServizio.size()]));
  23380.                     if (contaListeFromSession)
  23381.                         de.setValue(labelServizio +" (" + numeroHandlersServizio + ")");
  23382.                     else
  23383.                         de.setValue(labelServizio);
  23384.                     dati.add(de);
  23385.                 }
  23386.             }
  23387.         }
  23388.     }
  23389.    
  23390.     public List<String> nomiProprietaPD(String protocolloPerFiltroProprieta , String soggettoPerFiltroProprieta) throws DriverRegistroServiziException, DriverConfigurazioneException {
  23391.         List<String> tipoServiziProtocollo = null;
  23392.         String filterSoggettoTipo = null;
  23393.         String filterSoggettoNome = null;
  23394.         if(soggettoPerFiltroProprieta != null) {
  23395.             if(soggettoPerFiltroProprieta!=null && !"".equals(soggettoPerFiltroProprieta)) {
  23396.                 filterSoggettoTipo = soggettoPerFiltroProprieta.split("/")[0];
  23397.                 filterSoggettoNome = soggettoPerFiltroProprieta.split("/")[1];
  23398.             }
  23399.         } else {
  23400.             try {
  23401.                 tipoServiziProtocollo = Filtri.convertToTipiServizi(protocolloPerFiltroProprieta, null);
  23402.             }catch(Exception e) {
  23403.                 throw new DriverRegistroServiziException(e.getMessage(),e);
  23404.             }
  23405.         }
  23406.         return this.porteDelegateCore.nomiProprietaPD(filterSoggettoTipo, filterSoggettoNome, tipoServiziProtocollo);
  23407.     }
  23408.    
  23409.     public List<String> nomiProprietaPA(String protocolloPerFiltroProprieta , String soggettoPerFiltroProprieta) throws DriverRegistroServiziException, DriverConfigurazioneException {
  23410.         List<String> tipoServiziProtocollo = null;
  23411.         String filterSoggettoTipo = null;
  23412.         String filterSoggettoNome = null;
  23413.         if(soggettoPerFiltroProprieta != null) {
  23414.             if(soggettoPerFiltroProprieta!=null && !"".equals(soggettoPerFiltroProprieta)) {
  23415.                 filterSoggettoTipo = soggettoPerFiltroProprieta.split("/")[0];
  23416.                 filterSoggettoNome = soggettoPerFiltroProprieta.split("/")[1];
  23417.             }
  23418.         } else {
  23419.             try {
  23420.                 tipoServiziProtocollo = Filtri.convertToTipiServizi(protocolloPerFiltroProprieta, null);
  23421.             }catch(Exception e) {
  23422.                 throw new DriverRegistroServiziException(e.getMessage(),e);
  23423.             }
  23424.         }
  23425.         return this.porteApplicativeCore.nomiProprietaPA(filterSoggettoTipo, filterSoggettoNome, tipoServiziProtocollo);
  23426.     }
  23427.    
  23428.     public List<String> nomiProprietaSA(String protocolloPerFiltroProprieta , String soggettoPerFiltroProprieta) throws DriverRegistroServiziException, DriverConfigurazioneException {
  23429.         List<String> tipoSoggettiProtocollo = null;
  23430.         String filterSoggettoTipo = null;
  23431.         String filterSoggettoNome = null;
  23432.         if(soggettoPerFiltroProprieta != null) {
  23433.             if(soggettoPerFiltroProprieta!=null && !"".equals(soggettoPerFiltroProprieta)) {
  23434.                 filterSoggettoTipo = soggettoPerFiltroProprieta.split("/")[0];
  23435.                 filterSoggettoNome = soggettoPerFiltroProprieta.split("/")[1];
  23436.             }
  23437.         } else {
  23438.             try {
  23439.                 tipoSoggettiProtocollo = Filtri.convertToTipiSoggetti(protocolloPerFiltroProprieta, null);
  23440.             }catch(Exception e) {
  23441.                 throw new DriverRegistroServiziException(e.getMessage(),e);
  23442.             }
  23443.         }
  23444.         return this.saCore.nomiProprietaSA(filterSoggettoTipo, filterSoggettoNome, tipoSoggettiProtocollo);
  23445.     }
  23446.    
  23447.     public List<String> nomiProprietaSoggetti(String protocolloPerFiltroProprieta) throws DriverRegistroServiziException, DriverConfigurazioneException {
  23448.         List<String> tipoSoggettiProtocollo = null;
  23449.         try {
  23450.             tipoSoggettiProtocollo = Filtri.convertToTipiSoggetti(protocolloPerFiltroProprieta, null);
  23451.         }catch(Exception e) {
  23452.             throw new DriverRegistroServiziException(e.getMessage(),e);
  23453.         }
  23454.         return this.soggettiCore.nomiProprietaSoggetti(tipoSoggettiProtocollo);
  23455.     }
  23456.    
  23457.     private boolean hasAlmostOneFormElementDefined(List<DataElement> form_elements_to_check) {
  23458.         if(form_elements_to_check!=null) {
  23459.             for (DataElement de : form_elements_to_check) {
  23460.                 // solo i tipi di elemento da controllare
  23461.                 if(de.isElementoDaControllarePerCheckDefaultNelleForm()) {
  23462.                     // valgono solo gli elementi con il default definito
  23463.                     if(de.getValoreDefault() != null) {
  23464.                         if(DataElementType.CHECKBOX.toString().equals(de.getType())) {
  23465.                             if(ServletUtils.isCheckBoxEnabled(de.getSelected()) != de.getValoreDefaultCheckbox()) {
  23466.                                 return true;
  23467.                             }
  23468.                         } else if(DataElementType.SELECT.toString().equals(de.getType())) {
  23469.                             if(!de.getValoreDefault().equals(de.getSelected())) {
  23470.                                 return true;
  23471.                             }
  23472.                         } else if(DataElementType.MULTI_SELECT.toString().equals(de.getType())) {
  23473.                             if(!de.getValoreDefault().equals(de.getSelezionatiAsString()))
  23474.                                 return true;
  23475.                         } else { // text, textarea, numerici e radio
  23476.                             if(!de.getValoreDefault().equals(de.getValue())) {
  23477.                                 return true;
  23478.                             }
  23479.                         }
  23480.                        
  23481.                     }
  23482.                 }
  23483.             }
  23484.         }
  23485.         return false;
  23486.     }
  23487.    
  23488.     public void impostaAperturaTitle(List<DataElement> dati, String titleName) throws DriverControlStationException{
  23489.         this.impostaAperturaTitle(dati, titleName, DataElementType.TITLE, null, this.getPostBackElementName());
  23490.     }
  23491.    
  23492.     public void impostaAperturaTitle(List<DataElement> dati, String titleName, boolean visualizzaSottosezioneAperta) throws DriverControlStationException{
  23493.         this.impostaAperturaTitle(dati, titleName, DataElementType.TITLE, visualizzaSottosezioneAperta, this.getPostBackElementName());
  23494.     }
  23495.    
  23496.     public void impostaAperturaSubTitle(List<DataElement> dati, String titleName) throws DriverControlStationException{
  23497.         this.impostaAperturaTitle(dati, titleName, DataElementType.SUBTITLE, null, this.getPostBackElementName());
  23498.     }
  23499.    
  23500.     public void impostaAperturaSubTitle(List<DataElement> dati, String titleName, boolean visualizzaSottosezioneAperta) throws DriverControlStationException{
  23501.         this.impostaAperturaTitle(dati, titleName, DataElementType.SUBTITLE, visualizzaSottosezioneAperta, this.getPostBackElementName());
  23502.     }
  23503.    
  23504.     private void impostaAperturaTitle(List<DataElement> dati, String titleName, DataElementType titleType, Boolean visualizzaSottosezioneAperta, String postbackElementName) {
  23505.         if(dati != null) {
  23506.             int idxSubtitle = -1;
  23507.             for (int i = 0; i < dati.size(); i++) {
  23508.                 if(titleName.equals(dati.get(i).getName())) {
  23509.                     idxSubtitle = i;
  23510.                     break;
  23511.                 }
  23512.             }
  23513.            
  23514.             if(visualizzaSottosezioneAperta == null) {
  23515.                 // se ho trovato il subtitle allora prendo i filtri successivi
  23516.                 // finche non trovo un altro subtitle o finisce la lista
  23517.                 if(idxSubtitle > -1) {
  23518.                     List<DataElement> filter_values_to_check = new ArrayList<DataElement>();
  23519.                    
  23520.                     for (int i = idxSubtitle + 1; i < dati.size(); i++) {
  23521.                         DataElement de = dati.get(i);
  23522.                         if(de.getType().equals(titleType.toString())) {
  23523.                             // ho trovato un'altra sezione mi fermo
  23524.                             break;
  23525.                         } else {
  23526.                             filter_values_to_check.add(de);
  23527.                         }
  23528.                     }
  23529.                     visualizzaSottosezioneAperta = this.hasAlmostOneFormElementDefined(filter_values_to_check);
  23530.                    
  23531.                     // se c'e' stata una postback la sezione dell'elemento che ha provocato il reload deve restare aperta
  23532.                     if(postbackElementName != null) {
  23533.                         for (int i = 0; i < filter_values_to_check.size(); i++) {
  23534.                             if(filter_values_to_check.get(i).getName().equals(postbackElementName)) {
  23535.                                 visualizzaSottosezioneAperta = true;
  23536.                                 break;
  23537.                             }
  23538.                         }
  23539.                     }
  23540.                 }
  23541.             }
  23542.            
  23543.             boolean v = visualizzaSottosezioneAperta!=null && visualizzaSottosezioneAperta.booleanValue();
  23544.             dati.get(idxSubtitle).setStatoAperturaSezioni(v ? STATO_APERTURA_SEZIONI.APERTO : STATO_APERTURA_SEZIONI.CHIUSO);
  23545.         }
  23546.     }
  23547.    
  23548.     public String formatInfoForView(String info) {
  23549.         if(info==null) {
  23550.             return null;
  23551.         }
  23552.         if(info.length()>this.core.getViewLunghezzaMassimaInformazione()) {
  23553.             return info.substring(0, this.core.getViewLunghezzaMassimaInformazione()) + " ...";
  23554.         }
  23555.         else {
  23556.             return info;
  23557.         }
  23558.     }
  23559.    
  23560.     public void addVerificaCertificatoSceltaAlias(List<String> aliases,List<DataElement> dati) throws DriverControlStationException {
  23561.        
  23562.         DataElement de = new DataElement();
  23563.         de.setType(DataElementType.SELECT);
  23564.         List<String> values = new ArrayList<>();
  23565.         List<String> labels = new ArrayList<>();
  23566.         values.add(CostantiControlStation.LABEL_VERIFICA_CONNETTORE_TUTTI_I_NODI);
  23567.         labels.add(CostantiControlStation.LABEL_VERIFICA_CONNETTORE_TUTTI_I_NODI);
  23568.         values.addAll(this.confCore.getJmxPdDAliases());
  23569.         for (String alias : this.confCore.getJmxPdDAliases()) {
  23570.             try {
  23571.                 labels.add(this.confCore.getJmxPdDDescrizione(alias));
  23572.             }catch(Exception e) {
  23573.                 throw new DriverControlStationException(e.getMessage(),e);
  23574.             }
  23575.         }
  23576.         de.setValues(values);
  23577.         de.setLabels(labels);
  23578.         de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
  23579.         de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
  23580.         de.setSize(this.getSize());
  23581.         dati.add(de);
  23582.        
  23583.     }
  23584.    
  23585.     public void addDescrizioneVerificaConnettivitaToDati(List<DataElement> dati, Connettore connettore,
  23586.             String server, boolean registro, String aliasConnettore,
  23587.             List<Parameter> downloadCertServerParameters,
  23588.             boolean setTitle, boolean useLabelEndpoint) throws DriverControlStationException {
  23589.        
  23590.         String tipo = ConnettoreCheck.getPropertyValue(connettore, ConnettoreCheck.POLICY_TIPO_ENDPOINT);
  23591.            
  23592.         if(setTitle) {
  23593.             DataElement de = new DataElement();
  23594.             de.setType(DataElementType.TITLE);
  23595.             String label = ConnettoriCostanti.LABEL_CONNETTORE+(tipo!=null ? " "+tipo : "");
  23596.             de.setLabel(label);
  23597.             de.setValue(label);
  23598.             dati.add(de);
  23599.         }
  23600.        
  23601.         if(server!=null && !"".equals(server)) {
  23602.             DataElement de = new DataElement();
  23603.             de.setType(DataElementType.TEXT);
  23604.             de.setLabel(ConnettoriCostanti.LABEL_SERVER);
  23605.             de.setValue(server);
  23606.             dati.add(de);
  23607.         }
  23608.        
  23609.         Map<String,String> properties = connettore.getProperties();
  23610.         String location = properties!=null ? properties.get(CostantiConnettori.CONNETTORE_LOCATION) : null;
  23611.                        
  23612.         DataElement de = new DataElement();
  23613.         de.setType(DataElementType.TEXT);
  23614.         if(useLabelEndpoint) {      
  23615.             de.setLabel(CostantiControlStation.LABEL_CONFIGURAZIONE_ENDPOINT);
  23616.         }
  23617.         else {
  23618.             de.setLabel(ConnettoriCostanti.LABEL_CONNETTORE);
  23619.         }
  23620.         de.setValue(location);
  23621.         dati.add(de);
  23622.        
  23623.         if(aliasConnettore!=null && !"".equals(aliasConnettore) &&
  23624.                 (TipiConnettore.HTTP.getNome().equalsIgnoreCase(connettore.getTipo()) ||
  23625.                 TipiConnettore.HTTPS.getNome().equalsIgnoreCase(connettore.getTipo()))
  23626.                 ){
  23627.             if(location!=null && !"".equals(location) && location.toLowerCase().startsWith("https")) {
  23628.                 String nomeConnettore = null;
  23629.                 try {
  23630.                     URL url = new URL( location );
  23631.                     String host = url.getHost();
  23632.                     if(host==null || "".equals(host)) {
  23633.                         throw new DriverControlStationException("L'endpoint '"+host+"' non contiene un host");
  23634.                     }
  23635.                     nomeConnettore = host;
  23636.                     int port = url.getPort();
  23637.                     if(port>0 && port!=443) {
  23638.                         nomeConnettore=nomeConnettore+"_"+port;
  23639.                     }
  23640.                    
  23641.                     de = new DataElement();
  23642.                     de.setType(DataElementType.LINK);
  23643.                     de.setValue(ConnettoriCostanti.LABEL_DOWNLOAD_CERTIFICATI_SERVER);
  23644.                    
  23645.                     downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_CONNETTORE_CERTIFICATO_SERVER));
  23646.                     downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_CONNETTORE_CERTIFICATO_SERVER));
  23647.                     downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_TIPO_CONNETTORE_REGISTRO, registro ? Costanti.CHECK_BOX_ENABLED : Costanti.CHECK_BOX_DISABLED));
  23648.                     downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_ALIAS_CONNETTORE, aliasConnettore));
  23649.                     downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_NOME_CONNETTORE, nomeConnettore));
  23650.                     de.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT,
  23651.                             downloadCertServerParameters.toArray(new Parameter[1]));
  23652.                     dati.add(de);
  23653.                    
  23654.                 }catch(Exception e) {
  23655.                     this.logError("Errore durante l'identificazione dell'endpoint: "+e.getMessage(),e);
  23656.                 }
  23657.             }
  23658.         }
  23659.        
  23660.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_CONNECTION_TIMEOUT)) {
  23661.            
  23662.             de = new DataElement();
  23663.             de.setType(DataElementType.TEXT);
  23664.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_CONNECTION_TIMEOUT);
  23665.             de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_CONNECTION_TIMEOUT));
  23666.             dati.add(de);
  23667.            
  23668.         }
  23669.        
  23670.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_USERNAME)) {
  23671.            
  23672.             de = new DataElement();
  23673.             de.setType(DataElementType.SUBTITLE);
  23674.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTP);
  23675.             de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTP);
  23676.             dati.add(de);
  23677.        
  23678.             de = new DataElement();
  23679.             de.setType(DataElementType.TEXT);
  23680.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTP_USERNAME);
  23681.             de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_USERNAME));
  23682.             dati.add(de);
  23683.            
  23684.             /** Informazione sensibile if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_PASSWORD)) {
  23685.                
  23686.                 de = new DataElement();
  23687.                 de.setType(DataElementType.TEXT);
  23688.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTP_PASSWORD);
  23689.                 String pw = connettore.getProperties().get(CostantiConnettori.CONNETTORE_PASSWORD);
  23690.                 de.setValue(pw!=null ? StringEscapeUtils.escapeHtml(pw) : pw);
  23691.                 dati.add(de);
  23692.                
  23693.             }*/
  23694.            
  23695.         }
  23696.        
  23697.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_TOKEN_POLICY)) {
  23698.            
  23699.             de = new DataElement();
  23700.             de.setType(DataElementType.SUBTITLE);
  23701.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_TOKEN);
  23702.             de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_TOKEN);
  23703.             dati.add(de);
  23704.        
  23705.             de = new DataElement();
  23706.             de.setType(DataElementType.TEXT);
  23707.             de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CONNETTORE_TOKEN_POLICY);
  23708.             de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_TOKEN_POLICY));
  23709.             dati.add(de);
  23710.            
  23711.         }
  23712.        
  23713.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_APIKEY)) {
  23714.            
  23715.             de = new DataElement();
  23716.             de.setType(DataElementType.SUBTITLE);
  23717.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_API_KEY);
  23718.             de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_API_KEY);
  23719.             dati.add(de);
  23720.        
  23721.             String apiKeyHeader = connettore.getProperties().get(CostantiConnettori.CONNETTORE_APIKEY_HEADER);
  23722.             if(apiKeyHeader==null || StringUtils.isEmpty(apiKeyHeader)) {
  23723.                 apiKeyHeader = CostantiConnettori.DEFAULT_HEADER_API_KEY;
  23724.             }
  23725.            
  23726.             de = new DataElement();
  23727.             de.setType(DataElementType.TEXT);
  23728.             de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CONNETTORE_API_KEY_VALUE);
  23729.             de.setValue(StringEscapeUtils.escapeHtml(apiKeyHeader+": ******"));
  23730.             /**de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_APIKEY));Informazione sensibile*/
  23731.             dati.add(de);
  23732.            
  23733.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_APIKEY_APPID)) {
  23734.                            
  23735.                 String appIdHeader = connettore.getProperties().get(CostantiConnettori.CONNETTORE_APIKEY_APPID_HEADER);
  23736.                 if(appIdHeader==null || StringUtils.isEmpty(appIdHeader)) {
  23737.                     appIdHeader = CostantiConnettori.DEFAULT_HEADER_APP_ID;
  23738.                 }
  23739.                
  23740.                 de = new DataElement();
  23741.                 de.setType(DataElementType.TEXT);
  23742.                 de.setLabel(ConnettoriCostanti.LABEL_PARAMETRO_CONNETTORE_API_KEY_APP_ID_VALUE);
  23743.                 de.setValue(StringEscapeUtils.escapeHtml(appIdHeader+": "+connettore.getProperties().get(CostantiConnettori.CONNETTORE_APIKEY_APPID)));
  23744.                 dati.add(de);
  23745.                
  23746.             }
  23747.         }
  23748.        
  23749.         boolean trustAllCerts = false;
  23750.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_TRUST_ALL_CERTS)) {
  23751.             String v = connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_TRUST_ALL_CERTS);
  23752.             if("true".equalsIgnoreCase(v)) {
  23753.                 trustAllCerts = true;
  23754.             }
  23755.         }
  23756.        
  23757.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_LOCATION) ||
  23758.                 trustAllCerts) {
  23759.        
  23760.             de = new DataElement();
  23761.             de.setType(DataElementType.SUBTITLE);
  23762.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS);
  23763.             de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS);
  23764.             dati.add(de);
  23765.        
  23766.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_SSL_TYPE)) {
  23767.                
  23768.                 de = new DataElement();
  23769.                 de.setType(DataElementType.TEXT);
  23770.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_SSL_TYPE);
  23771.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_SSL_TYPE));
  23772.                 dati.add(de);
  23773.                
  23774.             }
  23775.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_HOSTNAME_VERIFIER)) {
  23776.                
  23777.                 de = new DataElement();
  23778.                 de.setType(DataElementType.TEXT);
  23779.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_HOSTNAME_VERIFIER);
  23780.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_HOSTNAME_VERIFIER));
  23781.                 dati.add(de);
  23782.                
  23783.             }
  23784.                
  23785.             de = new DataElement();
  23786.             de.setType(DataElementType.TEXT);
  23787.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_TRUSTSTORE);
  23788.             if(trustAllCerts) {
  23789.                 de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_TRUST_ALL_CERTS);
  23790.             }
  23791.             else {
  23792.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_LOCATION));
  23793.             }
  23794.             dati.add(de);
  23795.                
  23796.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_CRLS)) {
  23797.                
  23798.                 de = new DataElement();
  23799.                 de.setType(DataElementType.TEXT);
  23800.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_TRUSTSTORE_CRLS);
  23801.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_CRLS));
  23802.                 dati.add(de);
  23803.                
  23804.             }
  23805.            
  23806.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_OCSP_POLICY)) {
  23807.                
  23808.                 de = new DataElement();
  23809.                 de.setType(DataElementType.TEXT);
  23810.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_TRUSTSTORE_OCSP_POLICY);
  23811.                 String ocspPolicy = connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_TRUST_STORE_OCSP_POLICY);
  23812.                 String value = null;
  23813.                 try {
  23814.                     if(ocspPolicy!=null) {
  23815.                         String label = OCSPManager.getInstance().getOCSPConfig(ocspPolicy).getLabel();
  23816.                         value = ((label!=null && StringUtils.isNotEmpty(label)) ? label : ocspPolicy);
  23817.                     }
  23818.                 }catch(Throwable t) {
  23819.                     value = ocspPolicy;
  23820.                 }
  23821.                 de.setValue(value);
  23822.                 dati.add(de);
  23823.                
  23824.             }
  23825.            
  23826.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_KEY_STORE_LOCATION)) {
  23827.                
  23828.                 de = new DataElement();
  23829.                 de.setType(DataElementType.TEXT);
  23830.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_KEYSTORE);
  23831.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_KEY_STORE_LOCATION));
  23832.                 dati.add(de);
  23833.                
  23834.                 if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_KEY_ALIAS)) {
  23835.                    
  23836.                     de = new DataElement();
  23837.                     de.setType(DataElementType.TEXT);
  23838.                     de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_KEY_ALIAS);
  23839.                     de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_KEY_ALIAS));
  23840.                     dati.add(de);
  23841.                    
  23842.                 }
  23843.                
  23844.                 if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTPS_KEY_STORE_BYOK_POLICY)) {
  23845.                    
  23846.                     de = new DataElement();
  23847.                     de.setType(DataElementType.TEXT);
  23848.                     de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_HTTPS_KEYSTORE_BYOK_POLICY);
  23849.                     String byokPolicy = connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTPS_KEY_STORE_BYOK_POLICY);
  23850.                     String value = null;
  23851.                     try {
  23852.                         if(byokPolicy!=null) {
  23853.                             String label = BYOKManager.getInstance().getKSMConfigByType(byokPolicy).getLabel();
  23854.                             value = ((label!=null && StringUtils.isNotEmpty(label)) ? label : byokPolicy);
  23855.                         }
  23856.                     }catch(Exception t) {
  23857.                         value = byokPolicy;
  23858.                     }
  23859.                     de.setValue(value);
  23860.                     dati.add(de);
  23861.                    
  23862.                 }
  23863.                
  23864.             }
  23865.         }
  23866.        
  23867.         if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTP_PROXY_HOSTNAME)) {
  23868.            
  23869.             de = new DataElement();
  23870.             de.setType(DataElementType.SUBTITLE);
  23871.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY);
  23872.             de.setValue(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY);
  23873.             dati.add(de);
  23874.        
  23875.             de = new DataElement();
  23876.             de.setType(DataElementType.TEXT);
  23877.             de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY_HOSTNAME);
  23878.             de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTP_PROXY_HOSTNAME));
  23879.             dati.add(de);
  23880.            
  23881.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTP_PROXY_PORT)) {
  23882.                
  23883.                 de = new DataElement();
  23884.                 de.setType(DataElementType.TEXT);
  23885.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY_PORT);
  23886.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTP_PROXY_PORT));
  23887.                 dati.add(de);
  23888.                
  23889.             }
  23890.            
  23891.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTP_PROXY_USERNAME)) {
  23892.                
  23893.                 de = new DataElement();
  23894.                 de.setType(DataElementType.TEXT);
  23895.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY_USERNAME);
  23896.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTP_PROXY_USERNAME));
  23897.                 dati.add(de);
  23898.                
  23899.             }

  23900.             if(connettore.getProperties().containsKey(CostantiConnettori.CONNETTORE_HTTP_PROXY_PASSWORD)) {
  23901.                
  23902.                 de = new DataElement();
  23903.                 de.setType(DataElementType.TEXT);
  23904.                 de.setLabel(ConnettoriCostanti.LABEL_VERIFICA_CONNETTORE_DETAILS_PROXY_PASSWORD);
  23905.                 de.setValue(connettore.getProperties().get(CostantiConnettori.CONNETTORE_HTTP_PROXY_PASSWORD));
  23906.                 dati.add(de);
  23907.                
  23908.             }
  23909.         }
  23910.        
  23911.     }
  23912.    
  23913.    
  23914.     public void addProprietaOggetto(List<DataElement> dati, org.openspcoop2.core.registry.ProprietaOggetto pOggetto) {
  23915.         if(pOggetto!=null) {
  23916.             // Creazione
  23917.             if(pOggetto.getDataCreazione()!=null || pOggetto.getUtenteRichiedente()!=null) {
  23918.                 addProprietaOggettoCreazione(dati, pOggetto.getDataCreazione(), pOggetto.getUtenteRichiedente());
  23919.             }
  23920.            
  23921.             // Aggiornamento
  23922.             if(pOggetto.getDataUltimaModifica()!=null || pOggetto.getUtenteUltimaModifica()!=null) {
  23923.                 addProprietaOggettoAggiornamento(dati, pOggetto.getDataUltimaModifica(), pOggetto.getUtenteUltimaModifica());
  23924.             }
  23925.         }
  23926.     }
  23927.     public void addProprietaOggetto(List<DataElement> dati, org.openspcoop2.core.config.ProprietaOggetto pOggetto) {
  23928.         if(pOggetto!=null) {
  23929.             // Creazione
  23930.             if(pOggetto.getDataCreazione()!=null || pOggetto.getUtenteRichiedente()!=null) {
  23931.                 addProprietaOggettoCreazione(dati, pOggetto.getDataCreazione(), pOggetto.getUtenteRichiedente());
  23932.             }
  23933.            
  23934.             // Aggiornamento
  23935.             if(pOggetto.getDataUltimaModifica()!=null || pOggetto.getUtenteUltimaModifica()!=null) {
  23936.                 addProprietaOggettoAggiornamento(dati, pOggetto.getDataUltimaModifica(), pOggetto.getUtenteUltimaModifica());
  23937.             }
  23938.         }
  23939.     }
  23940.     private void addProprietaOggettoCreazione(List<DataElement> dati, Date dataCreazione, String utenteRichiedente) {
  23941.         DataElement de = new DataElement();
  23942.         de.setType(DataElementType.IMAGE);
  23943.         de.setLabel(CostantiControlStation.LABEL_CREAZIONE);
  23944.         if(dataCreazione!=null) {
  23945.             String data = CostantiControlStation.formatDateMinute(dataCreazione);
  23946.             String dataMs = CostantiControlStation.formatDateMs(dataCreazione);
  23947.             de.addInfoAuditDataCreazione(dataMs, data);
  23948.         }
  23949.         if(utenteRichiedente!=null) {
  23950.             de.addInfoAuditUtente(utenteRichiedente, utenteRichiedente);
  23951.         }
  23952.         dati.add(de);
  23953.     }
  23954.     private void addProprietaOggettoAggiornamento(List<DataElement> dati, Date dataUltimaModifica, String utenteUltimaModifica) {
  23955.         DataElement de = new DataElement();
  23956.         de.setType(DataElementType.IMAGE);
  23957.         de.setLabel(CostantiControlStation.LABEL_ULTIMA_MODIFICA);
  23958.         if(dataUltimaModifica!=null) {
  23959.             String data = CostantiControlStation.formatDateMinute(dataUltimaModifica);
  23960.             String dataMs = CostantiControlStation.formatDateMs(dataUltimaModifica);
  23961.             de.addInfoAuditDataAggiornamento(dataMs, data);
  23962.         }
  23963.         if(utenteUltimaModifica!=null) {
  23964.             de.addInfoAuditUtente(utenteUltimaModifica, utenteUltimaModifica);
  23965.         }
  23966.         dati.add(de);
  23967.     }
  23968.    
  23969.     public ProprietaOggetto convertToProprietaOggettoRegistro(org.openspcoop2.core.config.ProprietaOggetto pConfig) {
  23970.         ProprietaOggetto p = null;
  23971.         if(pConfig!=null) {
  23972.             p = new ProprietaOggetto();
  23973.             p.setDataCreazione(pConfig.getDataCreazione());
  23974.             p.setDataUltimaModifica(pConfig.getDataUltimaModifica());
  23975.             p.setUtenteRichiedente(pConfig.getUtenteRichiedente());
  23976.             p.setUtenteUltimaModifica(pConfig.getUtenteUltimaModifica());
  23977.         }
  23978.         return p;
  23979.     }
  23980.    
  23981.     public ProprietaOggetto mergeProprietaOggetto(ProprietaOggetto pRegistry, org.openspcoop2.core.config.ProprietaOggetto pConfigPorta, boolean consideraDataCreazioneComeDataModifica) {
  23982.         ProprietaOggetto p = null;
  23983.         if(pRegistry!=null &&
  23984.             (pRegistry.getDataCreazione()!=null || pRegistry.getUtenteRichiedente()!=null ||
  23985.                     pRegistry.getDataUltimaModifica()!=null || pRegistry.getUtenteUltimaModifica()!=null)
  23986.             ){
  23987.             p = new ProprietaOggetto();
  23988.             p.setDataCreazione(pRegistry.getDataCreazione());
  23989.             p.setUtenteRichiedente(pRegistry.getUtenteRichiedente());
  23990.             p.setDataUltimaModifica(pRegistry.getDataUltimaModifica());
  23991.             p.setUtenteUltimaModifica(pRegistry.getUtenteUltimaModifica());
  23992.         }
  23993.        
  23994.         return mergeProprietaOggettoEngine(p, pConfigPorta, consideraDataCreazioneComeDataModifica);
  23995.     }
  23996.    
  23997.     private ProprietaOggetto mergeProprietaOggettoEngine(ProprietaOggetto p, org.openspcoop2.core.config.ProprietaOggetto pConfigPorta, boolean consideraDataCreazioneComeDataModifica) {
  23998.         if(pConfigPorta!=null &&
  23999.             (pConfigPorta.getDataUltimaModifica()!=null)
  24000.             ){
  24001.             mergeProprietaOggettoEngineInitUpdate(p, pConfigPorta);
  24002.         }
  24003.         else if(consideraDataCreazioneComeDataModifica && pConfigPorta!=null &&
  24004.                 (pConfigPorta.getDataUltimaModifica()==null) &&
  24005.                 (pConfigPorta.getDataCreazione()!=null)
  24006.                 ){
  24007.             mergeProprietaOggettoEngineInitCreate(p, pConfigPorta);
  24008.         }
  24009.         return p;
  24010.     }
  24011.     private ProprietaOggetto mergeProprietaOggettoEngineInit(ProprietaOggetto p, org.openspcoop2.core.config.ProprietaOggetto pConfigPorta) {
  24012.         if(p==null) {
  24013.             p = new ProprietaOggetto();
  24014.             p.setDataCreazione(pConfigPorta.getDataCreazione());
  24015.             p.setUtenteRichiedente(pConfigPorta.getUtenteRichiedente());
  24016.             p.setDataUltimaModifica(pConfigPorta.getDataUltimaModifica());
  24017.             p.setUtenteUltimaModifica(pConfigPorta.getUtenteUltimaModifica());
  24018.         }
  24019.         return p;
  24020.     }
  24021.     private ProprietaOggetto mergeProprietaOggettoEngineInitUpdate(ProprietaOggetto p, org.openspcoop2.core.config.ProprietaOggetto pConfigPorta){
  24022.         if(p==null) {
  24023.             p = mergeProprietaOggettoEngineInit(p, pConfigPorta);
  24024.         }
  24025.         else if(p.getDataUltimaModifica()==null || p.getDataUltimaModifica().before(pConfigPorta.getDataUltimaModifica())) {
  24026.             p.setDataUltimaModifica(pConfigPorta.getDataUltimaModifica());
  24027.             if(pConfigPorta.getUtenteUltimaModifica()!=null) {
  24028.                 p.setUtenteUltimaModifica(pConfigPorta.getUtenteUltimaModifica());
  24029.             }
  24030.         }
  24031.         return p;
  24032.     }
  24033.     private ProprietaOggetto mergeProprietaOggettoEngineInitCreate(ProprietaOggetto p, org.openspcoop2.core.config.ProprietaOggetto pConfigPorta){
  24034.         if(p==null) {
  24035.             p = mergeProprietaOggettoEngineInit(p, pConfigPorta);
  24036.         }
  24037.         else if(p.getDataUltimaModifica()==null || p.getDataUltimaModifica().before(pConfigPorta.getDataCreazione())) {
  24038.             p.setDataUltimaModifica(pConfigPorta.getDataCreazione());
  24039.             if(pConfigPorta.getUtenteRichiedente()!=null) {
  24040.                 p.setUtenteUltimaModifica(pConfigPorta.getUtenteRichiedente());
  24041.             }
  24042.         }
  24043.         return p;
  24044.     }
  24045.    
  24046.     protected void impostaComandiMenuContestuale(AccordoServizioParteSpecifica asps, String protocollo, boolean gestioneFruitori,
  24047.             Fruitore fruitore,
  24048.             boolean showVerificaCertificati, List<Parameter> listaParametriChange,
  24049.             List<Parameter> listParametersVerificaCertificati,
  24050.             List<Parameter> listParametersFruitoriVerificaCertificati,
  24051.             ProprietaOggetto pOggetto, boolean visualizzaInUsoButton) throws DriverControlStationException, DriverRegistroServiziException {
  24052.         this.impostaComandiMenuContestuale(asps, protocollo, gestioneFruitori, fruitore, showVerificaCertificati, listaParametriChange,
  24053.                 listParametersVerificaCertificati, listParametersFruitoriVerificaCertificati, pOggetto, visualizzaInUsoButton, true);
  24054.     }

  24055.     protected void impostaComandiMenuContestuale(AccordoServizioParteSpecifica asps, String protocollo, boolean gestioneFruitori,
  24056.             Fruitore fruitore,
  24057.             boolean showVerificaCertificati, List<Parameter> listaParametriChange,
  24058.             List<Parameter> listParametersVerificaCertificati,
  24059.             List<Parameter> listParametersFruitoriVerificaCertificati,
  24060.             ProprietaOggetto pOggetto, boolean visualizzaInUsoButton, boolean utilizzaServizioCondiviso) throws DriverControlStationException, DriverRegistroServiziException {
  24061.        
  24062.         boolean root = pOggetto!=null;
  24063.        
  24064.         String uriASPS = this.idServizioFactory.getUriFromAccordo(asps);
  24065.        
  24066.         IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromAccordo(asps);
  24067.        
  24068.         IDSoggetto idSoggettoFruitore = null;
  24069.         if(gestioneFruitori) {
  24070.             idSoggettoFruitore = new IDSoggetto(fruitore.getTipo(), fruitore.getNome());
  24071.         }
  24072.        
  24073.         String idServizioButton = gestioneFruitori ? uriASPS+"@"+fruitore.getTipo()+"/"+fruitore.getNome() : uriASPS;
  24074.        
  24075.         String labelServizioConFruitore = this.getLabelServizio(idSoggettoFruitore, gestioneFruitori, idServizio, protocollo);
  24076.        
  24077.         // In Uso Button
  24078.         if(visualizzaInUsoButton) {
  24079.             this.addComandoInUsoInfoButton(labelServizioConFruitore,
  24080.                 idServizioButton,
  24081.                 gestioneFruitori ? InUsoType.FRUIZIONE_INFO : InUsoType.EROGAZIONE_INFO);
  24082.         }
  24083.        
  24084.         // Verifica Certificati
  24085.         if(showVerificaCertificati) {
  24086.             if(gestioneFruitori) {
  24087.                 this.addComandoVerificaCertificatiElementoButton(utilizzaServizioCondiviso, ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_VERIFICA_CERTIFICATI, listParametersFruitoriVerificaCertificati, InUsoType.FRUIZIONE);
  24088.             }
  24089.             else {
  24090.                 this.addComandoVerificaCertificatiElementoButton(utilizzaServizioCondiviso, ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_VERIFICA_CERTIFICATI, listParametersVerificaCertificati, InUsoType.EROGAZIONE);
  24091.             }
  24092.         }
  24093.        
  24094.         // se e' abilitata l'opzione reset cache per elemento, visualizzo il comando nell'elenco dei comandi disponibili nella lista
  24095.         if(this.core.isElenchiVisualizzaComandoResetCacheSingoloElemento()){
  24096.             this.addComandoResetCacheElementoButton(utilizzaServizioCondiviso, ErogazioniCostanti.SERVLET_NAME_ASPS_EROGAZIONI_CHANGE, listaParametriChange,
  24097.                     gestioneFruitori ? InUsoType.FRUIZIONE : InUsoType.EROGAZIONE);
  24098.         }
  24099.        
  24100.         // Proprieta Button
  24101.        
  24102.         if(gestioneFruitori &&
  24103.                 root &&
  24104.                 this.existsProprietaOggetto(pOggetto, fruitore.getDescrizione())) {
  24105.             this.addComandoProprietaOggettoButton(labelServizioConFruitore, idServizioButton,
  24106.                     InUsoType.FRUIZIONE);
  24107.         }
  24108.         else if(!gestioneFruitori &&
  24109.                 root &&
  24110.                 this.existsProprietaOggetto(pOggetto, asps.getDescrizione())) {
  24111.             this.addComandoProprietaOggettoButton(labelServizioConFruitore, idServizioButton,
  24112.                     InUsoType.EROGAZIONE);
  24113.         }
  24114.     }
  24115.    
  24116.     public void impostaComandiMenuContestualePD(String idSoggFruitoreDelServizio,
  24117.             Parameter parametroTipoSoggettoFruitore, Parameter parametroNomeSoggettoFruitore,
  24118.             AccordoServizioParteSpecifica asps, String protocollo, Parameter pIdSoggettoErogatore, Fruitore fru,
  24119.             Parameter pIdFruitore, Parameter pNomeServizio, Parameter pTipoServizio)
  24120.             throws DriverRegistroServiziException, DriverControlStationException {
  24121.         // visualizzo menu' contestuale
  24122.        
  24123.         boolean showVerificaCertificati = this.core.isFruizioniVerificaCertificati();
  24124.         List<Parameter> listaParametriChange = new ArrayList<>();      
  24125.         listaParametriChange.add(new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID, asps.getId() + ""));
  24126.         listaParametriChange.add(pNomeServizio);
  24127.         listaParametriChange.add(pTipoServizio);
  24128.         listaParametriChange.add(pIdSoggettoErogatore);
  24129.         listaParametriChange.add(parametroTipoSoggettoFruitore);
  24130.         listaParametriChange.add(parametroNomeSoggettoFruitore);
  24131.            
  24132.         Parameter pIdProviderFruitore = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_PROVIDER_FRUITORE, idSoggFruitoreDelServizio + "");
  24133.         listaParametriChange.add(pIdProviderFruitore);
  24134.        
  24135.         List<Parameter> listParametersServizioFruitoriModificaProfiloOrVerificaCertificati = null;
  24136.         if(showVerificaCertificati) {
  24137.             listParametersServizioFruitoriModificaProfiloOrVerificaCertificati = new ArrayList<>();
  24138.             listParametersServizioFruitoriModificaProfiloOrVerificaCertificati.addAll(listaParametriChange);
  24139.             listParametersServizioFruitoriModificaProfiloOrVerificaCertificati.add(pIdFruitore);
  24140.         }
  24141.        
  24142.         this.impostaComandiMenuContestuale(asps, protocollo, true, fru, showVerificaCertificati, listaParametriChange, null, listParametersServizioFruitoriModificaProfiloOrVerificaCertificati, null, true);
  24143.     }
  24144.    
  24145.     public void impostaComandiMenuContestualePA(AccordoServizioParteSpecifica asps, String protocollo)
  24146.             throws DriverRegistroServiziException, DriverControlStationException {
  24147.    
  24148.         Parameter pNomeServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_NOME_SERVIZIO, asps.getNome());
  24149.         Parameter pTipoServizio = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_TIPO_SERVIZIO, asps.getTipo());
  24150.         Parameter pIdSoggettoErogatore = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID_SOGGETTO_EROGATORE, asps.getIdSoggetto()+"");
  24151.        
  24152.         this.impostaComandiMenuContestualePA(asps, protocollo, pNomeServizio, pTipoServizio, pIdSoggettoErogatore);
  24153.     }
  24154.    
  24155.     public void impostaComandiMenuContestualePA(AccordoServizioParteSpecifica asps, String protocollo, Parameter pNomeServizio,
  24156.             Parameter pTipoServizio, Parameter pIdSoggettoErogatore)
  24157.             throws DriverRegistroServiziException, DriverControlStationException {
  24158.         // visualizzo menu' contestuale
  24159.         boolean gestioneFruitori = false;
  24160.        
  24161.         boolean showVerificaCertificati = this.core.isFruizioniVerificaCertificati();
  24162.         List<Parameter> listaParametriChange = new ArrayList<>();      
  24163.         listaParametriChange.add(new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_ID, asps.getId() + ""));
  24164.         listaParametriChange.add(pNomeServizio);
  24165.         listaParametriChange.add(pTipoServizio);
  24166.         listaParametriChange.add(pIdSoggettoErogatore);
  24167.        
  24168.         List<Parameter> listParametersServizioModificaProfiloOrVerificaCertificati = null;
  24169.         if(showVerificaCertificati) {
  24170.             listParametersServizioModificaProfiloOrVerificaCertificati = new ArrayList<>();
  24171.             listParametersServizioModificaProfiloOrVerificaCertificati.addAll(listaParametriChange);
  24172.         }
  24173.        
  24174.         this.impostaComandiMenuContestuale(asps, protocollo, gestioneFruitori, null, showVerificaCertificati, listaParametriChange, listParametersServizioModificaProfiloOrVerificaCertificati, null, null, true);
  24175.     }
  24176. }