ServizioApplicativoBustaBehaviour.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;

  21. import org.openspcoop2.core.config.PortaApplicativa;
  22. import org.openspcoop2.core.id.IDServizioApplicativo;
  23. import org.openspcoop2.core.id.IDSoggetto;
  24. import org.openspcoop2.pdd.core.AbstractCore;
  25. import org.openspcoop2.pdd.core.GestoreMessaggi;
  26. import org.openspcoop2.pdd.core.behaviour.Behaviour;
  27. import org.openspcoop2.pdd.core.behaviour.BehaviourEmitDiagnosticException;
  28. import org.openspcoop2.pdd.core.behaviour.BehaviourException;
  29. import org.openspcoop2.pdd.core.behaviour.BehaviourForwardTo;
  30. import org.openspcoop2.pdd.core.behaviour.BehaviourForwardToFilter;
  31. import org.openspcoop2.pdd.core.behaviour.IBehaviour;
  32. import org.openspcoop2.protocol.sdk.Busta;
  33. import org.openspcoop2.protocol.sdk.state.RequestInfo;

  34. /**
  35.  * ServizioApplicativoBustaBehaviour
  36.  *
  37.  * @author Andrea Poli (apoli@link.it)
  38.  * @author $Author$
  39.  * @version $Rev$, $Date$
  40.  */
  41. public class ServizioApplicativoBustaBehaviour extends AbstractCore implements IBehaviour {

  42.     @Override
  43.     public Behaviour behaviour(GestoreMessaggi gestoreMessaggioRichiesta, Busta busta,
  44.             PortaApplicativa pa, RequestInfo requestInfo) throws BehaviourException,BehaviourEmitDiagnosticException {
  45.         try{
  46.             Behaviour behaviour = new Behaviour();
  47.             BehaviourForwardTo forwardTo = new BehaviourForwardTo();
  48.            
  49.             BehaviourForwardToFilter filter = new BehaviourForwardToFilter();
  50.             IDServizioApplicativo id = new IDServizioApplicativo();
  51.             id.setIdSoggettoProprietario(new IDSoggetto(busta.getTipoDestinatario(),busta.getDestinatario()));
  52.             id.setNome(busta.getServizioApplicativoErogatore());
  53.             filter.getAccessListServiziApplicativi().add(id);
  54.             forwardTo.setFilter(filter);
  55.            
  56.             behaviour.getForwardTo().add(forwardTo);
  57.             return behaviour;
  58.         }catch(Exception e){
  59.             throw new BehaviourException(e.getMessage(),e);
  60.         }
  61.        
  62.     }

  63. }