MultiDeliverUtils.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.pdd.core.behaviour.built_in.multi_deliver;

  21. import java.util.List;

  22. import org.apache.commons.lang.StringUtils;
  23. import org.openspcoop2.core.config.PortaApplicativa;
  24. import org.openspcoop2.core.config.PortaApplicativaServizioApplicativo;
  25. import org.openspcoop2.core.config.PortaApplicativaServizioApplicativoConnettore;
  26. import org.openspcoop2.core.config.Proprieta;
  27. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  28. import org.openspcoop2.generic_project.exception.NotFoundException;
  29. import org.openspcoop2.pdd.core.behaviour.BehaviourException;
  30. import org.openspcoop2.pdd.core.behaviour.BehaviourPropertiesUtils;
  31. import org.openspcoop2.utils.BooleanNullable;
  32. import org.openspcoop2.utils.transport.http.HttpRequestMethod;

  33. /**
  34.  * MultiDeliverUtils
  35.  *
  36.  * @author Andrea Poli (apoli@link.it)
  37.  * @author $Author$
  38.  * @version $Rev$, $Date$
  39.  */
  40. public class MultiDeliverUtils  {
  41.    
  42.     private MultiDeliverUtils() {}
  43.    
  44.    
  45.     public static ConfigurazioneMultiDeliver read(PortaApplicativa pa) throws BehaviourException {
  46.         ConfigurazioneMultiDeliver config = new ConfigurazioneMultiDeliver();
  47.         if(pa.getBehaviour()==null) {
  48.             throw new BehaviourException("Configurazione non disponibile");
  49.         }
  50.        
  51.         if(pa.getBehaviour().sizeProprietaList()>0) {
  52.             for (Proprieta p : pa.getBehaviour().getProprietaList()) {
  53.                
  54.                 String nome = p.getNome();
  55.                 String valore = p.getValore().trim();
  56.                
  57.                 try {
  58.                     if(Costanti.MULTI_DELIVER_CONNETTORE_API.equals(nome)) {
  59.                         config.setTransazioneSincrona_nomeConnettore(valore);
  60.                     }
  61.                    
  62.                     else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO.equals(nome)) {
  63.                         config.setNotificheByEsito("true".equals(valore));
  64.                     }
  65.                    
  66.                     else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_OK.equals(nome)) {
  67.                         config.setNotificheByEsito_ok("true".equals(valore));
  68.                     }
  69.                     else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_FAULT.equals(nome)) {
  70.                         config.setNotificheByEsito_fault("true".equals(valore));
  71.                     }
  72.                     else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_CONSEGNA.equals(nome)) {
  73.                         config.setNotificheByEsito_erroriConsegna("true".equals(valore));
  74.                     }
  75.                     /** le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  76.                     //else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_RICHIESTA_SCARTATE.equals(nome)) {
  77.                     //  config.setNotificheByEsito_richiesteScartate("true".equals(valore));
  78.                     //}*/
  79.                     else if(Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_PROCESSAMENTO.equals(nome)) {
  80.                         config.setNotificheByEsito_erroriProcessamento("true".equals(valore));
  81.                     }
  82.                    
  83.                 }catch(Exception e) {
  84.                     throw new BehaviourException("Configurazione condizionale non corretta (proprietà:"+p.getNome()+" valore:'"+p.getValore()+"'): "+e.getMessage(),e);
  85.                 }
  86.             }
  87.         }  

  88.         return config;
  89.     }
  90.    

  91.     public static void save(PortaApplicativa pa, ConfigurazioneMultiDeliver configurazione, boolean differenziazioneConsegnaDaNotifiche) throws BehaviourException {
  92.        
  93.         if(pa==null) {
  94.             throw new BehaviourException("Param pa is null");
  95.         }
  96.         if(pa.getBehaviour()==null) {
  97.             throw new BehaviourException("Configurazione behaviour non abilitata");
  98.         }
  99.         if(configurazione==null) {
  100.             throw new BehaviourException("Configurazione condizionale non fornita");
  101.         }
  102.        
  103.         if(StringUtils.isNotEmpty(configurazione.getTransazioneSincrona_nomeConnettore())) {
  104.             BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_CONNETTORE_API, configurazione.getTransazioneSincrona_nomeConnettore());
  105.             if(differenziazioneConsegnaDaNotifiche &&
  106.                 pa.sizeServizioApplicativoList()>0) {
  107.                 saveNormalizeConfig(pa, configurazione);
  108.             }
  109.         }
  110.        
  111.         BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO, configurazione.isNotificheByEsito()+"");
  112.                
  113.         BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_OK, configurazione.isNotificheByEsito_ok()+"");
  114.         BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_FAULT, configurazione.isNotificheByEsito_fault()+"");
  115.         BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_CONSEGNA, configurazione.isNotificheByEsito_erroriConsegna()+"");
  116.         /** le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  117.         //BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_RICHIESTA_SCARTATE, configurazione.isNotificheByEsito_richiesteScartate()+""); */
  118.         BehaviourPropertiesUtils.addProprieta(pa.getBehaviour(),Costanti.MULTI_DELIVER_NOTIFICHE_BY_ESITO_ERRORI_PROCESSAMENTO, configurazione.isNotificheByEsito_erroriProcessamento()+"");
  119.     }
  120.     private static void saveNormalizeConfig(PortaApplicativa pa, ConfigurazioneMultiDeliver configurazione) {
  121.         for (PortaApplicativaServizioApplicativo paSA : pa.getServizioApplicativoList()) {
  122.             if(paSA.getDatiConnettore()==null) {
  123.                 paSA.setDatiConnettore(new PortaApplicativaServizioApplicativoConnettore());
  124.             }
  125.             if(paSA.getDatiConnettore().getNome()==null) {
  126.                 paSA.getDatiConnettore().setNome(CostantiConfigurazione.NOME_CONNETTORE_DEFAULT);
  127.             }
  128.             paSA.getDatiConnettore().setNotifica(!(configurazione.getTransazioneSincrona_nomeConnettore().equals(paSA.getDatiConnettore().getNome())));
  129.         }
  130.     }
  131.    
  132.    
  133.     public static ConfigurazioneGestioneConsegnaNotifiche read(PortaApplicativaServizioApplicativo pasa) throws BehaviourException {
  134.         ConfigurazioneGestioneConsegnaNotifiche config = new ConfigurazioneGestioneConsegnaNotifiche();
  135.         if(pasa==null || pasa.getDatiConnettore()==null || pasa.getDatiConnettore().sizeProprietaList()==0) {
  136.             // Configurazione non disponibile
  137.             return GestioneConsegnaNotificheUtils.getGestioneDefault();
  138.         }
  139.        
  140.         for (Proprieta p : pasa.getDatiConnettore().getProprietaList()) {
  141.             read(config, p);
  142.         }  

  143.         return config;
  144.     }
  145.     private static void read(ConfigurazioneGestioneConsegnaNotifiche config, Proprieta p) throws BehaviourException {
  146.         try {
  147.             String nome = p.getNome();
  148.             String valore = p.getValore().trim();
  149.            
  150.             if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_CADENZA.equals(nome)) {
  151.                 config.setCadenzaRispedizione(Integer.valueOf(valore));
  152.             }
  153.            
  154.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX.equals(nome)
  155.                     ||
  156.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_CODE_LIST.equals(nome)
  157.                     ||
  158.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_LEFT_INTERVAL.equals(nome)
  159.                     ||
  160.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_RIGHT_INTERVAL.equals(nome)) {
  161.                 read2xx(config, nome, valore);
  162.             }
  163.            
  164.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX.equals(nome)
  165.                     ||
  166.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_CODE_LIST.equals(nome)
  167.                     ||
  168.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_LEFT_INTERVAL.equals(nome)
  169.                     ||
  170.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_RIGHT_INTERVAL.equals(nome)) {
  171.                 read3xx(config, nome, valore);
  172.             }
  173.            
  174.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX.equals(nome)
  175.                     ||
  176.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_CODE_LIST.equals(nome)
  177.                     ||
  178.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_LEFT_INTERVAL.equals(nome)
  179.                     ||
  180.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_RIGHT_INTERVAL.equals(nome)) {
  181.                 read4xx(config, nome, valore);
  182.             }
  183.            
  184.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX.equals(nome)
  185.                     ||
  186.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_CODE_LIST.equals(nome)
  187.                     ||
  188.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_LEFT_INTERVAL.equals(nome)
  189.                     ||
  190.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_RIGHT_INTERVAL.equals(nome)) {
  191.                 read5xx(config, nome, valore);
  192.             }
  193.            
  194.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT.equals(nome)
  195.                     ||
  196.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_CODE.equals(nome)
  197.                     ||
  198.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_ACTOR.equals(nome)
  199.                     ||
  200.                     Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_MESSAGE.equals(nome)) {
  201.                 readFault(config, nome, valore);
  202.             }
  203.            
  204.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_MESSAGGIO_DA_NOTIFICARE.equals(nome)) {
  205.                 setMultiDeliverNotificheGestioneTipoMessaggioDaNotificare(config, valore);
  206.             }
  207.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_INIETTA_CONTESTO_SINCRONO.equals(nome)) {
  208.                 setMultiDeliverNotificheGestioneIniettaContestSincronoDaNotificare(config, valore);
  209.             }
  210.             else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_HTTP_NOTIFICA.equals(nome)) {
  211.                 setMultiDeliverNotificheGestioneTipoHttpNotifica(config, valore);
  212.             }
  213.            
  214.         }catch(Exception e) {
  215.             throw new BehaviourException("Configurazione condizionale non corretta (proprietà:"+p.getNome()+" valore:'"+p.getValore()+"'): "+e.getMessage(),e);
  216.         }
  217.     }
  218.     private static void read2xx(ConfigurazioneGestioneConsegnaNotifiche config, String nome, String valore) throws NotFoundException {
  219.         if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX.equals(nome)) {
  220.             config.setGestioneTrasporto2xx(TipoGestioneNotificaTrasporto.toEnumConstant(valore, true));
  221.         }
  222.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_CODE_LIST.equals(nome)) {
  223.             setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto2xxCodeList(config, valore);
  224.         }
  225.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_LEFT_INTERVAL.equals(nome)) {
  226.             config.setGestioneTrasporto2xx_leftInterval(Integer.valueOf(valore));
  227.         }
  228.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_RIGHT_INTERVAL.equals(nome)) {
  229.             config.setGestioneTrasporto2xx_rightInterval(Integer.valueOf(valore));
  230.         }
  231.     }
  232.     private static void setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto2xxCodeList(ConfigurazioneGestioneConsegnaNotifiche config, String valore) {
  233.         if(valore.contains(",")) {
  234.             String [] tmp = valore.split(",");
  235.             for (String t : tmp) {
  236.                 config.getGestioneTrasporto2xx_codes().add(Integer.valueOf(t.trim()));
  237.             }
  238.         }
  239.         else {
  240.             config.getGestioneTrasporto2xx_codes().add(Integer.valueOf(valore));
  241.         }
  242.     }
  243.     private static void read3xx(ConfigurazioneGestioneConsegnaNotifiche config, String nome, String valore) throws NotFoundException {
  244.         if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX.equals(nome)) {
  245.             config.setGestioneTrasporto3xx(TipoGestioneNotificaTrasporto.toEnumConstant(valore, true));
  246.         }
  247.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_CODE_LIST.equals(nome)) {
  248.             setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto3xxCodeList(config, valore);
  249.         }
  250.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_LEFT_INTERVAL.equals(nome)) {
  251.             config.setGestioneTrasporto3xx_leftInterval(Integer.valueOf(valore));
  252.         }
  253.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_RIGHT_INTERVAL.equals(nome)) {
  254.             config.setGestioneTrasporto3xx_rightInterval(Integer.valueOf(valore));
  255.         }
  256.     }
  257.     private static void setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto3xxCodeList(ConfigurazioneGestioneConsegnaNotifiche config, String valore) {
  258.         if(valore.contains(",")) {
  259.             String [] tmp = valore.split(",");
  260.             for (String t : tmp) {
  261.                 config.getGestioneTrasporto3xx_codes().add(Integer.valueOf(t.trim()));
  262.             }
  263.         }
  264.         else {
  265.             config.getGestioneTrasporto3xx_codes().add(Integer.valueOf(valore));
  266.         }
  267.     }
  268.     private static void read4xx(ConfigurazioneGestioneConsegnaNotifiche config, String nome, String valore) throws NotFoundException {
  269.         if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX.equals(nome)) {
  270.             config.setGestioneTrasporto4xx(TipoGestioneNotificaTrasporto.toEnumConstant(valore, true));
  271.         }
  272.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_CODE_LIST.equals(nome)) {
  273.             setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto4xxCodeList(config, valore);
  274.         }
  275.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_LEFT_INTERVAL.equals(nome)) {
  276.             config.setGestioneTrasporto4xx_leftInterval(Integer.valueOf(valore));
  277.         }
  278.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_RIGHT_INTERVAL.equals(nome)) {
  279.             config.setGestioneTrasporto4xx_rightInterval(Integer.valueOf(valore));
  280.         }
  281.     }
  282.     private static void setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto4xxCodeList(ConfigurazioneGestioneConsegnaNotifiche config, String valore) {
  283.         if(valore.contains(",")) {
  284.             String [] tmp = valore.split(",");
  285.             for (String t : tmp) {
  286.                 config.getGestioneTrasporto4xx_codes().add(Integer.valueOf(t.trim()));
  287.             }
  288.         }
  289.         else {
  290.             config.getGestioneTrasporto4xx_codes().add(Integer.valueOf(valore));
  291.         }
  292.     }
  293.     private static void read5xx(ConfigurazioneGestioneConsegnaNotifiche config, String nome, String valore) throws NotFoundException {
  294.         if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX.equals(nome)) {
  295.             config.setGestioneTrasporto5xx(TipoGestioneNotificaTrasporto.toEnumConstant(valore, true));
  296.         }
  297.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_CODE_LIST.equals(nome)) {
  298.             setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto5xxCodeList(config, valore);
  299.         }
  300.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_LEFT_INTERVAL.equals(nome)) {
  301.             config.setGestioneTrasporto5xx_leftInterval(Integer.valueOf(valore));
  302.         }
  303.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_RIGHT_INTERVAL.equals(nome)) {
  304.             config.setGestioneTrasporto5xx_rightInterval(Integer.valueOf(valore));
  305.         }
  306.     }
  307.     private static void setMultiDeliverNotificheGestioneErroreTipoGestioneTrasporto5xxCodeList(ConfigurazioneGestioneConsegnaNotifiche config, String valore) {
  308.         if(valore.contains(",")) {
  309.             String [] tmp = valore.split(",");
  310.             for (String t : tmp) {
  311.                 config.getGestioneTrasporto5xx_codes().add(Integer.valueOf(t.trim()));
  312.             }
  313.         }
  314.         else {
  315.             config.getGestioneTrasporto5xx_codes().add(Integer.valueOf(valore));
  316.         }
  317.     }
  318.     private static void readFault(ConfigurazioneGestioneConsegnaNotifiche config, String nome, String valore) throws NotFoundException {
  319.         if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT.equals(nome)) {
  320.             config.setFault(TipoGestioneNotificaFault.toEnumConstant(valore, true));
  321.         }
  322.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_CODE.equals(nome)) {
  323.             config.setFaultCode(valore);
  324.         }
  325.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_ACTOR.equals(nome)) {
  326.             config.setFaultActor(valore);
  327.         }
  328.         else if(Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_MESSAGE.equals(nome)) {
  329.             config.setFaultMessage(valore);
  330.         }
  331.     }
  332.     private static void setMultiDeliverNotificheGestioneTipoMessaggioDaNotificare(ConfigurazioneGestioneConsegnaNotifiche config, String valore) throws NotFoundException {
  333.         if(valore!=null) {
  334.             MessaggioDaNotificare tipo = MessaggioDaNotificare.toEnumConstant(valore, false);
  335.             if(tipo!=null) {
  336.                 config.setMessaggioDaNotificare(tipo);
  337.             }
  338.         }
  339.     }
  340.     private static void setMultiDeliverNotificheGestioneIniettaContestSincronoDaNotificare(ConfigurazioneGestioneConsegnaNotifiche config, String valore) throws NotFoundException {
  341.         if(valore!=null) {
  342.             config.setInjectTransactionSyncContext("true".equals(valore));
  343.         }
  344.     }
  345.     private static void setMultiDeliverNotificheGestioneTipoHttpNotifica(ConfigurazioneGestioneConsegnaNotifiche config, String valore) {
  346.         if(valore!=null) {
  347.             HttpRequestMethod tipoHttp = null;
  348.             if(!Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_HTTP_NOTIFICA_USA_QUELLO_DELLA_RICHIESTA.equals(valore)) {
  349.                 try {
  350.                     tipoHttp = HttpRequestMethod.valueOf(valore.toUpperCase());
  351.                 }catch(Exception e) {
  352.                     // ignore
  353.                 }
  354.             }
  355.             if(tipoHttp!=null) {
  356.                 config.setHttpMethod(tipoHttp);
  357.             }
  358.         }
  359.     }

  360.     public static void save(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) throws BehaviourException {
  361.        
  362.         if(pasa==null || pasa.getDatiConnettore()==null) {
  363.             throw new BehaviourException("Configurazione behaviour non disponibile");
  364.         }
  365.         if(configurazione==null) {
  366.             throw new BehaviourException("Configurazione condizionale non fornita");
  367.         }
  368.        
  369.         if(configurazione.getCadenzaRispedizione()!=null) {
  370.             BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_CADENZA, configurazione.getCadenzaRispedizione().intValue()+"");
  371.         } else {
  372.             BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_CADENZA);
  373.         }
  374.        
  375.         if(configurazione.getGestioneTrasporto2xx()!=null) {
  376.             save2xx(pasa, configurazione);
  377.         }
  378.        
  379.         if(configurazione.getGestioneTrasporto3xx()!=null) {
  380.             save3xx(pasa, configurazione);
  381.         }
  382.        
  383.         if(configurazione.getGestioneTrasporto4xx()!=null) {
  384.             save4xx(pasa, configurazione);
  385.         }
  386.        
  387.         if(configurazione.getGestioneTrasporto5xx()!=null) {
  388.             save5xx(pasa, configurazione);
  389.         }
  390.        
  391.         if(configurazione.getFault()!=null) {
  392.             saveFault(pasa, configurazione);
  393.         }
  394.        
  395.         if(configurazione.getMessaggioDaNotificare()!=null) {
  396.             BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_MESSAGGIO_DA_NOTIFICARE, configurazione.getMessaggioDaNotificare().getValue());
  397.         }else {
  398.             BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_MESSAGGIO_DA_NOTIFICARE);
  399.         }
  400.        
  401.         if(configurazione.isInjectTransactionSyncContext()) {
  402.             BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_INIETTA_CONTESTO_SINCRONO, "true");
  403.         }
  404.         else {
  405.             BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_INIETTA_CONTESTO_SINCRONO);
  406.         }
  407.        
  408.         if(configurazione.getHttpMethod()!=null) {
  409.             BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_HTTP_NOTIFICA, configurazione.getHttpMethod().name());
  410.         }else {
  411.             BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_TIPO_HTTP_NOTIFICA);
  412.         }
  413.     }
  414.     private static void save2xx(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) throws BehaviourException {
  415.         BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX, configurazione.getGestioneTrasporto2xx().getValue());
  416.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_LEFT_INTERVAL);
  417.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_RIGHT_INTERVAL);
  418.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_CODE_LIST);
  419.         switch (configurazione.getGestioneTrasporto2xx()) {
  420.         case CONSEGNA_COMPLETATA:
  421.         case CONSEGNA_FALLITA:
  422.             break;
  423.         case INTERVALLO_CONSEGNA_COMPLETATA:
  424.             if(configurazione.getGestioneTrasporto2xx_leftInterval()!=null) {
  425.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_LEFT_INTERVAL, configurazione.getGestioneTrasporto2xx_leftInterval().intValue()+"");
  426.             }
  427.             else {
  428.                 throw new BehaviourException("[2xx] Left Interval undefined");
  429.             }
  430.             if(configurazione.getGestioneTrasporto2xx_rightInterval()!=null) {
  431.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_RIGHT_INTERVAL, configurazione.getGestioneTrasporto2xx_rightInterval().intValue()+"");
  432.             }
  433.             else {
  434.                 throw new BehaviourException("[2xx] Right Interval undefined");
  435.             }
  436.             break;
  437.         case CODICI_CONSEGNA_COMPLETATA:
  438.             if(configurazione.getGestioneTrasporto2xx_codes()!=null && !configurazione.getGestioneTrasporto2xx_codes().isEmpty()) {
  439.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_2XX_CODE_LIST,
  440.                         convertAsStringValue(configurazione.getGestioneTrasporto2xx_codes()));
  441.             }
  442.             else {
  443.                 throw new BehaviourException("[2xx] Code undefined");
  444.             }
  445.             break;
  446.         }
  447.     }
  448.     private static void save3xx(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) throws BehaviourException {
  449.         BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX, configurazione.getGestioneTrasporto3xx().getValue());
  450.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_LEFT_INTERVAL);
  451.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_RIGHT_INTERVAL);
  452.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_CODE_LIST);
  453.        
  454.         switch (configurazione.getGestioneTrasporto3xx()) {
  455.         case CONSEGNA_COMPLETATA:
  456.         case CONSEGNA_FALLITA:
  457.             break;
  458.         case INTERVALLO_CONSEGNA_COMPLETATA:
  459.             if(configurazione.getGestioneTrasporto3xx_leftInterval()!=null) {
  460.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_LEFT_INTERVAL, configurazione.getGestioneTrasporto3xx_leftInterval().intValue()+"");
  461.             }
  462.             else {
  463.                 throw new BehaviourException("[3xx] Left Interval undefined");
  464.             }
  465.             if(configurazione.getGestioneTrasporto3xx_rightInterval()!=null) {
  466.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_RIGHT_INTERVAL, configurazione.getGestioneTrasporto3xx_rightInterval().intValue()+"");
  467.             }
  468.             else {
  469.                 throw new BehaviourException("[3xx] Right Interval undefined");
  470.             }
  471.             break;
  472.         case CODICI_CONSEGNA_COMPLETATA:
  473.             if(configurazione.getGestioneTrasporto3xx_codes()!=null && !configurazione.getGestioneTrasporto3xx_codes().isEmpty()) {
  474.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_3XX_CODE_LIST,
  475.                         convertAsStringValue(configurazione.getGestioneTrasporto3xx_codes()));
  476.             }
  477.             else {
  478.                 throw new BehaviourException("[3xx] Code undefined");
  479.             }
  480.             break;
  481.         }
  482.     }
  483.     private static void save4xx(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) throws BehaviourException {
  484.         BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX, configurazione.getGestioneTrasporto4xx().getValue());
  485.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_LEFT_INTERVAL);
  486.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_RIGHT_INTERVAL);
  487.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_CODE_LIST);
  488.        
  489.         switch (configurazione.getGestioneTrasporto4xx()) {
  490.         case CONSEGNA_COMPLETATA:
  491.         case CONSEGNA_FALLITA:
  492.             break;
  493.         case INTERVALLO_CONSEGNA_COMPLETATA:
  494.             if(configurazione.getGestioneTrasporto4xx_leftInterval()!=null) {
  495.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_LEFT_INTERVAL, configurazione.getGestioneTrasporto4xx_leftInterval().intValue()+"");
  496.             }
  497.             else {
  498.                 throw new BehaviourException("[4xx] Left Interval undefined");
  499.             }
  500.             if(configurazione.getGestioneTrasporto4xx_rightInterval()!=null) {
  501.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_RIGHT_INTERVAL, configurazione.getGestioneTrasporto4xx_rightInterval().intValue()+"");
  502.             }
  503.             else {
  504.                 throw new BehaviourException("[4xx] Right Interval undefined");
  505.             }
  506.             break;
  507.         case CODICI_CONSEGNA_COMPLETATA:
  508.             if(configurazione.getGestioneTrasporto4xx_codes()!=null && !configurazione.getGestioneTrasporto4xx_codes().isEmpty()) {
  509.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_4XX_CODE_LIST,
  510.                         convertAsStringValue(configurazione.getGestioneTrasporto4xx_codes()));
  511.             }
  512.             else {
  513.                 throw new BehaviourException("[4xx] Code undefined");
  514.             }
  515.             break;
  516.         }
  517.     }
  518.     private static void save5xx(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) throws BehaviourException {
  519.         BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX, configurazione.getGestioneTrasporto5xx().getValue());
  520.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_LEFT_INTERVAL);
  521.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_RIGHT_INTERVAL);
  522.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_CODE_LIST);
  523.        
  524.         switch (configurazione.getGestioneTrasporto5xx()) {
  525.         case CONSEGNA_COMPLETATA:
  526.         case CONSEGNA_FALLITA:
  527.             break;
  528.         case INTERVALLO_CONSEGNA_COMPLETATA:
  529.             if(configurazione.getGestioneTrasporto5xx_leftInterval()!=null) {
  530.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_LEFT_INTERVAL, configurazione.getGestioneTrasporto5xx_leftInterval().intValue()+"");
  531.             }
  532.             else {
  533.                 throw new BehaviourException("[5xx] Left Interval undefined");
  534.             }
  535.             if(configurazione.getGestioneTrasporto5xx_rightInterval()!=null) {
  536.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_RIGHT_INTERVAL, configurazione.getGestioneTrasporto5xx_rightInterval().intValue()+"");
  537.             }
  538.             else {
  539.                 throw new BehaviourException("[5xx] Right Interval undefined");
  540.             }
  541.             break;
  542.         case CODICI_CONSEGNA_COMPLETATA:
  543.             if(configurazione.getGestioneTrasporto5xx_codes()!=null && !configurazione.getGestioneTrasporto5xx_codes().isEmpty()) {
  544.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_TRASPORTO_5XX_CODE_LIST,
  545.                         convertAsStringValue(configurazione.getGestioneTrasporto5xx_codes()));
  546.             }
  547.             else {
  548.                 throw new BehaviourException("[5xx] Code undefined");
  549.             }
  550.             break;
  551.         }
  552.     }
  553.     private static void saveFault(PortaApplicativaServizioApplicativo pasa, ConfigurazioneGestioneConsegnaNotifiche configurazione) {
  554.         BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT, configurazione.getFault().getValue());
  555.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_CODE);
  556.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_ACTOR);
  557.         BehaviourPropertiesUtils.removeProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_MESSAGE);
  558.        
  559.         switch (configurazione.getFault()) {
  560.         case CONSEGNA_COMPLETATA:
  561.         case CONSEGNA_FALLITA:
  562.             break;
  563.         case CONSEGNA_COMPLETATA_PERSONALIZZATA:
  564.         case CONSEGNA_FALLITA_PERSONALIZZATA:
  565.             if(configurazione.getFaultCode()!=null) {
  566.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_CODE, configurazione.getFaultCode());
  567.             }
  568.             if(configurazione.getFaultActor()!=null) {
  569.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_ACTOR, configurazione.getFaultActor());
  570.             }
  571.             if(configurazione.getFaultMessage()!=null) {
  572.                 BehaviourPropertiesUtils.addProprieta(pasa.getDatiConnettore(),Costanti.MULTI_DELIVER_NOTIFICHE_GESTIONE_ERRORE_TIPO_GESTIONE_FAULT_MESSAGE, configurazione.getFaultMessage());
  573.             }
  574.             break;
  575.         }
  576.     }
  577.     private static String convertAsStringValue(List<Integer> codes) {
  578.         StringBuilder bf = new StringBuilder();
  579.         for (Integer code : codes) {
  580.             if(bf.length()>0) {
  581.                 bf.append(",");
  582.             }
  583.             bf.append(code);
  584.         }
  585.         return bf.toString();
  586.     }
  587.    

  588.    
  589.     public static MessaggioDaNotificare readMessaggiNotificabili(PortaApplicativa pa, List<String> serviziApplicativiAbilitatiForwardTo) throws BehaviourException {
  590.         BooleanNullable richiesta = BooleanNullable.NULL();
  591.         BooleanNullable risposta = BooleanNullable.NULL();
  592.         if(serviziApplicativiAbilitatiForwardTo!=null && !serviziApplicativiAbilitatiForwardTo.isEmpty()) {
  593.             for (PortaApplicativaServizioApplicativo pasa : pa.getServizioApplicativoList()) {
  594.                 if(serviziApplicativiAbilitatiForwardTo.contains(pasa.getNome())) {
  595.                     readMessaggioDaNotificare(pasa, richiesta, risposta);
  596.                     if(richiesta.getValue()!=null && richiesta.getValue().booleanValue() &&
  597.                             risposta.getValue()!=null && risposta.getValue().booleanValue()) {
  598.                         // trovati entrambi, e' inutile che continuo ad analizzare
  599.                         break;
  600.                     }
  601.                 }
  602.             }
  603.         }
  604.         return convertToMessaggioDaNotificare(richiesta, risposta);
  605.     }
  606.     private static void readMessaggioDaNotificare(PortaApplicativaServizioApplicativo pasa,
  607.             BooleanNullable richiesta, BooleanNullable risposta) throws BehaviourException {
  608.         ConfigurazioneGestioneConsegnaNotifiche config = MultiDeliverUtils.read(pasa);
  609.         if(config!=null) {
  610.             MessaggioDaNotificare check = config.getMessaggioDaNotificare();
  611.             if(check!=null) {
  612.                 switch (check) {
  613.                 case RICHIESTA:
  614.                     richiesta.setValue(true);
  615.                     break;
  616.                 case RISPOSTA:
  617.                     risposta.setValue(true);
  618.                     break;
  619.                 case ENTRAMBI:
  620.                     richiesta.setValue(true);
  621.                     risposta.setValue(true);
  622.                     break;
  623.                 }
  624.             }
  625.             else {
  626.                 // default: richiesta
  627.                 richiesta.setValue(true);
  628.             }
  629.         }
  630.     }
  631.     private static MessaggioDaNotificare convertToMessaggioDaNotificare(BooleanNullable richiesta, BooleanNullable risposta) {
  632.         MessaggioDaNotificare tipiMessaggiNotificabili = null;
  633.         if(richiesta.getValue()!=null && richiesta.getValue().booleanValue() &&
  634.                 risposta.getValue()!=null && risposta.getValue().booleanValue()) {
  635.             tipiMessaggiNotificabili = MessaggioDaNotificare.ENTRAMBI;
  636.         }
  637.         else if(risposta.getValue()!=null && risposta.getValue().booleanValue()) {
  638.             tipiMessaggiNotificabili = MessaggioDaNotificare.RISPOSTA;
  639.         }
  640.         else if(richiesta.getValue()!=null && richiesta.getValue().booleanValue()) {
  641.             tipiMessaggiNotificabili = MessaggioDaNotificare.RICHIESTA;
  642.         }
  643.         return tipiMessaggiNotificabili;
  644.     }
  645.    
  646.     public static boolean isSaveTransactionContext(PortaApplicativa pa, List<String> serviziApplicativiAbilitatiForwardTo) throws BehaviourException {
  647.         if(serviziApplicativiAbilitatiForwardTo!=null && !serviziApplicativiAbilitatiForwardTo.isEmpty()) {
  648.             for (PortaApplicativaServizioApplicativo pasa : pa.getServizioApplicativoList()) {
  649.                 if(serviziApplicativiAbilitatiForwardTo.contains(pasa.getNome())) {
  650.                     ConfigurazioneGestioneConsegnaNotifiche config = MultiDeliverUtils.read(pasa);
  651.                     if(config!=null && config.isInjectTransactionSyncContext()) {
  652.                         return true;
  653.                     }
  654.                 }
  655.             }
  656.         }
  657.         return false;
  658.     }
  659. }