GestoreIntegrazionePATemplate.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.integrazione;

  21. import org.openspcoop2.pdd.core.AbstractCore;
  22. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;



  23. /**
  24.  * Classe utilizzata per avere una trasformazione
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class GestoreIntegrazionePATemplate extends AbstractCore implements IGestoreIntegrazionePA{

  31.     private boolean transformRequest = true;
  32.     private boolean transformResponse = true;
  33.    
  34.     protected GestoreIntegrazionePATemplate( boolean transformRequest, boolean transformResponse ){
  35.         this.transformRequest = transformRequest;
  36.         this.transformResponse = transformResponse;
  37.     }
  38.     public GestoreIntegrazionePATemplate(){
  39.     }
  40.    
  41.    
  42.     // IN - Request
  43.    
  44.     @Override
  45.     public void readInRequestHeader(HeaderIntegrazione integrazione,
  46.             InRequestPAMessage inRequestPAMessage) throws HeaderIntegrazioneException {
  47.         // nop
  48.     }
  49.    
  50.     // OUT - Request
  51.    
  52.     @Override
  53.     public void setOutRequestHeader(HeaderIntegrazione integrazione,
  54.             OutRequestPAMessage outRequestPAMessage) throws HeaderIntegrazioneException{
  55.         if(this.transformRequest) {
  56.             UtilitiesTemplate utilities = new UtilitiesTemplate("template-request", integrazione, outRequestPAMessage,
  57.                     this.getPddContext(), OpenSPCoop2Logger.getLoggerOpenSPCoopCore());
  58.             utilities.process(true);
  59.         }
  60.     }
  61.    
  62.     // IN - Response
  63.    
  64.     @Override
  65.     public void readInResponseHeader(HeaderIntegrazione integrazione,
  66.             InResponsePAMessage inResponsePAMessage) throws HeaderIntegrazioneException{
  67.         // nop
  68.     }
  69.        
  70.     // OUT - Response

  71.     @Override
  72.     public void setOutResponseHeader(HeaderIntegrazione integrazione,
  73.             OutResponsePAMessage outResponsePAMessage) throws HeaderIntegrazioneException{
  74.         if(this.transformResponse) {
  75.             UtilitiesTemplate utilities = new UtilitiesTemplate("template-response", integrazione, outResponsePAMessage,
  76.                     this.getPddContext(), OpenSPCoop2Logger.getLoggerOpenSPCoopCore());
  77.             utilities.process(false);
  78.         }
  79.     }
  80. }