PorteDelegateDumpConfigurazione.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.text.MessageFormat;
  22. import java.util.List;
  23. import java.util.ArrayList;

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

  27. import org.apache.commons.lang.StringUtils;
  28. import org.apache.struts.action.Action;
  29. import org.apache.struts.action.ActionForm;
  30. import org.apache.struts.action.ActionForward;
  31. import org.apache.struts.action.ActionMapping;
  32. import org.openspcoop2.core.config.DumpConfigurazione;
  33. import org.openspcoop2.core.config.DumpConfigurazioneRegola;
  34. import org.openspcoop2.core.config.PortaDelegata;
  35. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  36. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  37. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  38. import org.openspcoop2.web.ctrlstat.servlet.GeneralHelper;
  39. import org.openspcoop2.web.lib.mvc.Costanti;
  40. import org.openspcoop2.web.lib.mvc.DataElement;
  41. import org.openspcoop2.web.lib.mvc.ForwardParams;
  42. import org.openspcoop2.web.lib.mvc.GeneralData;
  43. import org.openspcoop2.web.lib.mvc.MessageType;
  44. import org.openspcoop2.web.lib.mvc.PageData;
  45. import org.openspcoop2.web.lib.mvc.Parameter;
  46. import org.openspcoop2.web.lib.mvc.ServletUtils;
  47. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  48. /**
  49.  * PorteDelegateDumpConfigurazione
  50.  *
  51.  * @author Andrea Poli (apoli@link.it)
  52.  * @author Giuliano Pintori (pintori@link.it)
  53.  * @author $Author$
  54.  * @version $Rev$, $Date$
  55.  *
  56.  */
  57. public class PorteDelegateDumpConfigurazione extends Action {

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

  60.         TipoOperazione tipoOperazione = TipoOperazione.OTHER;

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

  62.         // Inizializzo PageData
  63.         PageData pd = new PageData();

  64.         GeneralHelper generalHelper = new GeneralHelper(session);

  65.         // Inizializzo GeneralData
  66.         GeneralData gd = generalHelper.initGeneralData(request);

  67.         String userLogin = ServletUtils.getUserLoginFromSession(session);  

  68.         try {
  69.             PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(request, pd, session);
  70.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
  71.             Integer parentPD = ServletUtils.getIntegerAttributeFromSession(PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT, session, request);
  72.             if(parentPD == null) parentPD = PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_NONE;
  73.             String id = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID);
  74.             int idInt = Integer.parseInt(id);
  75.             String idSoggFruitore = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_SOGGETTO);
  76.             String idAsps = porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_ASPS);
  77.             if(idAsps == null)
  78.                 idAsps = "";
  79.             String idFruizione= porteDelegateHelper.getParameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_FRUIZIONE);
  80.             if(idFruizione == null)
  81.                 idFruizione = "";
  82.            
  83.             String idTab = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_ID_TAB);
  84.             if(!porteDelegateHelper.isModalitaCompleta() && StringUtils.isNotEmpty(idTab)) {
  85.                 ServletUtils.setObjectIntoSession(request, session, idTab, CostantiControlStation.PARAMETRO_ID_TAB);
  86.             }

  87.             // Preparo il menu
  88.             porteDelegateHelper.makeMenu();
  89.            
  90.             // Prendo il nome della porta
  91.             PorteDelegateCore porteDelegateCore = new PorteDelegateCore();

  92.             PortaDelegata portaDelegata = porteDelegateCore.getPortaDelegata(idInt);
  93.             String idporta = portaDelegata.getNome();
  94.            
  95.             boolean showStato = true;
  96.             String statoDump = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_STATO);
  97.             boolean showRealtime = porteDelegateCore.isDumpShowConfigurazioneDumpRealtime();
  98.             String realtime = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_REALTIME);
  99.             String statoDumpRichiesta = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_STATO);
  100.             String statoDumpRisposta = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_STATO);
  101.            
  102.             String dumpRichiestaIngressoHeader = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_HEADERS);
  103.             String dumpRichiestaIngressoPayload = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD);
  104.             String dumpRichiestaIngressoPayloadParsing = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_PAYLOAD_PARSING);
  105.             String dumpRichiestaIngressoBody = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_BODY);
  106.             String dumpRichiestaIngressoAttachments = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_INGRESSO_ATTACHMENTS);
  107.            
  108.             String dumpRichiestaUscitaHeader = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_HEADERS);
  109.             String dumpRichiestaUscitaPayload = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD);
  110.             String dumpRichiestaUscitaPayloadParsing = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_PAYLOAD_PARSING);
  111.             String dumpRichiestaUscitaBody = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_BODY);
  112.             String dumpRichiestaUscitaAttachments = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_USCITA_ATTACHMENTS);
  113.            
  114.             String dumpRispostaIngressoHeader = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_HEADERS);
  115.             String dumpRispostaIngressoPayload = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD);
  116.             String dumpRispostaIngressoPayloadParsing = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_PAYLOAD_PARSING);
  117.             String dumpRispostaIngressoBody = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_BODY);
  118.             String dumpRispostaIngressoAttachments = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_INGRESSO_ATTACHMENTS);
  119.            
  120.             String dumpRispostaUscitaHeader = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_HEADERS);
  121.             String dumpRispostaUscitaPayload = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD);
  122.             String dumpRispostaUscitaPayloadParsing = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_PAYLOAD_PARSING);
  123.             String dumpRispostaUscitaBody = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_BODY);
  124.             String dumpRispostaUscitaAttachments = porteDelegateHelper.getParameter(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_USCITA_ATTACHMENTS);
  125.             String actionConferma = porteDelegateHelper.getParameter(Costanti.PARAMETRO_ACTION_CONFIRM);

  126.             DumpConfigurazione oldConfigurazione = portaDelegata.getDump();
  127.            
  128.             boolean initConfigurazione = false;
  129.             String postBackElementName = porteDelegateHelper.getPostBackElementName();
  130.             if(postBackElementName != null ){
  131.                 if(postBackElementName.equalsIgnoreCase(CostantiControlStation.PARAMETRO_DUMP_STATO)){
  132.                     initConfigurazione = true;
  133.                 }
  134.                
  135.                 if(postBackElementName.equals(CostantiControlStation.PARAMETRO_DUMP_RICHIESTA_STATO)) {
  136.                     if(!porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, false) && statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  137.                        
  138.                         dumpRichiestaIngressoHeader = StatoFunzionalita.ABILITATO.getValue();  
  139.                         dumpRichiestaIngressoPayload = StatoFunzionalita.ABILITATO.getValue();
  140.                         dumpRichiestaIngressoPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  141.                         dumpRichiestaIngressoBody = StatoFunzionalita.DISABILITATO.getValue();
  142.                         dumpRichiestaIngressoAttachments = StatoFunzionalita.DISABILITATO.getValue();
  143.                        
  144.                         dumpRichiestaUscitaHeader = StatoFunzionalita.DISABILITATO.getValue();  
  145.                         dumpRichiestaUscitaPayload = StatoFunzionalita.DISABILITATO.getValue();
  146.                         dumpRichiestaUscitaPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  147.                         dumpRichiestaUscitaBody = StatoFunzionalita.DISABILITATO.getValue();
  148.                         dumpRichiestaUscitaAttachments = StatoFunzionalita.DISABILITATO.getValue();
  149.                     }
  150.                 }
  151.                
  152.                 if(postBackElementName.equals(CostantiControlStation.PARAMETRO_DUMP_RISPOSTA_STATO)) {
  153.                     if(!porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, true) && statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  154.                        
  155.                         dumpRispostaIngressoHeader = StatoFunzionalita.DISABILITATO.getValue();
  156.                         dumpRispostaIngressoPayload = StatoFunzionalita.DISABILITATO.getValue();
  157.                         dumpRispostaIngressoPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  158.                         dumpRispostaIngressoBody = StatoFunzionalita.DISABILITATO.getValue();
  159.                         dumpRispostaIngressoAttachments = StatoFunzionalita.DISABILITATO.getValue();
  160.                        
  161.                         dumpRispostaUscitaHeader = StatoFunzionalita.ABILITATO.getValue();  
  162.                         dumpRispostaUscitaPayload = StatoFunzionalita.ABILITATO.getValue();
  163.                         dumpRispostaUscitaPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  164.                         dumpRispostaUscitaBody = StatoFunzionalita.DISABILITATO.getValue();
  165.                         dumpRispostaUscitaAttachments = StatoFunzionalita.DISABILITATO.getValue();
  166.                     }
  167.                 }
  168.             }
  169.            
  170.             // setto la barra del titolo
  171.             List<Parameter> lstParam = porteDelegateHelper.getTitoloPD(parentPD, idSoggFruitore, idAsps, idFruizione);
  172.            
  173.             String labelPerPorta = null;
  174.             if(parentPD!=null && (parentPD.intValue() == PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_CONFIGURAZIONE)) {
  175.                 labelPerPorta = porteDelegateCore.getLabelRegolaMappingFruizionePortaDelegata(
  176.                         PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_DUMP_CONFIGURAZIONE_CONFIG_DI,
  177.                         PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_DUMP_CONFIGURAZIONE,
  178.                         portaDelegata);
  179.             }
  180.             else {
  181.                 labelPerPorta = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_DUMP_CONFIGURAZIONE_CONFIG_DI+idporta;
  182.             }
  183.            
  184.             lstParam.add(new Parameter(labelPerPorta,  null));
  185.            
  186.             // imposto menu' contestuale
  187.             porteDelegateHelper.impostaComandiMenuContestualePD(idSoggFruitore, idAsps, idFruizione);
  188.            
  189.             // edit in progress
  190.             if (porteDelegateHelper.isEditModeInProgress()) {
  191.                 ServletUtils.setPageDataTitle(pd, lstParam);
  192.                
  193.                 if(statoDump == null) {
  194.                     if(oldConfigurazione == null) {
  195.                         statoDump = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  196.                     } else {
  197.                         statoDump = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  198.                         realtime = oldConfigurazione.getRealtime().getValue();
  199.                         statoDumpRichiesta = porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, false) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  200.                         statoDumpRisposta = porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, true) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  201.                        
  202.                         dumpRichiestaIngressoHeader = oldConfigurazione.getRichiestaIngresso().getHeadersRawEnumValue();    
  203.                         dumpRichiestaIngressoPayload = oldConfigurazione.getRichiestaIngresso().getPayloadRawEnumValue();
  204.                         dumpRichiestaIngressoPayloadParsing = oldConfigurazione.getRichiestaIngresso().getPayloadParsingRawEnumValue();
  205.                         dumpRichiestaIngressoBody = oldConfigurazione.getRichiestaIngresso().getBodyRawEnumValue();
  206.                         dumpRichiestaIngressoAttachments = oldConfigurazione.getRichiestaIngresso().getAttachmentsRawEnumValue();
  207.                        
  208.                         dumpRichiestaUscitaHeader = oldConfigurazione.getRichiestaUscita().getHeadersRawEnumValue();    
  209.                         dumpRichiestaUscitaPayload = oldConfigurazione.getRichiestaUscita().getPayloadRawEnumValue();
  210.                         dumpRichiestaUscitaPayloadParsing = oldConfigurazione.getRichiestaUscita().getPayloadParsingRawEnumValue();
  211.                         dumpRichiestaUscitaBody = oldConfigurazione.getRichiestaUscita().getBodyRawEnumValue();
  212.                         dumpRichiestaUscitaAttachments = oldConfigurazione.getRichiestaUscita().getAttachmentsRawEnumValue();
  213.                        
  214.                         dumpRispostaIngressoHeader = oldConfigurazione.getRispostaIngresso().getHeadersRawEnumValue();  
  215.                         dumpRispostaIngressoPayload = oldConfigurazione.getRispostaIngresso().getPayloadRawEnumValue();
  216.                         dumpRispostaIngressoPayloadParsing = oldConfigurazione.getRispostaIngresso().getPayloadParsingRawEnumValue();
  217.                         dumpRispostaIngressoBody = oldConfigurazione.getRispostaIngresso().getBodyRawEnumValue();
  218.                         dumpRispostaIngressoAttachments = oldConfigurazione.getRispostaIngresso().getAttachmentsRawEnumValue();
  219.                        
  220.                         dumpRispostaUscitaHeader = oldConfigurazione.getRispostaUscita().getHeadersRawEnumValue();  
  221.                         dumpRispostaUscitaPayload = oldConfigurazione.getRispostaUscita().getPayloadRawEnumValue();
  222.                         dumpRispostaUscitaPayloadParsing = oldConfigurazione.getRispostaUscita().getPayloadParsingRawEnumValue();
  223.                         dumpRispostaUscitaBody = oldConfigurazione.getRispostaUscita().getBodyRawEnumValue();
  224.                         dumpRispostaUscitaAttachments = oldConfigurazione.getRispostaUscita().getAttachmentsRawEnumValue();
  225.                     }
  226.                 }
  227.                
  228.                 if(initConfigurazione) {
  229.                     if(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  230.                         oldConfigurazione = new DumpConfigurazione();
  231.                         oldConfigurazione.setRichiestaIngresso(new DumpConfigurazioneRegola());
  232.                         oldConfigurazione.setRichiestaUscita(new DumpConfigurazioneRegola());
  233.                         oldConfigurazione.setRispostaIngresso(new DumpConfigurazioneRegola());
  234.                         oldConfigurazione.setRispostaUscita(new DumpConfigurazioneRegola());
  235.                        
  236.                         realtime = oldConfigurazione.getRealtime().getValue();
  237.                         statoDumpRichiesta = porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, false) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  238.                         statoDumpRisposta = porteDelegateHelper.isDumpConfigurazioneAbilitato(oldConfigurazione, true) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  239.                        
  240.                         dumpRichiestaIngressoHeader = StatoFunzionalita.ABILITATO.getValue();  
  241.                         dumpRichiestaIngressoPayload = StatoFunzionalita.ABILITATO.getValue();
  242.                         dumpRichiestaIngressoPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  243.                         dumpRichiestaIngressoBody = StatoFunzionalita.DISABILITATO.getValue();
  244.                         dumpRichiestaIngressoAttachments = StatoFunzionalita.DISABILITATO.getValue();
  245.                        
  246.                         dumpRichiestaUscitaHeader = StatoFunzionalita.DISABILITATO.getValue();  
  247.                         dumpRichiestaUscitaPayload = StatoFunzionalita.DISABILITATO.getValue();
  248.                         dumpRichiestaUscitaPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  249.                         dumpRichiestaUscitaBody = StatoFunzionalita.DISABILITATO.getValue();
  250.                         dumpRichiestaUscitaAttachments = StatoFunzionalita.DISABILITATO.getValue();
  251.                        
  252.                         dumpRispostaIngressoHeader = StatoFunzionalita.DISABILITATO.getValue();
  253.                         dumpRispostaIngressoPayload = StatoFunzionalita.DISABILITATO.getValue();
  254.                         dumpRispostaIngressoPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  255.                         dumpRispostaIngressoBody = StatoFunzionalita.DISABILITATO.getValue();
  256.                         dumpRispostaIngressoAttachments = StatoFunzionalita.DISABILITATO.getValue();
  257.                        
  258.                         dumpRispostaUscitaHeader = StatoFunzionalita.ABILITATO.getValue();  
  259.                         dumpRispostaUscitaPayload = StatoFunzionalita.ABILITATO.getValue();
  260.                         dumpRispostaUscitaPayloadParsing = StatoFunzionalita.DISABILITATO.getValue();
  261.                         dumpRispostaUscitaBody = StatoFunzionalita.DISABILITATO.getValue();
  262.                         dumpRispostaUscitaAttachments = StatoFunzionalita.DISABILITATO.getValue();
  263.                     }
  264.                 }

  265.                 // preparo i campi
  266.                 List<DataElement> dati = new ArrayList<>();
  267.                 dati.add(ServletUtils.getDataElementForEditModeFinished());

  268.                 porteDelegateHelper.addConfigurazioneDumpToDati(tipoOperazione, dati, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  269.                         dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  270.                         dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  271.                         dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  272.                         dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments,
  273.                         false);
  274.                
  275.                 dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idSoggFruitore, null,idAsps,
  276.                         idFruizione, portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario(), dati);

  277.                 pd.setDati(dati);

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

  279.                 return ServletUtils.getStrutsForwardEditModeInProgress(mapping, PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_DUMP_CONFIGURAZIONE,   ForwardParams.OTHER(""));
  280.             }

  281.             // Controlli sui campi immessi
  282.             boolean isOk = porteDelegateHelper.checkDataConfigurazioneDump(tipoOperazione, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  283.                     dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  284.                     dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  285.                     dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  286.                     dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments);
  287.             if (!isOk) {

  288.                 ServletUtils.setPageDataTitle(pd, lstParam);

  289.                 // preparo i campi
  290.                 List<DataElement> dati = new ArrayList<>();
  291.                 dati.add(ServletUtils.getDataElementForEditModeFinished());
  292.                
  293.                 porteDelegateHelper.addConfigurazioneDumpToDati(tipoOperazione, dati, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  294.                         dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  295.                         dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  296.                         dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  297.                         dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments,
  298.                         false);
  299.                
  300.                 dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idSoggFruitore, null,idAsps,
  301.                         idFruizione, portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario(), dati);

  302.                 pd.setDati(dati);

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

  304.                 return ServletUtils.getStrutsForwardEditModeCheckError(mapping, PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_DUMP_CONFIGURAZIONE,   ForwardParams.OTHER(""));
  305.             }
  306.            
  307.             boolean showConfermaRichiesta = false;
  308.             boolean showConfermaRisposta = false;
  309.             if(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  310.                 // se ho abilitato entrambi i dump di ingresso e uscita per richiesta o risposta informo l'utente che lo spazio occupato sara' il doppio
  311.                 if(statoDumpRichiesta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  312.                    
  313.                     boolean bodyIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaIngressoPayload);
  314.                     boolean attachmentsIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaIngressoPayload);
  315.                     if(StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaIngressoPayloadParsing)) {
  316.                         bodyIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaIngressoBody);
  317.                         attachmentsIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaIngressoAttachments);
  318.                     }
  319.                     boolean bodyUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaUscitaPayload);
  320.                     boolean attachmentsUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaUscitaPayload);
  321.                     if(StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaUscitaPayloadParsing)) {
  322.                         bodyUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaUscitaBody);
  323.                         attachmentsUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRichiestaUscitaAttachments);
  324.                     }
  325.                    
  326.                     // doppio body
  327.                     if(bodyIngresso && bodyUscita) {
  328.                         showConfermaRichiesta = true;
  329.                     }
  330.                    
  331.                     // doppi attachments
  332.                     if(attachmentsIngresso && attachmentsUscita) {
  333.                         showConfermaRichiesta = true;
  334.                     }
  335.                 }
  336.                
  337.                 // se ho abilitato entrambi i dump di ingresso e uscita per richiesta o risposta informo l'utente che lo spazio occupato sara' il doppio
  338.                 if(statoDumpRisposta.equals(StatoFunzionalita.ABILITATO.getValue())) {
  339.                    
  340.                     boolean bodyIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaIngressoPayload);
  341.                     boolean attachmentsIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaIngressoPayload);
  342.                     if(StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaIngressoPayloadParsing)) {
  343.                         bodyIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaIngressoBody);
  344.                         attachmentsIngresso = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaIngressoAttachments);
  345.                     }
  346.                     boolean bodyUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaUscitaPayload);
  347.                     boolean attachmentsUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaUscitaPayload);
  348.                     if(StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaUscitaPayloadParsing)) {
  349.                         bodyUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaUscitaBody);
  350.                         attachmentsUscita = StatoFunzionalita.ABILITATO.getValue().equals(dumpRispostaUscitaAttachments);
  351.                     }
  352.                    
  353.                     // doppio body
  354.                     if(bodyIngresso && bodyUscita) {
  355.                         showConfermaRisposta = true;
  356.                     }
  357.                    
  358.                     // doppi attachments
  359.                     if(attachmentsIngresso && attachmentsUscita) {
  360.                         showConfermaRisposta = true;
  361.                     }
  362.                 }
  363.             }
  364.            
  365.             if(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  366.                 if(showConfermaRichiesta  || showConfermaRisposta) {
  367.                     if(actionConferma == null) {
  368.                        
  369.                         ServletUtils.setPageDataTitle(pd, lstParam);
  370.    
  371.                         // preparo i campi
  372.                         List<DataElement> dati = new ArrayList<>();
  373.                         dati.add(ServletUtils.getDataElementForEditModeFinished());
  374.                        
  375.                         porteDelegateHelper.addConfigurazioneDumpToDati(tipoOperazione, dati, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  376.                                 dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  377.                                 dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  378.                                 dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  379.                                 dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments,
  380.                                 false);
  381.                        
  382.                        
  383.                         porteDelegateHelper.addConfigurazioneDumpToDatiAsHidden(tipoOperazione, dati, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  384.                                 dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  385.                                 dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  386.                                 dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  387.                                 dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments,
  388.                                 false);
  389.                        
  390.                         dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idSoggFruitore, null,idAsps,
  391.                                 idFruizione, portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario(), dati);
  392.                        
  393.                         pd.setDati(dati);
  394.                        
  395.                        
  396.                         String msg ="";
  397.                         if(showConfermaRichiesta)
  398.                             msg = CostantiControlStation.LABEL_PARAMETRO_RICHIESTA;
  399.    
  400.                         if(showConfermaRichiesta && showConfermaRisposta)
  401.                             msg += " e ";
  402.                        
  403.                         if(showConfermaRisposta)
  404.                             msg = CostantiControlStation.LABEL_PARAMETRO_RISPOSTA;
  405.                        
  406.                         String messaggio =  MessageFormat.format(CostantiControlStation.MESSAGGIO_CONFERMA_REGISTRAZIONE_MESSAGGI_DOPPIO_SPAZIO, msg);
  407.                        
  408.                         pd.setMessage(messaggio, MessageType.CONFIRM);
  409.                        
  410.                         String[][] bottoni = {
  411.                                 { Costanti.LABEL_MONITOR_BUTTON_ANNULLA,
  412.                                     Costanti.LABEL_MONITOR_BUTTON_ANNULLA_CONFERMA_PREFIX +
  413.                                     Costanti.LABEL_MONITOR_BUTTON_ANNULLA_CONFERMA_SUFFIX
  414.                                    
  415.                                 },
  416.                                 { Costanti.LABEL_MONITOR_BUTTON_CONFERMA,
  417.                                     Costanti.LABEL_MONITOR_BUTTON_ESEGUI_OPERAZIONE_CONFERMA_PREFIX +
  418.                                     Costanti.LABEL_MONITOR_BUTTON_ESEGUI_OPERAZIONE_CONFERMA_SUFFIX }};
  419.    
  420.                         pd.setBottoni(bottoni);
  421.                        
  422.                         // disabilito la form
  423.                         pd.disableEditMode();
  424.    
  425.                         ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);
  426.    
  427.                         return ServletUtils.getStrutsForwardEditModeInProgress(mapping, PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_DUMP_CONFIGURAZIONE,   ForwardParams.OTHER(""));
  428.                     }
  429.                 }
  430.             }
  431.            
  432.             if(statoDump.equals(CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO)) {
  433.                 // se ho confermato effettuo la modifica altrimenti torno direttamente alla lista
  434.                 if( !(showConfermaRichiesta  || showConfermaRisposta)
  435.                         ||
  436.                     (actionConferma != null && actionConferma.equals(Costanti.PARAMETRO_ACTION_CONFIRM_VALUE_OK))
  437.                         ) {
  438.                     DumpConfigurazione newDumpConfigurazione = porteDelegateHelper.getConfigurazioneDump(tipoOperazione, showStato, statoDump, showRealtime, realtime,
  439.                             statoDumpRichiesta, statoDumpRisposta,
  440.                             dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  441.                             dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  442.                             dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  443.                             dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments);
  444.                            
  445.                     portaDelegata.setDump(newDumpConfigurazione);

  446.                     porteDelegateCore.performUpdateOperation(userLogin, porteDelegateHelper.smista(), portaDelegata);
  447.                
  448.                     // Preparo la lista
  449.                     pd.setMessage(PorteDelegateCostanti.LABEL_PORTE_DELEGATE_ARCHIVIO_MESSAGGI_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);
  450.                 }
  451.             } else {
  452.                 portaDelegata.setDump(null);

  453.                 porteDelegateCore.performUpdateOperation(userLogin, porteDelegateHelper.smista(), portaDelegata);
  454.                
  455.                 // Preparo la lista
  456.                 pd.setMessage(PorteDelegateCostanti.LABEL_PORTE_DELEGATE_ARCHIVIO_MESSAGGI_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);

  457.             }

  458.             portaDelegata = porteDelegateCore.getPortaDelegata(idInt);
  459.             idporta = portaDelegata.getNome();

  460.             ServletUtils.setPageDataTitle(pd, lstParam);

  461.             // preparo i campi
  462.             List<DataElement> dati = new ArrayList<>();
  463.             dati.add(ServletUtils.getDataElementForEditModeFinished());
  464.            
  465.             DumpConfigurazione configurazioneAggiornata = portaDelegata.getDump();
  466.            
  467.             if(configurazioneAggiornata == null) {
  468.                 statoDump = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_DEFAULT;
  469.             } else {
  470.                 statoDump = CostantiControlStation.VALUE_PARAMETRO_DUMP_STATO_RIDEFINITO;
  471.                 realtime = configurazioneAggiornata.getRealtime().getValue();
  472.                 statoDumpRichiesta = porteDelegateHelper.isDumpConfigurazioneAbilitato(configurazioneAggiornata, false) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  473.                 statoDumpRisposta = porteDelegateHelper.isDumpConfigurazioneAbilitato(configurazioneAggiornata, true) ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue();
  474.                
  475.                 dumpRichiestaIngressoHeader = configurazioneAggiornata.getRichiestaIngresso().getHeadersRawEnumValue();
  476.                 dumpRichiestaIngressoPayload = configurazioneAggiornata.getRichiestaIngresso().getPayloadRawEnumValue();
  477.                 dumpRichiestaIngressoPayloadParsing = configurazioneAggiornata.getRichiestaIngresso().getPayloadParsingRawEnumValue();
  478.                 dumpRichiestaIngressoBody = configurazioneAggiornata.getRichiestaIngresso().getBodyRawEnumValue();
  479.                 dumpRichiestaIngressoAttachments = configurazioneAggiornata.getRichiestaIngresso().getAttachmentsRawEnumValue();
  480.                
  481.                 dumpRichiestaUscitaHeader = configurazioneAggiornata.getRichiestaUscita().getHeadersRawEnumValue();
  482.                 dumpRichiestaUscitaPayload = configurazioneAggiornata.getRichiestaUscita().getPayloadRawEnumValue();
  483.                 dumpRichiestaUscitaPayloadParsing = configurazioneAggiornata.getRichiestaUscita().getPayloadParsingRawEnumValue();
  484.                 dumpRichiestaUscitaBody = configurazioneAggiornata.getRichiestaUscita().getBodyRawEnumValue();
  485.                 dumpRichiestaUscitaAttachments = configurazioneAggiornata.getRichiestaUscita().getAttachmentsRawEnumValue();
  486.                
  487.                 dumpRispostaIngressoHeader = configurazioneAggiornata.getRispostaIngresso().getHeadersRawEnumValue();  
  488.                 dumpRispostaIngressoPayload = configurazioneAggiornata.getRispostaIngresso().getPayloadRawEnumValue();
  489.                 dumpRispostaIngressoPayloadParsing = configurazioneAggiornata.getRispostaIngresso().getPayloadParsingRawEnumValue();
  490.                 dumpRispostaIngressoBody = configurazioneAggiornata.getRispostaIngresso().getBodyRawEnumValue();
  491.                 dumpRispostaIngressoAttachments = configurazioneAggiornata.getRispostaIngresso().getAttachmentsRawEnumValue();
  492.                
  493.                 dumpRispostaUscitaHeader = configurazioneAggiornata.getRispostaUscita().getHeadersRawEnumValue();  
  494.                 dumpRispostaUscitaPayload = configurazioneAggiornata.getRispostaUscita().getPayloadRawEnumValue();
  495.                 dumpRispostaUscitaPayloadParsing = configurazioneAggiornata.getRispostaUscita().getPayloadParsingRawEnumValue();
  496.                 dumpRispostaUscitaBody = configurazioneAggiornata.getRispostaUscita().getBodyRawEnumValue();
  497.                 dumpRispostaUscitaAttachments = configurazioneAggiornata.getRispostaUscita().getAttachmentsRawEnumValue();
  498.             }
  499.            
  500.             porteDelegateHelper.addConfigurazioneDumpToDati(tipoOperazione, dati, showStato, statoDump, showRealtime, realtime, statoDumpRichiesta, statoDumpRisposta,
  501.                     dumpRichiestaIngressoHeader, dumpRichiestaIngressoPayload, dumpRichiestaIngressoPayloadParsing, dumpRichiestaIngressoBody, dumpRichiestaIngressoAttachments,
  502.                     dumpRichiestaUscitaHeader, dumpRichiestaUscitaPayload, dumpRichiestaUscitaPayloadParsing, dumpRichiestaUscitaBody, dumpRichiestaUscitaAttachments,
  503.                     dumpRispostaIngressoHeader, dumpRispostaIngressoPayload, dumpRispostaIngressoPayloadParsing, dumpRispostaIngressoBody, dumpRispostaIngressoAttachments,
  504.                     dumpRispostaUscitaHeader, dumpRispostaUscitaPayload, dumpRispostaUscitaPayloadParsing, dumpRispostaUscitaBody, dumpRispostaUscitaAttachments,
  505.                     false);
  506.            
  507.             dati = porteDelegateHelper.addHiddenFieldsToDati(TipoOperazione.OTHER,id, idSoggFruitore, null,idAsps,
  508.                     idFruizione, portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario(), dati);

  509.             pd.setDati(dati);

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

  511.             return ServletUtils.getStrutsForwardEditModeFinished(mapping, PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_DUMP_CONFIGURAZIONE, ForwardParams.OTHER(""));
  512.         } catch (Exception e) {
  513.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  514.                     PorteDelegateCostanti.OBJECT_NAME_PORTE_DELEGATE_DUMP_CONFIGURAZIONE, ForwardParams.OTHER(""));
  515.         }
  516.     }

  517. }