AutorizzazioneContenutoBusteOK.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.autorizzazione.pa;

  21. import java.io.ByteArrayOutputStream;

  22. import org.openspcoop2.message.OpenSPCoop2Message;
  23. import org.openspcoop2.pdd.core.autorizzazione.AutorizzazioneException;
  24. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;

  25. /**
  26.  * Esempio di AutorizzazioneContenutoBusteOK
  27.  *
  28.  * @author Andrea Poli (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */

  32. public class AutorizzazioneContenutoBusteOK extends AbstractAutorizzazioneContenutoBase {

  33.     @Override
  34.     public EsitoAutorizzazionePortaApplicativa process(DatiInvocazionePortaApplicativa datiInvocazione, OpenSPCoop2Message msg) throws AutorizzazioneException {
  35.        
  36.         EsitoAutorizzazionePortaApplicativa esito = new EsitoAutorizzazionePortaApplicativa();
  37.        
  38.         // Autorizzazzione servizio applicativo
  39.         try{
  40.            
  41.             ByteArrayOutputStream bout = new ByteArrayOutputStream();
  42.             msg.writeTo(bout, false);
  43.             bout.flush();
  44.             bout.close();
  45.            
  46.             System.out.println("(TestOK) Messaggio ricevuto (Ruolo busta: "+datiInvocazione.getRuoloBusta().toString()+"): "+bout.toString());
  47.            
  48.             esito.setAutorizzato(true);
  49.             return esito;
  50.            
  51.         }catch(Exception e){
  52.             esito.setEccezioneProcessamento(e);
  53.             OpenSPCoop2Logger.getLoggerOpenSPCoopCore().error("Autorizzazione per contenuto buste non riuscita",e);
  54.             throw new AutorizzazioneException("Errore di processamento durante l'autorizzazione per contenuto buste: "+e.getMessage(),e);
  55.         }
  56.     }

  57.    
  58.    
  59. }