GestoreIntegrazionePDTemplate.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 GestoreIntegrazionePDTemplate extends AbstractCore implements IGestoreIntegrazionePD{

  31.     private boolean transformRequest = true;
  32.     private boolean transformResponse = true;
  33.    
  34.     protected GestoreIntegrazionePDTemplate( boolean transformRequest, boolean transformResponse ){
  35.         this.transformRequest = transformRequest;
  36.         this.transformResponse = transformResponse;
  37.     }
  38.     public GestoreIntegrazionePDTemplate(){
  39.     }
  40.    

  41.     // IN - Request

  42.     @Override
  43.     public void readInRequestHeader(HeaderIntegrazione integrazione,
  44.             InRequestPDMessage inRequestPDMessage) throws HeaderIntegrazioneException{
  45.         // nop
  46.     }

  47.     // OUT - Request
  48.    
  49.     @Override
  50.     public void setOutRequestHeader(HeaderIntegrazione integrazione,
  51.             OutRequestPDMessage outRequestPDMessage) throws HeaderIntegrazioneException{
  52.         if(this.transformRequest) {
  53.             UtilitiesTemplate utilities = new UtilitiesTemplate("template-request", integrazione, outRequestPDMessage,
  54.                     this.getPddContext(), OpenSPCoop2Logger.getLoggerOpenSPCoopCore());
  55.             utilities.process(true);
  56.         }
  57.     }
  58.    
  59.     // IN - Response
  60.    
  61.     @Override
  62.     public void readInResponseHeader(HeaderIntegrazione integrazione,
  63.             InResponsePDMessage inResponsePDMessage) throws HeaderIntegrazioneException{
  64.         // nop
  65.     }
  66.        
  67.     // OUT - Response

  68.     @Override
  69.     public void setOutResponseHeader(HeaderIntegrazione integrazione,
  70.             OutResponsePDMessage outResponsePDMessage) throws HeaderIntegrazioneException{
  71.         if(this.transformResponse) {
  72.             UtilitiesTemplate utilities = new UtilitiesTemplate("template-response", integrazione, outResponsePDMessage,
  73.                     this.getPddContext(), OpenSPCoop2Logger.getLoggerOpenSPCoopCore());
  74.             utilities.process(false);
  75.         }
  76.     }
  77. }