ConfigurazioneMultiDeliver.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.ArrayList;
  22. import java.util.List;

  23. import org.openspcoop2.protocol.sdk.ProtocolException;
  24. import org.openspcoop2.protocol.utils.EsitiProperties;

  25. /**
  26.  * MultiDeliverBehaviour
  27.  *
  28.  * @author Andrea Poli (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class ConfigurazioneMultiDeliver {

  33.     private String transazioneSincrona_nomeConnettore;
  34.    
  35.     private boolean notificheByEsito = true;
  36.     private boolean notificheByEsito_ok = true;
  37.     private boolean notificheByEsito_fault = true;
  38.     private boolean notificheByEsito_erroriConsegna = false;
  39.     private boolean notificheByEsito_erroriProcessamento = false;
  40.     // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  41.     //private boolean notificheByEsito_richiesteScartate = false;
  42.     private List<Integer> initTransazioneSincrona_esitiPerSpedireNotifiche;
  43.    
  44.     public List<Integer> getTransazioneSincrona_esitiPerSpedireNotifiche(EsitiProperties esitiProperties) throws ProtocolException {
  45.         if(this.initTransazioneSincrona_esitiPerSpedireNotifiche==null) {
  46.             initTransazioneSincrona_esitiPerSpedireNotifiche(esitiProperties);
  47.         }
  48.         return this.initTransazioneSincrona_esitiPerSpedireNotifiche;
  49.     }
  50.     private synchronized List<Integer> initTransazioneSincrona_esitiPerSpedireNotifiche(EsitiProperties esitiProperties) throws ProtocolException {
  51.         if(this.initTransazioneSincrona_esitiPerSpedireNotifiche==null) {
  52.             this.initTransazioneSincrona_esitiPerSpedireNotifiche = new ArrayList<Integer>();
  53.             if(!this.notificheByEsito) {
  54.                 this.initTransazioneSincrona_esitiPerSpedireNotifiche = esitiProperties.getEsitiCode();
  55.             }
  56.             else {
  57.                 if(this.notificheByEsito_ok) {
  58.                     this.initTransazioneSincrona_esitiPerSpedireNotifiche.addAll(esitiProperties.getEsitiCodeOk_senzaFaultApplicativo());
  59.                 }
  60.                 if(this.notificheByEsito_fault) {
  61.                     this.initTransazioneSincrona_esitiPerSpedireNotifiche.addAll(esitiProperties.getEsitiCodeFaultApplicativo());
  62.                 }
  63.                 if(this.notificheByEsito_erroriConsegna) {
  64.                     this.initTransazioneSincrona_esitiPerSpedireNotifiche.addAll(esitiProperties.getEsitiCodeErroriConsegna());
  65.                 }
  66.                 // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  67. //              if(this.notificheByEsito_richiesteScartate) {
  68. //                  this.initTransazioneSincrona_esitiPerSpedireNotifiche.addAll(esitiProperties.getEsitiCodeRichiestaScartate());
  69. //              }
  70.                 if(this.notificheByEsito_erroriProcessamento) {
  71.                     List<Integer> esitiFallite = esitiProperties.getEsitiCodeKo();
  72.                     List<Integer> esitiConsegna = esitiProperties.getEsitiCodeErroriConsegna();
  73.                     // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  74.                     //List<Integer> richiesteScartate = esitiProperties.getEsitiCodeRichiestaScartate();
  75.                     for (Integer e : esitiFallite) {
  76.                         boolean foundInConsegna = false;
  77.                         for (Integer eConsegna : esitiConsegna) {
  78.                             if(eConsegna.intValue() == e.intValue()) {
  79.                                 foundInConsegna = true;
  80.                                 break;
  81.                             }
  82.                         }
  83.                         if(foundInConsegna) {
  84.                             continue;
  85.                         }
  86.                         // le richieste scartate non arrivano alla gestione della consegna in smistatore e quindi non potranno nemmeno essere notifiate
  87.                         /*boolean foundInRichiesteScartate = false;
  88.                         for (Integer eRichiestaScartata : richiesteScartate) {
  89.                             if(eRichiestaScartata.intValue() == e.intValue()) {
  90.                                 foundInRichiesteScartate = true;
  91.                                 break;
  92.                             }
  93.                         }
  94.                         if(foundInRichiesteScartate) {
  95.                             continue;
  96.                         }*/
  97.                         this.initTransazioneSincrona_esitiPerSpedireNotifiche.add(e);
  98.                     }
  99.                 }
  100.             }
  101.         }
  102.         return this.initTransazioneSincrona_esitiPerSpedireNotifiche;
  103.     }

  104.     public String getTransazioneSincrona_nomeConnettore() {
  105.         return this.transazioneSincrona_nomeConnettore;
  106.     }

  107.     public void setTransazioneSincrona_nomeConnettore(String transazioneSincrona_nomeConnettore) {
  108.         this.transazioneSincrona_nomeConnettore = transazioneSincrona_nomeConnettore;
  109.     }
  110.        
  111.     public boolean isNotificheByEsito() {
  112.         return this.notificheByEsito;
  113.     }

  114.     public void setNotificheByEsito(boolean notificheByEsito) {
  115.         this.notificheByEsito = notificheByEsito;
  116.     }

  117.     public boolean isNotificheByEsito_ok() {
  118.         return this.notificheByEsito_ok;
  119.     }

  120.     public void setNotificheByEsito_ok(boolean notificheByEsito_ok) {
  121.         this.notificheByEsito_ok = notificheByEsito_ok;
  122.     }

  123.     public boolean isNotificheByEsito_fault() {
  124.         return this.notificheByEsito_fault;
  125.     }

  126.     public void setNotificheByEsito_fault(boolean notificheByEsito_fault) {
  127.         this.notificheByEsito_fault = notificheByEsito_fault;
  128.     }

  129.     public boolean isNotificheByEsito_erroriConsegna() {
  130.         return this.notificheByEsito_erroriConsegna;
  131.     }

  132.     public void setNotificheByEsito_erroriConsegna(boolean notificheByEsito_erroriConsegna) {
  133.         this.notificheByEsito_erroriConsegna = notificheByEsito_erroriConsegna;
  134.     }

  135.     public boolean isNotificheByEsito_erroriProcessamento() {
  136.         return this.notificheByEsito_erroriProcessamento;
  137.     }

  138.     public void setNotificheByEsito_erroriProcessamento(boolean notificheByEsito_erroriProcessamento) {
  139.         this.notificheByEsito_erroriProcessamento = notificheByEsito_erroriProcessamento;
  140.     }

  141.     /*public boolean isNotificheByEsito_richiesteScartate() {
  142.         return this.notificheByEsito_richiesteScartate;
  143.     }

  144.     public void setNotificheByEsito_richiesteScartate(boolean notificheByEsito_richiesteScartate) {
  145.         this.notificheByEsito_richiesteScartate = notificheByEsito_richiesteScartate;
  146.     }*/
  147. }