IntegrationManagerMessage.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.services.skeleton;

  21. import java.io.ByteArrayOutputStream;

  22. import org.openspcoop2.message.OpenSPCoop2Message;


  23. /**
  24.  * <p>Java class for IntegrationManagerMessage complex type.
  25.  *
  26.  * <p>The following schema fragment specifies the expected content contained within this class.
  27.  *
  28.  * <pre>
  29.  * &lt;complexType name="IntegrationManagerMessage">
  30.  *   &lt;complexContent>
  31.  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  32.  *       &lt;sequence>
  33.  *         &lt;element name="IDApplicativo" type="{http://www.w3.org/2001/XMLSchema}string"/>
  34.  *         &lt;element name="imbustamento" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
  35.  *         &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
  36.  *         &lt;element name="servizioApplicativo" type="{http://www.w3.org/2001/XMLSchema}string"/>
  37.  *         &lt;element name="protocolHeaderInfo" type="{http://services.pdd.openspcoop2.org}ProtocolHeaderInfo"/>
  38.  *       &lt;/sequence>
  39.  *     &lt;/restriction>
  40.  *   &lt;/complexContent>
  41.  * &lt;/complexType>
  42.  * </pre>
  43.  *
  44.  *
  45.  */

  46. /**
  47.  * Classe utilizzata per raccogliere il contenuto applicativo da ritornare
  48.  * ai servizi applicativi che utilizzano il servizio Gop.
  49.  *
  50.  * @author Lo Votrico Fabio (fabio@link.it)
  51.  * @author Poli Andrea (apoli@link.i
  52.  * @author Tronci Fabio (tronci@link.it)
  53.  * @author Nardi Lorenzo (nardi@link.it)
  54.  * @author $Author$
  55.  * @version $Rev$, $Date$
  56.  */

  57. @javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.FIELD)
  58. @javax.xml.bind.annotation.XmlType(name = "IntegrationManagerMessage", propOrder = {
  59.     "idApplicativo",
  60.     "imbustamento",
  61.     "message",
  62.     "servizioApplicativo",
  63.     "protocolHeaderInfo"
  64. })
  65. public class IntegrationManagerMessage implements java.io.Serializable{

  66.     @javax.xml.bind.annotation.XmlElement(name = "IDApplicativo", required = true, nillable = true)
  67.     protected String idApplicativo;
  68.    
  69.     protected boolean imbustamento;
  70.     @javax.xml.bind.annotation.XmlElement(required = true, nillable = true)
  71.     protected byte[] message;
  72.     @javax.xml.bind.annotation.XmlElement(required = true, nillable = true)
  73.     protected String servizioApplicativo;
  74.     @javax.xml.bind.annotation.XmlElement(required = true, nillable = true)
  75.     protected ProtocolHeaderInfo protocolHeaderInfo;

  76.     /**
  77.      * SerialUID
  78.      */
  79.     private static final long serialVersionUID = 1L;


  80.     /* ********  C O S T R U T T O R E  ******** */

  81.     /**
  82.      * Costruttore.
  83.      *
  84.      * @param m Messaggio Applicativo
  85.      * @param imbustamento Indicazione se il messaggio applicativo deve essere imbustato o meno
  86.      * @param protocol Informazioni presenti nella busta
  87.      *
  88.      */    
  89.     public IntegrationManagerMessage(byte[] m,boolean imbustamento,ProtocolHeaderInfo protocol) throws Exception{
  90.         this.message = m;
  91.         this.imbustamento = imbustamento;
  92.         this.protocolHeaderInfo = protocol;
  93.     }
  94.     /**
  95.      * Costruttore.
  96.      *
  97.      * @param m Messaggio Applicativo
  98.      * @param imbustamento Indicazione se il messaggio applicativo deve essere imbustato o meno
  99.      *
  100.      */    
  101.     public IntegrationManagerMessage(byte[] m,boolean imbustamento) throws Exception{
  102.         this(m,imbustamento,null);
  103.     }
  104.     /**
  105.      * Costruttore.
  106.      *
  107.      * @param m Messaggio Applicativo
  108.      * @param imbustamento Indicazione se il messaggio applicativo deve essere imbustato o meno
  109.      * @param protocol Informazioni presenti nella busta
  110.      *
  111.      */    
  112.     public IntegrationManagerMessage(OpenSPCoop2Message m,boolean imbustamento,ProtocolHeaderInfo protocol) throws Exception{
  113.         ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
  114.         m.writeTo(byteBuffer, true);
  115.         this.message = byteBuffer.toByteArray();
  116.         byteBuffer.close();
  117.         this.imbustamento = imbustamento;
  118.         this.protocolHeaderInfo = protocol;
  119.     }
  120.     /**
  121.      * Costruttore.
  122.      *
  123.      * @param m Messaggio Applicativo
  124.      * @param imbustamento Indicazione se il messaggio applicativo deve essere imbustato o meno
  125.      *
  126.      */    
  127.     public IntegrationManagerMessage(OpenSPCoop2Message m,boolean imbustamento) throws Exception{
  128.         this(m,true,null);
  129.     }
  130.     /**
  131.      * Costruttore.
  132.      *
  133.      *
  134.      */  
  135.     public IntegrationManagerMessage(){
  136.         this.message = null;
  137.         this.imbustamento = false;
  138.     }
  139.    
  140.    





  141.     /* ********  S E T T E R   ******** */

  142.     /**
  143.      * Imposta il messaggio applicativo
  144.      *
  145.      * @param m Messaggio Applicativo
  146.      *
  147.      */
  148.     public void setMessage(OpenSPCoop2Message m) throws Exception{
  149.         ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
  150.         m.writeTo(byteBuffer,true);
  151.         this.message = byteBuffer.toByteArray();
  152.         byteBuffer.close();
  153.     }
  154.     /**
  155.      * Imposta il messaggio applicativo
  156.      *
  157.      * @param m Messaggio Applicativo
  158.      *
  159.      */
  160.     public void setMessage(byte [] m) {
  161.         this.message = m;
  162.     }
  163.    



  164.     /* ********  G E T T E R   ******** */

  165.     /**
  166.      * Ritorna il messaggio applicativo
  167.      *
  168.      * @return Messaggio Applicativo
  169.      *
  170.      */
  171.     public byte[] getMessage(){
  172.         return this.message;
  173.     }
  174.    





  175.     /**
  176.      * Ritorna l'indicazione se il messaggio applicativo deve essere imbustato o meno
  177.      *
  178.      * @return l'indicazione se il messaggio applicativo deve essere imbustato o meno
  179.      */
  180.     public boolean getImbustamento() {
  181.         return this.imbustamento;
  182.     }


  183.     /**
  184.      * Imposta l'indicazione se il messaggio applicativo deve essere imbustato o meno
  185.      *
  186.      * @param imbustamento indicazione se il messaggio applicativo deve essere imbustato o meno
  187.      */
  188.     public void setImbustamento(boolean imbustamento) {
  189.         this.imbustamento = imbustamento;
  190.     }
  191.     /**
  192.      * ID Applicativo per correlazione applicativa
  193.      *
  194.      * @return the iDApplicativo
  195.      */
  196.     public String getIdApplicativo() {
  197.         return this.idApplicativo;
  198.     }
  199.     /**
  200.      * ID Applicativo per correlazione applicativa
  201.      *
  202.      * @param applicativo the iDApplicativo to set
  203.      */
  204.     public void setIdApplicativo(String applicativo) {
  205.         this.idApplicativo = applicativo;
  206.     }
  207.     /**
  208.      * Servizio Applicativo
  209.      *
  210.      * @return the servizioApplicativo
  211.      */
  212.     public String getServizioApplicativo() {
  213.         return this.servizioApplicativo;
  214.     }
  215.     /**
  216.      * @param servizioApplicativo the servizioApplicativo to set
  217.      */
  218.     public void setServizioApplicativo(String servizioApplicativo) {
  219.         this.servizioApplicativo = servizioApplicativo;
  220.     }
  221.     /**
  222.      * header info
  223.      *
  224.      * @return the protocolHeaderInfo
  225.      */
  226.     public ProtocolHeaderInfo getProtocolHeaderInfo() {
  227.         return this.protocolHeaderInfo;
  228.     }
  229.     /**
  230.      * header info
  231.      *
  232.      * @param headerInfo the protocolHeaderInfo to set
  233.      */
  234.     public void setProtocolHeaderInfo(ProtocolHeaderInfo headerInfo) {
  235.         this.protocolHeaderInfo = headerInfo;
  236.     }
  237. }