ModIProtocolConfiguration.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.protocol.modipa.config;

  21. import java.util.List;

  22. import org.openspcoop2.core.constants.TipoPdD;
  23. import org.openspcoop2.message.constants.ServiceBinding;
  24. import org.openspcoop2.protocol.basic.config.BasicConfiguration;
  25. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  26. import org.openspcoop2.protocol.sdk.ProtocolException;
  27. import org.openspcoop2.protocol.sdk.constants.FunzionalitaProtocollo;
  28. import org.openspcoop2.utils.certificate.remote.RemoteStoreConfig;

  29. /**
  30.  * Classe che implementa, in base al protocollo ModI, l'interfaccia {@link org.openspcoop2.protocol.sdk.config.IProtocolConfiguration}
  31.  *
  32.  * @author Poli Andrea (apoli@link.it)
  33.  * @author $Author$
  34.  * @version $Rev$, $Date$
  35.  */
  36. public class ModIProtocolConfiguration extends BasicConfiguration {

  37.     private ModIProperties properties;
  38.    
  39.     public ModIProtocolConfiguration(IProtocolFactory<?> factory) throws ProtocolException {
  40.         super(factory);
  41.         this.properties = ModIProperties.getInstance();
  42.     }
  43.    
  44.     @Override
  45.     public boolean isIntegrationInfoRequired(TipoPdD tipoPdD, ServiceBinding serviceBinding, FunzionalitaProtocollo funzionalitaProtocollo) throws ProtocolException{
  46.        
  47.         if (FunzionalitaProtocollo.RIFERIMENTO_ID_RICHIESTA.equals(funzionalitaProtocollo)){
  48.             if(TipoPdD.DELEGATA.equals(tipoPdD)) {
  49.                 return this.properties.isRiferimentoIDRichiestaPortaDelegataRequired();
  50.             }
  51.             else {
  52.                 return this.properties.isRiferimentoIDRichiestaPortaApplicativaRequired();
  53.             }
  54.         }
  55.         else {
  56.             return super.isIntegrationInfoRequired(tipoPdD, serviceBinding, funzionalitaProtocollo);
  57.         }
  58.        
  59.     }
  60.    
  61.     @Override
  62.     public boolean isAbilitataGenerazioneTracce() {
  63.         if(this.properties.isGenerazioneTracce()!=null && this.properties.isGenerazioneTracce().booleanValue()) {
  64.             return true;
  65.         }
  66.         return super.isAbilitataGenerazioneTracce();
  67.     }
  68.    
  69.     @Override
  70.     public boolean isAbilitatoSalvataggioHeaderProtocolloTracce() {
  71.         return this.properties.isGenerazioneTracceRegistraToken();
  72.     }
  73.    
  74.     @Override
  75.     public boolean isSupportato(ServiceBinding serviceBinding, FunzionalitaProtocollo funzionalitaProtocollo)
  76.             throws ProtocolException {
  77.         if(funzionalitaProtocollo==null || serviceBinding==null){
  78.             throw new ProtocolException("Params not defined");
  79.         }
  80.         if(FunzionalitaProtocollo.FILTRO_DUPLICATI.equals(funzionalitaProtocollo)) {
  81.             return true;
  82.         }
  83.         else {
  84.             return super.isSupportato(serviceBinding, funzionalitaProtocollo);
  85.         }
  86.     }
  87.    
  88.     @Override
  89.     public boolean isDataPresenteInIdentificativoMessaggio() {
  90.         return !this.properties.generateIDasUUID();
  91.     }
  92.    
  93.     @Override
  94.     public List<RemoteStoreConfig> getRemoteStoreConfig() throws ProtocolException{
  95.         return this.properties.getRemoteStoreConfig();
  96.     }
  97. }