PorteApplicativeCorrelazioneApplicativa.java

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

  21. import java.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.PortaApplicativa;
  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. import org.openspcoop2.web.lib.users.dao.User;

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

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

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

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

  68.         GeneralHelper generalHelper = new GeneralHelper(session);

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

  71.         try{
  72.             Boolean contaListe = ServletUtils.getContaListeFromSession(session);
  73.             String userLogin = ServletUtils.getUserLoginFromSession(session);
  74.             @SuppressWarnings("unused")
  75.             User user = ServletUtils.getUserFromSession(request, session);

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

  204.             // Prendo il nome della porta
  205.             PorteApplicativeCore porteApplicativeCore = new PorteApplicativeCore();
  206.            
  207.             PortaApplicativa pde = porteApplicativeCore.getPortaApplicativa(idInt);
  208.             String idporta = pde.getNome();
  209.            
  210.             if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  211.                 nuovaConfigurazioneEsiti = porteApplicativeHelper.readConfigurazioneRegistrazioneEsitiFromHttpParameters(pde.getTracciamento()!=null ? pde.getTracciamento().getEsiti() : null, first);
  212.             }
  213.            
  214.             List<Parameter> listParameter = new ArrayList<>();
  215.             Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idsogg);
  216.             listParameter.add(pIdSogg);
  217.             Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, id);
  218.             listParameter.add(pIdPorta);
  219.             Parameter pIdNome = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME, pde.getNome());
  220.             listParameter.add(pIdNome);
  221.             Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps);
  222.             listParameter.add(pIdAsps);
  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.             // stato correlazione applicativa
  231.             int numCorrelazioneReq = 0;
  232.             int numCorrelazioneRes = 0;

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

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

  574.             Parameter[] urlParms = {
  575.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID,id)   ,
  576.                     new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO,idsogg), new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME,pde.getNome()),
  577.                      new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS,idAsps) };
  578.             Parameter urlRichiesta = new Parameter("", PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_REQUEST_LIST, urlParms);
  579.             Parameter urlRisposta = new Parameter("", PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA_RESPONSE_LIST , urlParms);

  580.             if( porteApplicativeHelper.isEditModeInProgress()){
  581.                 if ((scadcorr == null) && (ca != null)) {
  582.                     scadcorr = ca.getScadenza();
  583.                 }

  584.                 // preparo i campi
  585.                 List<DataElement> dati = new ArrayList<>();
  586.                 dati.add(ServletUtils.getDataElementForEditModeFinished());

  587.                 if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  588.                         ||
  589.                         ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  590.                    
  591.                     porteApplicativeHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  592.                             tracciamentoStato,
  593.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, listParameter,
  594.                             oldTracciamentoStato);
  595.                    
  596.                     porteApplicativeHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  597.                    
  598.                     dati = porteApplicativeHelper.addCorrelazioneApplicativaToDati(dati, false, riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);

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

  637.                 dati = porteApplicativeHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idsogg, null, idAsps, dati);

  638.                 // Set First is false
  639.                 porteApplicativeHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  640.                 // Set Tipo Operazione
  641.                 porteApplicativeHelper.addToDatiHiddenParameter(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, tipoConfigurazione);
  642.                
  643.                 pd.setDati(dati);

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

  645.                 return ServletUtils.getStrutsForwardEditModeInProgress(mapping,
  646.                         PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, ForwardParams.OTHER(""));
  647.             }  

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

  654.                 if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  655.                         ||
  656.                         ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  657.                    
  658.                     porteApplicativeHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  659.                             tracciamentoStato,
  660.                             PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, listParameter,
  661.                             oldTracciamentoStato);
  662.                    
  663.                     porteApplicativeHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  664.                    
  665.                     dati = porteApplicativeHelper.addCorrelazioneApplicativaToDati(dati, false, riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);

  666.                 }
  667.                 else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  668.                
  669.                     porteApplicativeHelper.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 = porteApplicativeCore.buildTracciamentoConfigurazioneDatabase(dbStato,
  679.                             dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  680.                             dbFiltroEsiti);
  681.                     TracciamentoConfigurazione filetrace = porteApplicativeCore.buildTracciamentoConfigurazioneFiletrace(fsStato,
  682.                             fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  683.                             fsFiltroEsiti);
  684.                     TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti = new TracciamentoCompatibilitaFiltroEsiti(database, filetrace);
  685.                
  686.                     porteApplicativeHelper.addToDatiRegistrazioneEsiti(dati, TipoOperazione.OTHER,
  687.                             nuovaConfigurazioneEsiti,
  688.                             selectAll,
  689.                             tracciamentoEsitiSelezionePersonalizzataOk, tracciamentoEsitiSelezionePersonalizzataFault,
  690.                             tracciamentoEsitiSelezionePersonalizzataFallite, tracciamentoEsitiSelezionePersonalizzataScartate,
  691.                             tracciamentoEsitiSelezionePersonalizzataRateLimiting, tracciamentoEsitiSelezionePersonalizzataMax, tracciamentoEsitiSelezionePersonalizzataCors,
  692.                             tracciamentoCompatibilitaFiltroEsiti);
  693.                    
  694.                     porteApplicativeHelper.addToDatiRegistrazioneTransazione(dati, TipoOperazione.OTHER,
  695.                             transazioniTempiElaborazione, transazioniToken);
  696.                    
  697.                     porteApplicativeHelper.addToDatiRegistrazioneConfigurazioneFileTrace(dati,
  698.                             fileTraceStato, fileTraceConfigFile,
  699.                             fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  700.                             fileTraceServer, fileTraceServerHdr, fileTraceServerBody,
  701.                             tracciamentoCompatibilitaFiltroEsiti);
  702.                
  703.                 }
  704.                
  705.                 dati = porteApplicativeHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idsogg, null, idAsps, dati);

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

  710.                 pd.setDati(dati);

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

  712.                 return ServletUtils.getStrutsForwardEditModeCheckError(mapping,
  713.                         PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA,
  714.                         ForwardParams.OTHER(""));
  715.             }

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

  748.             porteApplicativeCore.performUpdateOperation(userLogin, porteApplicativeHelper.smista(), pde);


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

  751.             // Aggiorno valori
  752.             pde = porteApplicativeCore.getPortaApplicativa(idInt);

  753.             if(pde.getTracciamento()!=null && pde.getTracciamento().getStato()!=null && StatoFunzionalita.ABILITATO.equals(pde.getTracciamento().getStato())) {
  754.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  755.             }
  756.             else {
  757.                 oldTracciamentoStato = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  758.             }
  759.            
  760.             if(tipoConfigurazione==null || StringUtils.isEmpty(tipoConfigurazione)
  761.                     ||
  762.                     ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
  763.            
  764.                 // stato correlazione applicativa
  765.                 numCorrelazioneReq = 0;
  766.                 numCorrelazioneRes = 0;
  767.    
  768.                 ca = pde.getCorrelazioneApplicativa();
  769.                 if (ca != null)
  770.                     numCorrelazioneReq = ca.sizeElementoList();
  771.    
  772.                 if (pde.getCorrelazioneApplicativaRisposta() != null)
  773.                     numCorrelazioneRes = pde.getCorrelazioneApplicativaRisposta().sizeElementoList();
  774.    
  775.                 riusoID = false;
  776.                 if(numCorrelazioneReq>0){
  777.                     for (int i = 0; i < numCorrelazioneReq; i++) {
  778.                         if(StatoFunzionalita.ABILITATO.equals(pde.getCorrelazioneApplicativa().getElemento(i).getRiusoIdentificativo())){
  779.                             riusoID = true;
  780.                             break;
  781.                         }
  782.                     }
  783.                 }

  784.                 porteApplicativeHelper.addToDatiTracciamentoTransazioni(dati, TipoOperazione.OTHER,
  785.                         tracciamentoStato,
  786.                         PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA, listParameter,
  787.                         oldTracciamentoStato);
  788.                
  789.                 porteApplicativeHelper.addPortaSeveritaMessaggiDiagnosticiToDati(statoDiagnostici, severita, dati);
  790.                
  791.                 dati = porteApplicativeHelper.addCorrelazioneApplicativaToDati(dati, false, riusoID, scadcorr, urlRichiesta.getValue(), urlRisposta.getValue(), contaListe, numCorrelazioneReq, numCorrelazioneRes);

  792.             }
  793.             else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PORTA.equals(tipoConfigurazione)) {
  794.                 porteApplicativeHelper.addToDatiConfigurazioneAvanzataTracciamento(dati, TipoOperazione.OTHER,
  795.                         dbStato,
  796.                         dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  797.                         dbFiltroEsiti,
  798.                         fsStato,
  799.                         fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  800.                         fsFiltroEsiti,
  801.                         true);
  802.                
  803.                 TracciamentoConfigurazione database = porteApplicativeCore.buildTracciamentoConfigurazioneDatabase(dbStato,
  804.                         dbStatoReqIn, dbStatoReqOut, dbStatoResOut, dbStatoResOutComplete,
  805.                         dbFiltroEsiti);
  806.                 TracciamentoConfigurazione filetrace = porteApplicativeCore.buildTracciamentoConfigurazioneFiletrace(fsStato,
  807.                         fsStatoReqIn, fsStatoReqOut, fsStatoResOut, fsStatoResOutComplete,
  808.                         fsFiltroEsiti);
  809.                 TracciamentoCompatibilitaFiltroEsiti tracciamentoCompatibilitaFiltroEsiti = new TracciamentoCompatibilitaFiltroEsiti(database, filetrace);
  810.            
  811.                 porteApplicativeHelper.addToDatiRegistrazioneEsiti(dati, TipoOperazione.OTHER,
  812.                         nuovaConfigurazioneEsiti,
  813.                         selectAll,
  814.                         tracciamentoEsitiSelezionePersonalizzataOk, tracciamentoEsitiSelezionePersonalizzataFault,
  815.                         tracciamentoEsitiSelezionePersonalizzataFallite, tracciamentoEsitiSelezionePersonalizzataScartate,
  816.                         tracciamentoEsitiSelezionePersonalizzataRateLimiting, tracciamentoEsitiSelezionePersonalizzataMax, tracciamentoEsitiSelezionePersonalizzataCors,
  817.                         tracciamentoCompatibilitaFiltroEsiti);

  818.                 porteApplicativeHelper.addToDatiRegistrazioneTransazione(dati, TipoOperazione.OTHER,
  819.                         transazioniTempiElaborazione, transazioniToken);
  820.                
  821.                 porteApplicativeHelper.addToDatiRegistrazioneConfigurazioneFileTrace(dati,
  822.                         fileTraceStato, fileTraceConfigFile,
  823.                         fileTraceClient, fileTraceClientHdr, fileTraceClientBody,
  824.                         fileTraceServer, fileTraceServerHdr, fileTraceServerBody,
  825.                         tracciamentoCompatibilitaFiltroEsiti);
  826.            
  827.             }
  828.            
  829.             dati = porteApplicativeHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idsogg, null, idAsps, dati);

  830.             // Set First is false
  831.             porteApplicativeHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FIRST_TIME);
  832.             // Set Tipo Operazione
  833.             porteApplicativeHelper.addToDatiHiddenParameter(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, tipoConfigurazione);

  834.             pd.setDati(dati);
  835.            
  836.             pd.setMessage(CostantiControlStation.LABEL_AGGIORNAMENTO_EFFETTUATO_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);

  837.             dati.add(ServletUtils.getDataElementForEditModeFinished());
  838.            
  839.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  840.             return ServletUtils.getStrutsForwardEditModeFinished(mapping,
  841.                     PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA,
  842.                     ForwardParams.OTHER(""));
  843.         }catch (Exception e) {
  844.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  845.                     PorteApplicativeCostanti.OBJECT_NAME_PORTE_APPLICATIVE_CORRELAZIONE_APPLICATIVA ,
  846.                     ForwardParams.OTHER(""));
  847.         }
  848.     }

  849. }