PorteDelegateCorrelazioneApplicativa.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.pd;

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

  23. import javax.servlet.http.HttpServletRequest;
  24. import javax.servlet.http.HttpServletResponse;
  25. import javax.servlet.http.HttpSession;

  26. import org.apache.commons.lang.StringUtils;
  27. import org.apache.struts.action.Action;
  28. import org.apache.struts.action.ActionForm;
  29. import org.apache.struts.action.ActionForward;
  30. import org.apache.struts.action.ActionMapping;
  31. import org.openspcoop2.core.config.Configurazione;
  32. import org.openspcoop2.core.config.CorrelazioneApplicativa;
  33. import org.openspcoop2.core.config.PortaDelegata;
  34. import org.openspcoop2.core.config.TracciamentoConfigurazione;
  35. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  36. import org.openspcoop2.core.config.utils.TracciamentoCompatibilitaFiltroEsiti;
  37. import org.openspcoop2.protocol.sdk.constants.EsitoTransazioneName;
  38. import org.openspcoop2.protocol.utils.EsitiConfigUtils;
  39. import org.openspcoop2.protocol.utils.EsitiProperties;
  40. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  41. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  42. import org.openspcoop2.web.ctrlstat.servlet.GeneralHelper;
  43. import org.openspcoop2.web.ctrlstat.servlet.config.ConfigurazioneCostanti;
  44. import org.openspcoop2.web.lib.mvc.Costanti;
  45. import org.openspcoop2.web.lib.mvc.DataElement;
  46. import org.openspcoop2.web.lib.mvc.ForwardParams;
  47. import org.openspcoop2.web.lib.mvc.GeneralData;
  48. import org.openspcoop2.web.lib.mvc.PageData;
  49. import org.openspcoop2.web.lib.mvc.Parameter;
  50. import org.openspcoop2.web.lib.mvc.ServletUtils;
  51. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  52. /***
  53.  *
  54.  * PorteDelegateCorrelazioneApplicativa
  55.  *
  56.  * @author Giuliano Pintori (pintori@link.it)
  57.  * @author $Author$
  58.  * @version $Rev$, $Date$
  59.  *
  60.  */
  61. public class PorteDelegateCorrelazioneApplicativa extends Action {

  62.     @Override
  63.     public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

  64.         HttpSession session = request.getSession(true);

  65.         // Inizializzo PageData
  66.         PageData pd = new PageData();

  67.         GeneralHelper generalHelper = new GeneralHelper(session);

  68.         // Inizializzo GeneralData
  69.         GeneralData gd = generalHelper.initGeneralData(request);

  70.         try{
  71.             Boolean contaListe = ServletUtils.getContaListeFromSession(session);
  72.             String userLogin = ServletUtils.getUserLoginFromSession(session);

  73.             PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(request, pd, session);
  74.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  75.             Integer parentPD = ServletUtils.getIntegerAttributeFromSession(PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT, session, request);
  76.             if(parentPD == null) parentPD = PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_NONE;
  77.             String id = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID);
  78.             int idInt = Integer.parseInt(id);
  79.             String idsogg = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_SOGGETTO);
  80.            
  81.             String idAsps = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_ASPS);
  82.             if(idAsps == null)
  83.                 idAsps = "";
  84.             String idFruizione = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_FRUIZIONE);
  85.             if(idFruizione == null)
  86.                 idFruizione = "";
  87.            
  88.             String idTab = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  89.             if(!porteDelegateHelper.isModalitaCompleta() && StringUtils.isNotEmpty(idTab)) {
  90.                 ServletUtils.setObjectIntoSession(request, session, idTab, CostantiControlStation.PARAMETRO_ID_TAB);
  91.             }
  92.            
  93.             String tipoConfigurazione = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE);
  94.            
  95.             String tracciamentoStato = null;
  96.             String oldTracciamentoStato = null;
  97.            
  98.             String statoDiagnostici = null;
  99.             String severita = null;
  100.            
  101.             String scadcorr = null;
  102.            
  103.             boolean first = false;
  104.            
  105.             String dbStato = null;
  106.             String dbStatoReqIn = null;
  107.             String dbStatoReqOut = null;
  108.             String dbStatoResOut = null;
  109.             String dbStatoResOutComplete = null;
  110.             boolean dbFiltroEsiti = false;
  111.            
  112.             String fsStato = null;
  113.             String fsStatoReqIn = null;
  114.             String fsStatoReqOut = null;
  115.             String fsStatoResOut = null;
  116.             String fsStatoResOutComplete = null;
  117.             boolean fsFiltroEsiti = false;
  118.            
  119.             String nuovaConfigurazioneEsiti = null;
  120.             String tracciamentoEsitiSelezionePersonalizzataOk = null;
  121.             String tracciamentoEsitiSelezionePersonalizzataFault = null;
  122.             String tracciamentoEsitiSelezionePersonalizzataFallite = null;
  123.             String tracciamentoEsitiSelezionePersonalizzataScartate = null;
  124.             String tracciamentoEsitiSelezionePersonalizzataRateLimiting = null;
  125.             String tracciamentoEsitiSelezionePersonalizzataMax = null;
  126.             String tracciamentoEsitiSelezionePersonalizzataCors = null;
  127.            
  128.             String tracciamentoEsitiSelezionePersonalizzataAll = null;
  129.             boolean selectAll = false;
  130.            
  131.             String transazioniTempiElaborazione = null;
  132.             String transazioniToken = null;
  133.            
  134.             String fileTraceStato = null;
  135.             String fileTraceConfigFile = null;
  136.             String fileTraceClient = null;
  137.             String fileTraceClientHdr = null;
  138.             String fileTraceClientBody = null;
  139.             String fileTraceServer = null;
  140.             String fileTraceServerHdr = null;
  141.             String fileTraceServerBody = null;
  142.            
  143.             if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  144.                     ||
  145.                     ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  146.                
  147.                 tracciamentoStato = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_PORTE_TRACCIAMENTO_STATO);
  148.                
  149.                 statoDiagnostici = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_RIDEFINITO);
  150.                 severita = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  151.                
  152.                 scadcorr = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_SCADENZA_CORRELAZIONE_APPLICATIVA);
  153.             }
  154.             else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  155.                        
  156.                 first = porteDelegateHelper.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  157.                
  158.                 dbStato = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO);
  159.                 dbStatoReqIn = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_IN);
  160.                 dbStatoReqOut = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_OUT);
  161.                 dbStatoResOut = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT);
  162.                 dbStatoResOutComplete = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE);
  163.                 String dbFiltroEsitiParam = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_FILTRA_ESITI);
  164.                 dbFiltroEsiti = ServletUtils.isCheckBoxEnabled(dbFiltroEsitiParam);
  165.                
  166.                 fsStato = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO);
  167.                 fsStatoReqIn = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_IN);
  168.                 fsStatoReqOut = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_OUT);
  169.                 fsStatoResOut = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT);
  170.                 fsStatoResOutComplete = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT_COMPLETE);
  171.                 String fsFiltroEsitiParam = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_FILTRA_ESITI);
  172.                 fsFiltroEsiti = ServletUtils.isCheckBoxEnabled(fsFiltroEsitiParam);
  173.                
  174.                 tracciamentoEsitiSelezionePersonalizzataOk = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK);
  175.                 tracciamentoEsitiSelezionePersonalizzataFault = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FAULT);
  176.                 tracciamentoEsitiSelezionePersonalizzataFallite = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE);
  177.                 tracciamentoEsitiSelezionePersonalizzataScartate = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_SCARTATE);
  178.                 tracciamentoEsitiSelezionePersonalizzataRateLimiting = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_RATE_LIMITING);
  179.                 tracciamentoEsitiSelezionePersonalizzataMax = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_MAX_REQUEST);
  180.                 tracciamentoEsitiSelezionePersonalizzataCors = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_CORS);
  181.    
  182.                 tracciamentoEsitiSelezionePersonalizzataAll = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_ESITI_ALL);
  183.                 selectAll = ServletUtils.isCheckBoxEnabled(tracciamentoEsitiSelezionePersonalizzataAll);
  184.            
  185.                 transazioniTempiElaborazione = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONE_TEMPI);
  186.                 transazioniToken = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONE_TOKEN);
  187.                
  188.                 fileTraceStato = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_STATO);
  189.                 fileTraceConfigFile = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CONFIGURAZIONE);
  190.                 fileTraceClient = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT);
  191.                 fileTraceClientHdr = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT_HEADER);
  192.                 fileTraceClientBody = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_CLIENT_PAYLOAD);
  193.                 fileTraceServer = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER);
  194.                 fileTraceServerHdr = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER_HEADER);
  195.                 fileTraceServerBody = porteDelegateHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_FILETRACE_SERVER_PAYLOAD);
  196.             }
  197.            
  198.            
  199.        
  200.            
  201.             // Preparo il menu
  202.             porteDelegateHelper.makeMenu();

  203.             // Prendo il nome della porta
  204.             PorteDelegateCore porteDelegateCore = new PorteDelegateCore();
  205.             PortaDelegata pde = porteDelegateCore.getPortaDelegata(idInt);
  206.             String idporta = pde.getNome();

  207.             if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  208.                 nuovaConfigurazioneEsiti = porteDelegateHelper.readConfigurazioneRegistrazioneEsitiFromHttpParameters(pde.getTracciamento()!=null ? pde.getTracciamento().getEsiti() : null, first);
  209.             }
  210.            
  211.             List<Parameter> listParameter = new ArrayList<>();
  212.             Parameter pIdSoggetto = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_SOGGETTO, idsogg);
  213.             listParameter.add(pIdSoggetto);
  214.             Parameter pId = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID, id);
  215.             listParameter.add(pId);
  216.             Parameter pIdNome = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_NOME, pde.getNome());
  217.             listParameter.add(pIdNome);
  218.             Parameter pIdAsps = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_ASPS, idAsps);
  219.             listParameter.add(pIdAsps);
  220.             Parameter pIdFruizione = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_FRUIZIONE, idFruizione);
  221.             listParameter.add(pIdFruizione);
  222.            
  223.            
  224.             if(pde.getTracciamento()!=null && pde.getTracciamento().getStato()!=null && StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getStato())) {
  225.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  226.             }
  227.             else {
  228.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  229.             }
  230.            
  231.             // stato correlazione applicativa
  232.             int numCorrelazioneReq = 0;
  233.             int numCorrelazioneRes = 0;

  234.             CorrelazioneApplicativa ca = pde.getCorrelazioneApplicativa();
  235.             if (ca != null)
  236.                 numCorrelazioneReq = ca.sizeElementoList();

  237.             if (pde.getCorrelazioneApplicativaRisposta() != null)
  238.                 numCorrelazioneRes = pde.getCorrelazioneApplicativaRisposta().sizeElementoList();

  239.             boolean riusoID = false;
  240.             if(numCorrelazioneReq>0){
  241.                 for (int i = 0; i < numCorrelazioneReq; i++) {
  242.                     if(StatoFunzionalita.ABILITATO.equals(pde.getCorrelazioneApplicativa().getElemento(i).getRiusoIdentificativo())){
  243.                         riusoID = true;
  244.                         break;
  245.                     }
  246.                 }
  247.             }
  248.                        
  249.             Configurazione config = null;
  250.            
  251.            
  252.             if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  253.                
  254.                 boolean initDB = false;
  255.                 boolean initFileTrace = false;
  256.                 if(first && pde.getTracciamento()!=null) {
  257.                                                
  258.                     if(pde.getTracciamento().getDatabase()!=null) {
  259.                         dbStato = (pde.getTracciamento().getDatabase().getStato()!=null) ? pde.getTracciamento().getDatabase().getStato().getValue() :
  260.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO;
  261.                         dbStatoReqIn = (pde.getTracciamento().getDatabase().getRequestIn()!=null) ? pde.getTracciamento().getDatabase().getRequestIn().getValue() :
  262.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_IN;
  263.                         dbStatoReqOut = (pde.getTracciamento().getDatabase().getRequestOut()!=null) ? pde.getTracciamento().getDatabase().getRequestOut().getValue() :
  264.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_OUT;
  265.                         dbStatoResOut = (pde.getTracciamento().getDatabase().getResponseOut()!=null) ? pde.getTracciamento().getDatabase().getResponseOut().getValue() :
  266.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT;
  267.                         dbStatoResOutComplete = (pde.getTracciamento().getDatabase().getResponseOutComplete()!=null) ? pde.getTracciamento().getDatabase().getResponseOutComplete().getValue() :
  268.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE;
  269.                         dbFiltroEsiti = (pde.getTracciamento().getDatabase().getFiltroEsiti()!=null) ? StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getDatabase().getFiltroEsiti()) :
  270.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_FILTRA_ESITI;
  271.                         initDB=true;
  272.                     }
  273.                    
  274.                     if(pde.getTracciamento().getFiletrace()!=null) {
  275.                         fsStato = (pde.getTracciamento().getFiletrace().getStato()!=null) ? pde.getTracciamento().getFiletrace().getStato().getValue() :
  276.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO;
  277.                         fsStatoReqIn = (pde.getTracciamento().getFiletrace().getRequestIn()!=null) ? pde.getTracciamento().getFiletrace().getRequestIn().getValue() :
  278.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_IN;
  279.                         fsStatoReqOut = (pde.getTracciamento().getFiletrace().getRequestOut()!=null) ? pde.getTracciamento().getFiletrace().getRequestOut().getValue() :
  280.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_OUT;
  281.                         fsStatoResOut = (pde.getTracciamento().getFiletrace().getResponseOut()!=null) ? pde.getTracciamento().getFiletrace().getResponseOut().getValue() :
  282.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT;
  283.                         fsStatoResOutComplete = (pde.getTracciamento().getFiletrace().getResponseOutComplete()!=null) ? pde.getTracciamento().getFiletrace().getResponseOutComplete().getValue() :
  284.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT_COMPLETE;
  285.                         fsFiltroEsiti = (pde.getTracciamento().getFiletrace().getFiltroEsiti()!=null) ? StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletrace().getFiltroEsiti()) :
  286.                             ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_FILTRA_ESITI;
  287.                         initFileTrace=true;
  288.                     }
  289.                    
  290.                 }
  291.                 if(first && !initDB) {
  292.                     dbStato = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO;
  293.                     dbStatoReqIn = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_IN;
  294.                     dbStatoReqOut = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_REQ_OUT;
  295.                     dbStatoResOut = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT;
  296.                     dbStatoResOutComplete = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_STATO_RES_OUT_COMPLETE;
  297.                     dbFiltroEsiti = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_DATABASE_FILTRA_ESITI;
  298.                 }
  299.                 if(first && !initFileTrace) {
  300.                     fsStato = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO;
  301.                     fsStatoReqIn = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_IN;
  302.                     fsStatoReqOut = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_REQ_OUT;
  303.                     fsStatoResOut = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT;
  304.                     fsStatoResOutComplete = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_STATO_RES_OUT_COMPLETE;
  305.                     fsFiltroEsiti = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_AVANZATA_TRACCIAMENTO_FILETRACE_FILTRA_ESITI;
  306.                 }
  307.                
  308.                 if(nuovaConfigurazioneEsiti==null) {
  309.                     if(pde.getTracciamento()!=null && pde.getTracciamento().getEsiti()!=null) {
  310.                         nuovaConfigurazioneEsiti = pde.getTracciamento().getEsiti();
  311.                     }
  312.                     else {
  313.                         // prendo quella di default
  314.                         if(config==null) {
  315.                             config = porteDelegateCore.getConfigurazioneGenerale();
  316.                         }
  317.                         nuovaConfigurazioneEsiti = config.getTracciamento()!=null && config.getTracciamento().getPortaDelegata()!=null ? config.getTracciamento().getPortaDelegata().getEsiti() : null;
  318.                         if(nuovaConfigurazioneEsiti == null || "".equals(nuovaConfigurazioneEsiti.trim())){
  319.                             StringBuilder bf = new StringBuilder();
  320.                             porteDelegateHelper.getRegistrazioneEsiti(nuovaConfigurazioneEsiti, bf);
  321.                             if(bf.length()>0){
  322.                                 nuovaConfigurazioneEsiti = bf.toString();
  323.                             }
  324.                         }
  325.                     }
  326.                 }
  327.                 if(tracciamentoEsitiSelezionePersonalizzataOk==null) {
  328.                    
  329.                     List<String> attivi = new ArrayList<>();
  330.                     if(nuovaConfigurazioneEsiti!=null){
  331.                         String [] tmp = nuovaConfigurazioneEsiti.split(",");
  332.                         if(tmp!=null){
  333.                             for (int i = 0; i < tmp.length; i++) {
  334.                                 attivi.add(tmp[i].trim());
  335.                             }
  336.                         }
  337.                     }
  338.                    
  339.                     EsitiProperties esiti = EsitiConfigUtils.getEsitiPropertiesForConfiguration(ControlStationCore.getLog());
  340.                    
  341.                     boolean isOkTotale = false;
  342.                     List<Integer> listOk = porteDelegateHelper.getListaEsitiOkSenzaCors(esiti);
  343.                     if(porteDelegateHelper.isCompleteEnabled(attivi, listOk)) {
  344.                         tracciamentoEsitiSelezionePersonalizzataOk = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  345.                         isOkTotale = true;
  346.                     }
  347.                     else if(porteDelegateHelper.isCompleteDisabled(attivi, listOk)) {
  348.                         tracciamentoEsitiSelezionePersonalizzataOk = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  349.                     }
  350.                     else {
  351.                         tracciamentoEsitiSelezionePersonalizzataOk = ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO;
  352.                     }
  353.                    
  354.                     boolean isFaultTotale = false;
  355.                     List<Integer> listFault = esiti.getEsitiCodeFaultApplicativo();
  356.                     if(porteDelegateHelper.isCompleteEnabled(attivi, listFault)) {
  357.                         tracciamentoEsitiSelezionePersonalizzataFault = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  358.                         isFaultTotale = true;
  359.                     }
  360.                     else if(porteDelegateHelper.isCompleteDisabled(attivi, listFault)) {
  361.                         tracciamentoEsitiSelezionePersonalizzataFault = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  362.                     }
  363.                     else {
  364.                         tracciamentoEsitiSelezionePersonalizzataFault = ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO;
  365.                     }
  366.                    
  367.                     boolean isFalliteSenzaMaxThreadsScartateTotale = false;
  368.                     List<Integer> listFalliteSenzaMax = porteDelegateHelper.getListaEsitiFalliteSenza_RateLimiting_MaxThreads_Scartate(esiti);
  369.                     if(porteDelegateHelper.isCompleteEnabled(attivi, listFalliteSenzaMax)) {
  370.                         tracciamentoEsitiSelezionePersonalizzataFallite = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  371.                         isFalliteSenzaMaxThreadsScartateTotale = true;
  372.                     }
  373.                     else if(porteDelegateHelper.isCompleteDisabled(attivi, listFalliteSenzaMax)) {
  374.                         tracciamentoEsitiSelezionePersonalizzataFallite = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  375.                     }
  376.                     else {
  377.                         tracciamentoEsitiSelezionePersonalizzataFallite = ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO;
  378.                     }
  379.                    
  380.                     boolean isScartateTotale = false;
  381.                     List<Integer> listScartate = esiti.getEsitiCodeRichiestaScartate();
  382.                     if(porteDelegateHelper.isCompleteEnabled(attivi, listScartate)) {
  383.                         tracciamentoEsitiSelezionePersonalizzataScartate = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  384.                         isScartateTotale = true;
  385.                     }
  386.                     else if(porteDelegateHelper.isCompleteDisabled(attivi, listScartate)) {
  387.                         tracciamentoEsitiSelezionePersonalizzataScartate = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  388.                     }
  389.                     else {
  390.                         tracciamentoEsitiSelezionePersonalizzataScartate = ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO;
  391.                     }
  392.                    
  393.                     boolean isRateLimiting = false;
  394.                     if(attivi.contains((esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_POLICY_VIOLATA)+""))) {
  395.                         tracciamentoEsitiSelezionePersonalizzataRateLimiting = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  396.                         isRateLimiting = true;
  397.                     }  
  398.                     else {
  399.                         tracciamentoEsitiSelezionePersonalizzataRateLimiting = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  400.                     }
  401.                    
  402.                     boolean isMaxThreads = false;
  403.                     if(attivi.contains((esiti.convertoToCode(EsitoTransazioneName.CONTROLLO_TRAFFICO_MAX_THREADS)+""))) {
  404.                         tracciamentoEsitiSelezionePersonalizzataMax = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  405.                         isMaxThreads = true;
  406.                     }  
  407.                     else {
  408.                         tracciamentoEsitiSelezionePersonalizzataMax = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  409.                     }
  410.                    
  411.                     boolean isCorsTotale = false;
  412.                     List<Integer> listCors = porteDelegateHelper.getListaEsitiCors(esiti);
  413.                     if(porteDelegateHelper.isCompleteEnabled(attivi, listCors)) {
  414.                         tracciamentoEsitiSelezionePersonalizzataCors = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  415.                         isCorsTotale = true;
  416.                     }
  417.                     else if(porteDelegateHelper.isCompleteDisabled(attivi, listCors)) {
  418.                         tracciamentoEsitiSelezionePersonalizzataCors = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  419.                     }
  420.                     else {
  421.                         tracciamentoEsitiSelezionePersonalizzataCors = ConfigurazioneCostanti.TRACCIAMENTO_ESITI_PERSONALIZZATO;
  422.                     }
  423.                    
  424.                     selectAll = isOkTotale && isFaultTotale &&
  425.                             isFalliteSenzaMaxThreadsScartateTotale && isScartateTotale &&
  426.                             isRateLimiting && isMaxThreads && isCorsTotale;
  427.                    
  428.                 }
  429.                
  430.                
  431.                 if(first &&
  432.                         pde.getTracciamento()!=null && pde.getTracciamento().getTransazioni()!=null) {
  433.                     if(pde.getTracciamento().getTransazioni().getTempiElaborazione()!=null) {
  434.                         transazioniTempiElaborazione = pde.getTracciamento().getTransazioni().getTempiElaborazione().toString();
  435.                     }
  436.                     if(pde.getTracciamento().getTransazioni().getToken()!=null) {
  437.                         transazioniToken = pde.getTracciamento().getTransazioni().getToken().toString();
  438.                     }
  439.                 }
  440.                
  441.                 if( ConfigurazioneCostanti.PARAMETRO_FILETRACE_STATO.equals(porteDelegateHelper.getPostBackElementName())) {
  442.                     if(fileTraceClient==null || StringUtils.isEmpty(fileTraceClient)) {
  443.                         fileTraceClient = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  444.                     }
  445.                     if(fileTraceClientHdr==null || StringUtils.isEmpty(fileTraceClientHdr)) {
  446.                         fileTraceClientHdr = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  447.                     }
  448.                     if(fileTraceClientBody==null || StringUtils.isEmpty(fileTraceClientBody)) {
  449.                         fileTraceClientBody = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  450.                     }
  451.                     if(fileTraceServer==null || StringUtils.isEmpty(fileTraceServer)) {
  452.                         fileTraceServer = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  453.                     }
  454.                     if(fileTraceServerHdr==null || StringUtils.isEmpty(fileTraceServerHdr)) {
  455.                         fileTraceServerHdr = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  456.                     }
  457.                     if(fileTraceServerBody==null || StringUtils.isEmpty(fileTraceServerBody)) {
  458.                         fileTraceServerBody = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  459.                     }
  460.                 }
  461.                 else if( first &&
  462.                         pde.getTracciamento()!=null) {
  463.                     if(pde.getTracciamento().getFiletraceConfig()!=null) {
  464.                         fileTraceStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  465.                         fileTraceConfigFile = pde.getTracciamento().getFiletraceConfig().getConfig();
  466.                         if(pde.getTracciamento().getFiletraceConfig().getDumpIn()!=null) {
  467.                             fileTraceClient = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpIn().getStato()) ?
  468.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  469.                             fileTraceClientHdr = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpIn().getHeader()) ?
  470.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  471.                             fileTraceClientBody = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpIn().getPayload()) ?
  472.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  473.                         }
  474.                         else {
  475.                             fileTraceClient = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  476.                         }
  477.                         if(pde.getTracciamento().getFiletraceConfig().getDumpOut()!=null) {
  478.                             fileTraceServer = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpOut().getStato()) ?
  479.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  480.                             fileTraceServerHdr = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpOut().getHeader()) ?
  481.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  482.                             fileTraceServerBody = StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getFiletraceConfig().getDumpOut().getPayload()) ?
  483.                                     ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO : ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  484.                         }
  485.                         else {
  486.                             fileTraceServer = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  487.                         }
  488.                     }
  489.                     else {
  490.                         fileTraceStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  491.                     }
  492.                 }
  493.             }
  494.                
  495.            
  496.             if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  497.                     ||
  498.                     ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  499.            
  500.                 if(tracciamentoStato==null) {
  501.                     if(pde.getTracciamento()!=null && pde.getTracciamento().getStato()!=null && StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getStato())) {
  502.                         tracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  503.                     }
  504.                     else {
  505.                         tracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  506.                     }
  507.                 }
  508.                
  509.                 if(statoDiagnostici==null) {
  510.                     if(pde.getTracciamento()!=null && pde.getTracciamento().getSeverita()!=null) {
  511.                         statoDiagnostici = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  512.                     }
  513.                     else {
  514.                         statoDiagnostici = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  515.                     }
  516.                 }
  517.                 if(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO.equals(statoDiagnostici) && severita==null) {
  518.                     // prendo quella di default
  519.                     if(pde.getTracciamento()!=null && pde.getTracciamento().getSeverita()!=null) {
  520.                         severita = pde.getTracciamento().getSeverita().getValue();
  521.                     }
  522.                     else {
  523.                         if(config==null) {
  524.                             config = porteDelegateCore.getConfigurazioneGenerale();
  525.                         }
  526.                         severita = config.getMessaggiDiagnostici()!=null && config.getMessaggiDiagnostici().getSeverita()!=null ?
  527.                                 config.getMessaggiDiagnostici().getSeverita().getValue() :
  528.                                     null;
  529.                     }
  530.                 }
  531.                
  532.             }
  533.            
  534.            
  535.             List<Parameter> lstParam = porteDelegateHelper.getTitoloPD(parentPD, idsogg, idAsps, idFruizione);
  536.            
  537.             Parameter pMenu = null;
  538.             String servlet = null;
  539.             if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  540.                 pMenu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO);
  541.                 servlet = PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA;
  542.             }
  543.            
  544.             String labelPerPorta = null;
  545.             if(parentPD!=null && (parentPD.intValue() == PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_CONFIGURAZIONE)) {
  546.                 labelPerPorta = porteDelegateCore.getLabelRegolaMappingFruizionePortaDelegata(
  547.                         PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_TRACCIAMENTO_CONFIG_DI,
  548.                         PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_TRACCIAMENTO,
  549.                         pde);
  550.             }
  551.             else {
  552.                 labelPerPorta = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_TRACCIAMENTO_CONFIG_DI+idporta;
  553.             }
  554.            
  555.             if(pMenu!=null) {
  556.                 List<Parameter> l = new ArrayList<>();
  557.                 l.addAll(listParameter);
  558.                 l.add(pMenu);
  559.                 lstParam.add(new Parameter(labelPerPorta,  servlet, l.toArray(new Parameter[1])));
  560.             }
  561.             else {
  562.                 lstParam.add(new Parameter(labelPerPorta,  null));
  563.             }
  564.            
  565.             if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  566.                 lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO_CONFIGURAZIONE, null));
  567.             }
  568.            

  569.             // setto la barra del titolo
  570.             ServletUtils.setPageDataTitle(pd, lstParam);
  571.            
  572.             // imposto menu' contestuale
  573.             porteDelegateHelper.impostaComandiMenuContestualePD(idsogg, idAsps, idFruizione);

  574.             Parameter[] urlParms = { pId,pIdSoggetto,pIdAsps,pIdFruizione, new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_NOME,pde.getNome()) };
  575.             Parameter urlRichiesta = new Parameter("", PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA_REQUEST_LIST, urlParms);
  576.             Parameter urlRisposta = new Parameter("", PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA_RESPONSE_LIST , urlParms);

  577.             if( porteDelegateHelper.isEditModeInProgress()){
  578.                 if ((scadcorr == null) && (ca != null)) {
  579.                     scadcorr = ca.getScadenza();
  580.                 }

  581.                 // preparo i campi
  582.                 List<DataElement> dati = new ArrayList<>();
  583.                 dati.add(ServletUtils.getDataElementForEditModeFinished());

  584.                 if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  585.                         ||
  586.                         ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  587.                    
  588.                     porteDelegateHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  589.                             tracciamentoStato,
  590.                             PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA, listParameter,
  591.                             oldTracciamentoStato);
  592.                    
  593.                     porteDelegateHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  594.                    
  595.                     dati = porteDelegateHelper.addCorrelazioneApplicativaToDati(dati, true, riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);

  596.                    
  597.                 }
  598.                 else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  599.                
  600.                     porteDelegateHelper.addToDatiConfigurazioneAvanzataTracciamento(dati, TipoOperazione.OTHER,
  601.                             dbStato,
  602.                             dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  603.                             dbFiltroEsiti,
  604.                             fsStato,
  605.                             fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  606.                             fsFiltroEsiti,
  607.                             true);
  608.                    
  609.                     TracciamentoConfigurazione database = porteDelegateCore.buildTracciamentoConfigurazioneDatabase(dbStato,
  610.                             dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  611.                             dbFiltroEsiti);
  612.                     TracciamentoConfigurazione filetrace = porteDelegateCore.buildTracciamentoConfigurazioneFiletrace(fsStato,
  613.                             fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  614.                             fsFiltroEsiti);
  615.                     TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti = new TracciamentoCompatibilitaFiltroEsiti(database, filetrace);
  616.                    
  617.                     porteDelegateHelper.addToDatiRegistrazioneEsiti(dati, TipoOperazione.OTHER,
  618.                             nuovaConfigurazioneEsiti,
  619.                             selectAll,
  620.                             tracciamentoEsitiSelezionePersonalizzataOk, tracciamentoEsitiSelezionePersonalizzataFault,
  621.                             tracciamentoEsitiSelezionePersonalizzataFallite, tracciamentoEsitiSelezionePersonalizzataScartate,
  622.                             tracciamentoEsitiSelezionePersonalizzataRateLimiting, tracciamentoEsitiSelezionePersonalizzataMax, tracciamentoEsitiSelezionePersonalizzataCors,
  623.                             tracciamentoCompatibilitaFiltroEsiti);
  624.                    
  625.                     porteDelegateHelper.addToDatiRegistrazioneTransazione(dati, TipoOperazione.OTHER,
  626.                             transazioniTempiElaborazione, transazioniToken);
  627.                    
  628.                     porteDelegateHelper.addToDatiRegistrazioneConfigurazioneFileTrace(dati,
  629.                             fileTraceStato, fileTraceConfigFile,
  630.                             fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  631.                             fileTraceServer, fileTraceServerHdr, fileTraceServerBody,
  632.                             tracciamentoCompatibilitaFiltroEsiti);
  633.                
  634.                 }
  635.                
  636.                 dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idsogg, null, idAsps,
  637.                         idFruizione, pde.getTipoSoggettoProprietario(), pde.getNomeSoggettoProprietario(), dati);

  638.                 // Set First is false
  639.                 porteDelegateHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  640.                 // Set Tipo Operazione
  641.                 porteDelegateHelper.addToDatiHiddenParameter(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, tipoConfigurazione);

  642.                 pd.setDati(dati);

  643.                 ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  644.                 return ServletUtils.getStrutsForwardEditModeInProgress(mapping,
  645.                         PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA, ForwardParams.OTHER(""));
  646.             }  

  647.             // Controlli sui campi immessi
  648.             boolean isOk = porteDelegateHelper.correlazioneApplicativaCheckData(TipoOperazione.OTHER,true,scadcorr);
  649.             if(!isOk) {
  650.                 // preparo i campi
  651.                 List<DataElement> dati = new ArrayList<>();
  652.                 dati.add(ServletUtils.getDataElementForEditModeFinished());

  653.                 if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  654.                         ||
  655.                         ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  656.                    
  657.                     porteDelegateHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  658.                             tracciamentoStato,
  659.                             PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA, listParameter,
  660.                             oldTracciamentoStato);
  661.                    
  662.                     porteDelegateHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  663.                    
  664.                     dati = porteDelegateHelper.addCorrelazioneApplicativaToDati(dati,true, riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);
  665.                    
  666.                 }
  667.                 else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  668.                
  669.                     porteDelegateHelper.addToDatiConfigurazioneAvanzataTracciamento(dati, TipoOperazione.OTHER,
  670.                             dbStato,
  671.                             dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  672.                             dbFiltroEsiti,
  673.                             fsStato,
  674.                             fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  675.                             fsFiltroEsiti,
  676.                             true);
  677.                    
  678.                     TracciamentoConfigurazione database = porteDelegateCore.buildTracciamentoConfigurazioneDatabase(dbStato,
  679.                             dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  680.                             dbFiltroEsiti);
  681.                     TracciamentoConfigurazione filetrace = porteDelegateCore.buildTracciamentoConfigurazioneFiletrace(fsStato,
  682.                             fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  683.                             fsFiltroEsiti);
  684.                     TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti = new TracciamentoCompatibilitaFiltroEsiti(database, filetrace);
  685.                
  686.                     porteDelegateHelper.addToDatiRegistrazioneEsiti(dati, TipoOperazione.OTHER,
  687.                             nuovaConfigurazioneEsiti,
  688.                             selectAll,
  689.                             tracciamentoEsitiSelezionePersonalizzataOk, tracciamentoEsitiSelezionePersonalizzataFault,
  690.                             tracciamentoEsitiSelezionePersonalizzataFallite, tracciamentoEsitiSelezionePersonalizzataScartate,
  691.                             tracciamentoEsitiSelezionePersonalizzataRateLimiting, tracciamentoEsitiSelezionePersonalizzataMax, tracciamentoEsitiSelezionePersonalizzataCors,
  692.                             tracciamentoCompatibilitaFiltroEsiti);
  693.                    
  694.                     porteDelegateHelper.addToDatiRegistrazioneTransazione(dati, TipoOperazione.OTHER,
  695.                             transazioniTempiElaborazione, transazioniToken);
  696.                    
  697.                     porteDelegateHelper.addToDatiRegistrazioneConfigurazioneFileTrace(dati,
  698.                             fileTraceStato, fileTraceConfigFile,
  699.                             fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  700.                             fileTraceServer, fileTraceServerHdr, fileTraceServerBody,
  701.                             tracciamentoCompatibilitaFiltroEsiti);
  702.                
  703.                 }
  704.                
  705.                 dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER, id, idsogg, null, idAsps,
  706.                         idFruizione, pde.getTipoSoggettoProprietario(), pde.getNomeSoggettoProprietario(), dati);

  707.                 // Set First is false
  708.                 porteDelegateHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  709.                 // Set Tipo Operazione
  710.                 porteDelegateHelper.addToDatiHiddenParameter(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, tipoConfigurazione);

  711.                 pd.setDati(dati);

  712.                 ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  713.                 return ServletUtils.getStrutsForwardEditModeCheckError(mapping,
  714.                         PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA,
  715.                         ForwardParams.OTHER(""));
  716.             }

  717.             // perform update
  718.            
  719.            
  720.             if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  721.                     ||
  722.                     ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  723.            
  724.                 // Cambio i dati della vecchia CorrelazioneApplicativa
  725.                 // Non ne creo una nuova, altrimenti mi perdo le vecchie entry
  726.                 if (ca != null)
  727.                     ca.setScadenza(scadcorr);
  728.                 pde.setCorrelazioneApplicativa(ca);
  729.    
  730.                 PorteDelegateUtilities.initTracciamento(pde, porteDelegateCore, config,
  731.                         tracciamentoStato, statoDiagnostici, severita);
  732.                
  733.             }
  734.             else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  735.                
  736.                 PorteDelegateUtilities.setTracciamentoTransazioni(pde, porteDelegateCore,
  737.                         dbStato,
  738.                         dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  739.                         dbFiltroEsiti,
  740.                         fsStato,
  741.                         fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  742.                         fsFiltroEsiti,
  743.                         nuovaConfigurazioneEsiti,
  744.                         transazioniTempiElaborazione, transazioniToken,
  745.                         fileTraceStato, fileTraceConfigFile,
  746.                         fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  747.                         fileTraceServer, fileTraceServerHdr, fileTraceServerBody);
  748.                
  749.             }
  750.            
  751.             porteDelegateCore.performUpdateOperation(userLogin, porteDelegateHelper.smista(), pde);


  752.             // preparo i campi
  753.             List<DataElement> dati = new ArrayList<>();

  754.             // Aggiorno valori
  755.             pde = porteDelegateCore.getPortaDelegata(idInt);
  756.            
  757.             if(pde.getTracciamento()!=null && pde.getTracciamento().getStato()!=null && StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getStato())) {
  758.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  759.             }
  760.             else {
  761.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  762.             }

  763.             if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  764.                     ||
  765.                     ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  766.            
  767.                 // stato correlazione applicativa
  768.                 numCorrelazioneReq = 0;
  769.                 numCorrelazioneRes = 0;
  770.    
  771.                 ca = pde.getCorrelazioneApplicativa();
  772.                 if (ca != null)
  773.                     numCorrelazioneReq = ca.sizeElementoList();
  774.    
  775.                 if (pde.getCorrelazioneApplicativaRisposta() != null)
  776.                     numCorrelazioneRes = pde.getCorrelazioneApplicativaRisposta().sizeElementoList();
  777.    
  778.                 riusoID = false;
  779.                 if(numCorrelazioneReq>0){
  780.                     for (int i = 0; i < numCorrelazioneReq; i++) {
  781.                         if(StatoFunzionalita.ABILITATO.equals(pde.getCorrelazioneApplicativa().getElemento(i).getRiusoIdentificativo())){
  782.                             riusoID = true;
  783.                             break;
  784.                         }
  785.                     }
  786.                 }
  787.                
  788.                 porteDelegateHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  789.                         tracciamentoStato,
  790.                         PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA, listParameter,
  791.                         oldTracciamentoStato);
  792.                
  793.                 porteDelegateHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  794.                
  795.                 dati = porteDelegateHelper.addCorrelazioneApplicativaToDati(dati, true,riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);

  796.             }
  797.             else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  798.                
  799.                 porteDelegateHelper.addToDatiConfigurazioneAvanzataTracciamento(dati, TipoOperazione.OTHER,
  800.                         dbStato,
  801.                         dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  802.                         dbFiltroEsiti,
  803.                         fsStato,
  804.                         fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  805.                         fsFiltroEsiti,
  806.                         true);
  807.                
  808.                 TracciamentoConfigurazione database = porteDelegateCore.buildTracciamentoConfigurazioneDatabase(dbStato,
  809.                         dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  810.                         dbFiltroEsiti);
  811.                 TracciamentoConfigurazione filetrace = porteDelegateCore.buildTracciamentoConfigurazioneFiletrace(fsStato,
  812.                         fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  813.                         fsFiltroEsiti);
  814.                 TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti = new TracciamentoCompatibilitaFiltroEsiti(database, filetrace);
  815.            
  816.                 porteDelegateHelper.addToDatiRegistrazioneEsiti(dati, TipoOperazione.OTHER,
  817.                         nuovaConfigurazioneEsiti,
  818.                         selectAll,
  819.                         tracciamentoEsitiSelezionePersonalizzataOk, tracciamentoEsitiSelezionePersonalizzataFault,
  820.                         tracciamentoEsitiSelezionePersonalizzataFallite, tracciamentoEsitiSelezionePersonalizzataScartate,
  821.                         tracciamentoEsitiSelezionePersonalizzataRateLimiting, tracciamentoEsitiSelezionePersonalizzataMax, tracciamentoEsitiSelezionePersonalizzataCors,
  822.                         tracciamentoCompatibilitaFiltroEsiti);
  823.                
  824.                 porteDelegateHelper.addToDatiRegistrazioneTransazione(dati, TipoOperazione.OTHER,
  825.                         transazioniTempiElaborazione, transazioniToken);
  826.                
  827.                 porteDelegateHelper.addToDatiRegistrazioneConfigurazioneFileTrace(dati,
  828.                         fileTraceStato, fileTraceConfigFile,
  829.                         fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  830.                         fileTraceServer, fileTraceServerHdr, fileTraceServerBody,
  831.                         tracciamentoCompatibilitaFiltroEsiti);
  832.            
  833.             }
  834.            
  835.             dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER, id, idsogg, null, idAsps,
  836.                     idFruizione, pde.getTipoSoggettoProprietario(), pde.getNomeSoggettoProprietario(), dati);

  837.             // Set First is false
  838.             porteDelegateHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  839.             // Set Tipo Operazione
  840.             porteDelegateHelper.addToDatiHiddenParameter(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, tipoConfigurazione);

  841.             pd.setDati(dati);
  842.                        
  843.             pd.setMessage(CostantiControlStation.LABEL_AGGIORNAMENTO_EFFETTUATO_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);
  844.             dati.add(ServletUtils.getDataElementForEditModeFinished());
  845.            
  846.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  847.             return ServletUtils.getStrutsForwardEditModeFinished(mapping,
  848.                     PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA,
  849.                     ForwardParams.OTHER(""));
  850.         }catch (Exception e) {
  851.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  852.                     PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_CORRELAZIONE_APPLICATIVA ,
  853.                     ForwardParams.OTHER(""));
  854.         }
  855.     }
  856. }