AbstractSerializer.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.core.diagnostica.utils.serializer;

  21. import org.openspcoop2.generic_project.exception.SerializerException;
  22. import org.openspcoop2.utils.beans.WriteToSerializerType;
  23. import org.openspcoop2.utils.xml.JaxbUtils;

  24. import org.openspcoop2.core.diagnostica.DominioSoggetto;
  25. import org.openspcoop2.core.diagnostica.MessaggioDiagnostico;
  26. import org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici;
  27. import org.openspcoop2.core.diagnostica.DominioDiagnostico;
  28. import org.openspcoop2.core.diagnostica.Proprieta;
  29. import org.openspcoop2.core.diagnostica.Protocollo;

  30. import java.io.ByteArrayOutputStream;
  31. import java.io.FileOutputStream;
  32. import java.io.OutputStream;
  33. import java.io.File;
  34. import java.lang.reflect.Method;

  35. import javax.xml.bind.JAXBElement;

  36. /**    
  37.  * XML Serializer of beans
  38.  *
  39.  * @author Poli Andrea (poli@link.it)
  40.  * @author $Author$
  41.  * @version $Rev$, $Date$
  42.  */
  43. public abstract class AbstractSerializer {


  44.     protected abstract WriteToSerializerType getType();
  45.    
  46.     protected void _objToXml(OutputStream out, Class<?> c, Object object,
  47.             boolean prettyPrint) throws Exception {
  48.         if(object instanceof JAXBElement){
  49.             // solo per il tipo WriteToSerializerType.JAXB
  50.             JaxbUtils.objToXml(out, c, object, prettyPrint);
  51.         }else{
  52.             Method m = c.getMethod("writeTo", OutputStream.class, WriteToSerializerType.class);
  53.             m.invoke(object, out, this.getType());
  54.         }
  55.     }
  56.    
  57.     protected void objToXml(OutputStream out,Class<?> c,Object object,boolean prettyPrint) throws SerializerException{
  58.         try{
  59.             this._objToXml(out, c, object, prettyPrint);
  60.         }catch(Exception e){
  61.             throw new SerializerException(e.getMessage(), e);
  62.         }
  63.         finally{
  64.             try{
  65.                 out.flush();
  66.             }catch(Exception e){
  67.                 // ignore
  68.             }
  69.         }
  70.     }
  71.     protected void objToXml(String fileName,Class<?> c,Object object,boolean prettyPrint) throws SerializerException{
  72.         try{
  73.             this.objToXml(new File(fileName), c, object, prettyPrint);
  74.         }catch(Exception e){
  75.             throw new SerializerException(e.getMessage(), e);
  76.         }
  77.     }
  78.     protected void objToXml(File file,Class<?> c,Object object,boolean prettyPrint) throws SerializerException{
  79.         FileOutputStream fout = null;
  80.         try{
  81.             fout = new FileOutputStream(file);
  82.             this._objToXml(fout, c, object, prettyPrint);
  83.         }catch(Exception e){
  84.             throw new SerializerException(e.getMessage(), e);
  85.         }
  86.         finally{
  87.             try{
  88.                 if(fout!=null){
  89.                     fout.flush();
  90.                 }
  91.             }catch(Exception e){
  92.                 // ignore
  93.             }
  94.             try{
  95.                 if(fout!=null){
  96.                     fout.close();
  97.                 }
  98.             }catch(Exception e){
  99.                 // ignore
  100.             }
  101.         }
  102.     }
  103.     protected ByteArrayOutputStream objToXml(Class<?> c,Object object,boolean prettyPrint) throws SerializerException{
  104.         ByteArrayOutputStream bout = null;
  105.         try{
  106.             bout = new ByteArrayOutputStream();
  107.             this._objToXml(bout, c, object, prettyPrint);
  108.         }catch(Exception e){
  109.             throw new SerializerException(e.getMessage(), e);
  110.         }
  111.         finally{
  112.             try{
  113.                 if(bout!=null){
  114.                     bout.flush();
  115.                 }
  116.             }catch(Exception e){
  117.                 // ignore
  118.             }
  119.             try{
  120.                 if(bout!=null){
  121.                     bout.close();
  122.                 }
  123.             }catch(Exception e){
  124.                 // ignore
  125.             }
  126.         }
  127.         return bout;
  128.     }




  129.     /*
  130.      =================================================================================
  131.      Object: dominio-soggetto
  132.      =================================================================================
  133.     */
  134.    
  135.     /**
  136.      * Serialize to file system in <var>fileName</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  137.      *
  138.      * @param fileName Xml file to serialize the object <var>dominioSoggetto</var>
  139.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  140.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  141.      */
  142.     public void write(String fileName,DominioSoggetto dominioSoggetto) throws SerializerException {
  143.         this.objToXml(fileName, DominioSoggetto.class, dominioSoggetto, false);
  144.     }
  145.     /**
  146.      * Serialize to file system in <var>fileName</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  147.      *
  148.      * @param fileName Xml file to serialize the object <var>dominioSoggetto</var>
  149.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  150.      * @param prettyPrint if true output the XML with indenting
  151.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  152.      */
  153.     public void write(String fileName,DominioSoggetto dominioSoggetto,boolean prettyPrint) throws SerializerException {
  154.         this.objToXml(fileName, DominioSoggetto.class, dominioSoggetto, prettyPrint);
  155.     }
  156.    
  157.     /**
  158.      * Serialize to file system in <var>file</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  159.      *
  160.      * @param file Xml file to serialize the object <var>dominioSoggetto</var>
  161.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  162.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  163.      */
  164.     public void write(File file,DominioSoggetto dominioSoggetto) throws SerializerException {
  165.         this.objToXml(file, DominioSoggetto.class, dominioSoggetto, false);
  166.     }
  167.     /**
  168.      * Serialize to file system in <var>file</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  169.      *
  170.      * @param file Xml file to serialize the object <var>dominioSoggetto</var>
  171.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  172.      * @param prettyPrint if true output the XML with indenting
  173.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  174.      */
  175.     public void write(File file,DominioSoggetto dominioSoggetto,boolean prettyPrint) throws SerializerException {
  176.         this.objToXml(file, DominioSoggetto.class, dominioSoggetto, prettyPrint);
  177.     }
  178.    
  179.     /**
  180.      * Serialize to output stream <var>out</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  181.      *
  182.      * @param out OutputStream to serialize the object <var>dominioSoggetto</var>
  183.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  184.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  185.      */
  186.     public void write(OutputStream out,DominioSoggetto dominioSoggetto) throws SerializerException {
  187.         this.objToXml(out, DominioSoggetto.class, dominioSoggetto, false);
  188.     }
  189.     /**
  190.      * Serialize to output stream <var>out</var> the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  191.      *
  192.      * @param out OutputStream to serialize the object <var>dominioSoggetto</var>
  193.      * @param dominioSoggetto Object to be serialized in xml file <var>fileName</var>
  194.      * @param prettyPrint if true output the XML with indenting
  195.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  196.      */
  197.     public void write(OutputStream out,DominioSoggetto dominioSoggetto,boolean prettyPrint) throws SerializerException {
  198.         this.objToXml(out, DominioSoggetto.class, dominioSoggetto, prettyPrint);
  199.     }
  200.            
  201.     /**
  202.      * Serialize to byte array the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  203.      *
  204.      * @param dominioSoggetto Object to be serialized
  205.      * @return Object to be serialized in byte array
  206.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  207.      */
  208.     public byte[] toByteArray(DominioSoggetto dominioSoggetto) throws SerializerException {
  209.         return this.objToXml(DominioSoggetto.class, dominioSoggetto, false).toByteArray();
  210.     }
  211.     /**
  212.      * Serialize to byte array the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  213.      *
  214.      * @param dominioSoggetto Object to be serialized
  215.      * @param prettyPrint if true output the XML with indenting
  216.      * @return Object to be serialized in byte array
  217.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  218.      */
  219.     public byte[] toByteArray(DominioSoggetto dominioSoggetto,boolean prettyPrint) throws SerializerException {
  220.         return this.objToXml(DominioSoggetto.class, dominioSoggetto, prettyPrint).toByteArray();
  221.     }
  222.    
  223.     /**
  224.      * Serialize to String the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  225.      *
  226.      * @param dominioSoggetto Object to be serialized
  227.      * @return Object to be serialized as String
  228.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  229.      */
  230.     public String toString(DominioSoggetto dominioSoggetto) throws SerializerException {
  231.         return this.objToXml(DominioSoggetto.class, dominioSoggetto, false).toString();
  232.     }
  233.     /**
  234.      * Serialize to String the object <var>dominioSoggetto</var> of type {@link org.openspcoop2.core.diagnostica.DominioSoggetto}
  235.      *
  236.      * @param dominioSoggetto Object to be serialized
  237.      * @param prettyPrint if true output the XML with indenting
  238.      * @return Object to be serialized as String
  239.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  240.      */
  241.     public String toString(DominioSoggetto dominioSoggetto,boolean prettyPrint) throws SerializerException {
  242.         return this.objToXml(DominioSoggetto.class, dominioSoggetto, prettyPrint).toString();
  243.     }
  244.    
  245.    
  246.    
  247.     /*
  248.      =================================================================================
  249.      Object: messaggio-diagnostico
  250.      =================================================================================
  251.     */
  252.    
  253.     /**
  254.      * Serialize to file system in <var>fileName</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  255.      *
  256.      * @param fileName Xml file to serialize the object <var>messaggioDiagnostico</var>
  257.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  258.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  259.      */
  260.     public void write(String fileName,MessaggioDiagnostico messaggioDiagnostico) throws SerializerException {
  261.         this.objToXml(fileName, MessaggioDiagnostico.class, messaggioDiagnostico, false);
  262.     }
  263.     /**
  264.      * Serialize to file system in <var>fileName</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  265.      *
  266.      * @param fileName Xml file to serialize the object <var>messaggioDiagnostico</var>
  267.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  268.      * @param prettyPrint if true output the XML with indenting
  269.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  270.      */
  271.     public void write(String fileName,MessaggioDiagnostico messaggioDiagnostico,boolean prettyPrint) throws SerializerException {
  272.         this.objToXml(fileName, MessaggioDiagnostico.class, messaggioDiagnostico, prettyPrint);
  273.     }
  274.    
  275.     /**
  276.      * Serialize to file system in <var>file</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  277.      *
  278.      * @param file Xml file to serialize the object <var>messaggioDiagnostico</var>
  279.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  280.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  281.      */
  282.     public void write(File file,MessaggioDiagnostico messaggioDiagnostico) throws SerializerException {
  283.         this.objToXml(file, MessaggioDiagnostico.class, messaggioDiagnostico, false);
  284.     }
  285.     /**
  286.      * Serialize to file system in <var>file</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  287.      *
  288.      * @param file Xml file to serialize the object <var>messaggioDiagnostico</var>
  289.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  290.      * @param prettyPrint if true output the XML with indenting
  291.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  292.      */
  293.     public void write(File file,MessaggioDiagnostico messaggioDiagnostico,boolean prettyPrint) throws SerializerException {
  294.         this.objToXml(file, MessaggioDiagnostico.class, messaggioDiagnostico, prettyPrint);
  295.     }
  296.    
  297.     /**
  298.      * Serialize to output stream <var>out</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  299.      *
  300.      * @param out OutputStream to serialize the object <var>messaggioDiagnostico</var>
  301.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  302.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  303.      */
  304.     public void write(OutputStream out,MessaggioDiagnostico messaggioDiagnostico) throws SerializerException {
  305.         this.objToXml(out, MessaggioDiagnostico.class, messaggioDiagnostico, false);
  306.     }
  307.     /**
  308.      * Serialize to output stream <var>out</var> the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  309.      *
  310.      * @param out OutputStream to serialize the object <var>messaggioDiagnostico</var>
  311.      * @param messaggioDiagnostico Object to be serialized in xml file <var>fileName</var>
  312.      * @param prettyPrint if true output the XML with indenting
  313.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  314.      */
  315.     public void write(OutputStream out,MessaggioDiagnostico messaggioDiagnostico,boolean prettyPrint) throws SerializerException {
  316.         this.objToXml(out, MessaggioDiagnostico.class, messaggioDiagnostico, prettyPrint);
  317.     }
  318.            
  319.     /**
  320.      * Serialize to byte array the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  321.      *
  322.      * @param messaggioDiagnostico Object to be serialized
  323.      * @return Object to be serialized in byte array
  324.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  325.      */
  326.     public byte[] toByteArray(MessaggioDiagnostico messaggioDiagnostico) throws SerializerException {
  327.         return this.objToXml(MessaggioDiagnostico.class, messaggioDiagnostico, false).toByteArray();
  328.     }
  329.     /**
  330.      * Serialize to byte array the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  331.      *
  332.      * @param messaggioDiagnostico Object to be serialized
  333.      * @param prettyPrint if true output the XML with indenting
  334.      * @return Object to be serialized in byte array
  335.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  336.      */
  337.     public byte[] toByteArray(MessaggioDiagnostico messaggioDiagnostico,boolean prettyPrint) throws SerializerException {
  338.         return this.objToXml(MessaggioDiagnostico.class, messaggioDiagnostico, prettyPrint).toByteArray();
  339.     }
  340.    
  341.     /**
  342.      * Serialize to String the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  343.      *
  344.      * @param messaggioDiagnostico Object to be serialized
  345.      * @return Object to be serialized as String
  346.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  347.      */
  348.     public String toString(MessaggioDiagnostico messaggioDiagnostico) throws SerializerException {
  349.         return this.objToXml(MessaggioDiagnostico.class, messaggioDiagnostico, false).toString();
  350.     }
  351.     /**
  352.      * Serialize to String the object <var>messaggioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.MessaggioDiagnostico}
  353.      *
  354.      * @param messaggioDiagnostico Object to be serialized
  355.      * @param prettyPrint if true output the XML with indenting
  356.      * @return Object to be serialized as String
  357.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  358.      */
  359.     public String toString(MessaggioDiagnostico messaggioDiagnostico,boolean prettyPrint) throws SerializerException {
  360.         return this.objToXml(MessaggioDiagnostico.class, messaggioDiagnostico, prettyPrint).toString();
  361.     }
  362.    
  363.    
  364.    
  365.     /*
  366.      =================================================================================
  367.      Object: elenco-messaggi-diagnostici
  368.      =================================================================================
  369.     */
  370.    
  371.     /**
  372.      * Serialize to file system in <var>fileName</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  373.      *
  374.      * @param fileName Xml file to serialize the object <var>elencoMessaggiDiagnostici</var>
  375.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  376.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  377.      */
  378.     public void write(String fileName,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici) throws SerializerException {
  379.         this.objToXml(fileName, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, false);
  380.     }
  381.     /**
  382.      * Serialize to file system in <var>fileName</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  383.      *
  384.      * @param fileName Xml file to serialize the object <var>elencoMessaggiDiagnostici</var>
  385.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  386.      * @param prettyPrint if true output the XML with indenting
  387.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  388.      */
  389.     public void write(String fileName,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici,boolean prettyPrint) throws SerializerException {
  390.         this.objToXml(fileName, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, prettyPrint);
  391.     }
  392.    
  393.     /**
  394.      * Serialize to file system in <var>file</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  395.      *
  396.      * @param file Xml file to serialize the object <var>elencoMessaggiDiagnostici</var>
  397.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  398.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  399.      */
  400.     public void write(File file,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici) throws SerializerException {
  401.         this.objToXml(file, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, false);
  402.     }
  403.     /**
  404.      * Serialize to file system in <var>file</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  405.      *
  406.      * @param file Xml file to serialize the object <var>elencoMessaggiDiagnostici</var>
  407.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  408.      * @param prettyPrint if true output the XML with indenting
  409.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  410.      */
  411.     public void write(File file,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici,boolean prettyPrint) throws SerializerException {
  412.         this.objToXml(file, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, prettyPrint);
  413.     }
  414.    
  415.     /**
  416.      * Serialize to output stream <var>out</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  417.      *
  418.      * @param out OutputStream to serialize the object <var>elencoMessaggiDiagnostici</var>
  419.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  420.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  421.      */
  422.     public void write(OutputStream out,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici) throws SerializerException {
  423.         this.objToXml(out, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, false);
  424.     }
  425.     /**
  426.      * Serialize to output stream <var>out</var> the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  427.      *
  428.      * @param out OutputStream to serialize the object <var>elencoMessaggiDiagnostici</var>
  429.      * @param elencoMessaggiDiagnostici Object to be serialized in xml file <var>fileName</var>
  430.      * @param prettyPrint if true output the XML with indenting
  431.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  432.      */
  433.     public void write(OutputStream out,ElencoMessaggiDiagnostici elencoMessaggiDiagnostici,boolean prettyPrint) throws SerializerException {
  434.         this.objToXml(out, ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, prettyPrint);
  435.     }
  436.            
  437.     /**
  438.      * Serialize to byte array the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  439.      *
  440.      * @param elencoMessaggiDiagnostici Object to be serialized
  441.      * @return Object to be serialized in byte array
  442.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  443.      */
  444.     public byte[] toByteArray(ElencoMessaggiDiagnostici elencoMessaggiDiagnostici) throws SerializerException {
  445.         return this.objToXml(ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, false).toByteArray();
  446.     }
  447.     /**
  448.      * Serialize to byte array the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  449.      *
  450.      * @param elencoMessaggiDiagnostici Object to be serialized
  451.      * @param prettyPrint if true output the XML with indenting
  452.      * @return Object to be serialized in byte array
  453.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  454.      */
  455.     public byte[] toByteArray(ElencoMessaggiDiagnostici elencoMessaggiDiagnostici,boolean prettyPrint) throws SerializerException {
  456.         return this.objToXml(ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, prettyPrint).toByteArray();
  457.     }
  458.    
  459.     /**
  460.      * Serialize to String the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  461.      *
  462.      * @param elencoMessaggiDiagnostici Object to be serialized
  463.      * @return Object to be serialized as String
  464.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  465.      */
  466.     public String toString(ElencoMessaggiDiagnostici elencoMessaggiDiagnostici) throws SerializerException {
  467.         return this.objToXml(ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, false).toString();
  468.     }
  469.     /**
  470.      * Serialize to String the object <var>elencoMessaggiDiagnostici</var> of type {@link org.openspcoop2.core.diagnostica.ElencoMessaggiDiagnostici}
  471.      *
  472.      * @param elencoMessaggiDiagnostici Object to be serialized
  473.      * @param prettyPrint if true output the XML with indenting
  474.      * @return Object to be serialized as String
  475.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  476.      */
  477.     public String toString(ElencoMessaggiDiagnostici elencoMessaggiDiagnostici,boolean prettyPrint) throws SerializerException {
  478.         return this.objToXml(ElencoMessaggiDiagnostici.class, elencoMessaggiDiagnostici, prettyPrint).toString();
  479.     }
  480.    
  481.    
  482.    
  483.     /*
  484.      =================================================================================
  485.      Object: dominio-diagnostico
  486.      =================================================================================
  487.     */
  488.    
  489.     /**
  490.      * Serialize to file system in <var>fileName</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  491.      *
  492.      * @param fileName Xml file to serialize the object <var>dominioDiagnostico</var>
  493.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  494.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  495.      */
  496.     public void write(String fileName,DominioDiagnostico dominioDiagnostico) throws SerializerException {
  497.         this.objToXml(fileName, DominioDiagnostico.class, dominioDiagnostico, false);
  498.     }
  499.     /**
  500.      * Serialize to file system in <var>fileName</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  501.      *
  502.      * @param fileName Xml file to serialize the object <var>dominioDiagnostico</var>
  503.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  504.      * @param prettyPrint if true output the XML with indenting
  505.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  506.      */
  507.     public void write(String fileName,DominioDiagnostico dominioDiagnostico,boolean prettyPrint) throws SerializerException {
  508.         this.objToXml(fileName, DominioDiagnostico.class, dominioDiagnostico, prettyPrint);
  509.     }
  510.    
  511.     /**
  512.      * Serialize to file system in <var>file</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  513.      *
  514.      * @param file Xml file to serialize the object <var>dominioDiagnostico</var>
  515.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  516.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  517.      */
  518.     public void write(File file,DominioDiagnostico dominioDiagnostico) throws SerializerException {
  519.         this.objToXml(file, DominioDiagnostico.class, dominioDiagnostico, false);
  520.     }
  521.     /**
  522.      * Serialize to file system in <var>file</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  523.      *
  524.      * @param file Xml file to serialize the object <var>dominioDiagnostico</var>
  525.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  526.      * @param prettyPrint if true output the XML with indenting
  527.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  528.      */
  529.     public void write(File file,DominioDiagnostico dominioDiagnostico,boolean prettyPrint) throws SerializerException {
  530.         this.objToXml(file, DominioDiagnostico.class, dominioDiagnostico, prettyPrint);
  531.     }
  532.    
  533.     /**
  534.      * Serialize to output stream <var>out</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  535.      *
  536.      * @param out OutputStream to serialize the object <var>dominioDiagnostico</var>
  537.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  538.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  539.      */
  540.     public void write(OutputStream out,DominioDiagnostico dominioDiagnostico) throws SerializerException {
  541.         this.objToXml(out, DominioDiagnostico.class, dominioDiagnostico, false);
  542.     }
  543.     /**
  544.      * Serialize to output stream <var>out</var> the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  545.      *
  546.      * @param out OutputStream to serialize the object <var>dominioDiagnostico</var>
  547.      * @param dominioDiagnostico Object to be serialized in xml file <var>fileName</var>
  548.      * @param prettyPrint if true output the XML with indenting
  549.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  550.      */
  551.     public void write(OutputStream out,DominioDiagnostico dominioDiagnostico,boolean prettyPrint) throws SerializerException {
  552.         this.objToXml(out, DominioDiagnostico.class, dominioDiagnostico, prettyPrint);
  553.     }
  554.            
  555.     /**
  556.      * Serialize to byte array the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  557.      *
  558.      * @param dominioDiagnostico Object to be serialized
  559.      * @return Object to be serialized in byte array
  560.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  561.      */
  562.     public byte[] toByteArray(DominioDiagnostico dominioDiagnostico) throws SerializerException {
  563.         return this.objToXml(DominioDiagnostico.class, dominioDiagnostico, false).toByteArray();
  564.     }
  565.     /**
  566.      * Serialize to byte array the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  567.      *
  568.      * @param dominioDiagnostico Object to be serialized
  569.      * @param prettyPrint if true output the XML with indenting
  570.      * @return Object to be serialized in byte array
  571.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  572.      */
  573.     public byte[] toByteArray(DominioDiagnostico dominioDiagnostico,boolean prettyPrint) throws SerializerException {
  574.         return this.objToXml(DominioDiagnostico.class, dominioDiagnostico, prettyPrint).toByteArray();
  575.     }
  576.    
  577.     /**
  578.      * Serialize to String the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  579.      *
  580.      * @param dominioDiagnostico Object to be serialized
  581.      * @return Object to be serialized as String
  582.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  583.      */
  584.     public String toString(DominioDiagnostico dominioDiagnostico) throws SerializerException {
  585.         return this.objToXml(DominioDiagnostico.class, dominioDiagnostico, false).toString();
  586.     }
  587.     /**
  588.      * Serialize to String the object <var>dominioDiagnostico</var> of type {@link org.openspcoop2.core.diagnostica.DominioDiagnostico}
  589.      *
  590.      * @param dominioDiagnostico Object to be serialized
  591.      * @param prettyPrint if true output the XML with indenting
  592.      * @return Object to be serialized as String
  593.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  594.      */
  595.     public String toString(DominioDiagnostico dominioDiagnostico,boolean prettyPrint) throws SerializerException {
  596.         return this.objToXml(DominioDiagnostico.class, dominioDiagnostico, prettyPrint).toString();
  597.     }
  598.    
  599.    
  600.    
  601.     /*
  602.      =================================================================================
  603.      Object: proprieta
  604.      =================================================================================
  605.     */
  606.    
  607.     /**
  608.      * Serialize to file system in <var>fileName</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  609.      *
  610.      * @param fileName Xml file to serialize the object <var>proprieta</var>
  611.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  612.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  613.      */
  614.     public void write(String fileName,Proprieta proprieta) throws SerializerException {
  615.         this.objToXml(fileName, Proprieta.class, proprieta, false);
  616.     }
  617.     /**
  618.      * Serialize to file system in <var>fileName</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  619.      *
  620.      * @param fileName Xml file to serialize the object <var>proprieta</var>
  621.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  622.      * @param prettyPrint if true output the XML with indenting
  623.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  624.      */
  625.     public void write(String fileName,Proprieta proprieta,boolean prettyPrint) throws SerializerException {
  626.         this.objToXml(fileName, Proprieta.class, proprieta, prettyPrint);
  627.     }
  628.    
  629.     /**
  630.      * Serialize to file system in <var>file</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  631.      *
  632.      * @param file Xml file to serialize the object <var>proprieta</var>
  633.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  634.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  635.      */
  636.     public void write(File file,Proprieta proprieta) throws SerializerException {
  637.         this.objToXml(file, Proprieta.class, proprieta, false);
  638.     }
  639.     /**
  640.      * Serialize to file system in <var>file</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  641.      *
  642.      * @param file Xml file to serialize the object <var>proprieta</var>
  643.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  644.      * @param prettyPrint if true output the XML with indenting
  645.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  646.      */
  647.     public void write(File file,Proprieta proprieta,boolean prettyPrint) throws SerializerException {
  648.         this.objToXml(file, Proprieta.class, proprieta, prettyPrint);
  649.     }
  650.    
  651.     /**
  652.      * Serialize to output stream <var>out</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  653.      *
  654.      * @param out OutputStream to serialize the object <var>proprieta</var>
  655.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  656.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  657.      */
  658.     public void write(OutputStream out,Proprieta proprieta) throws SerializerException {
  659.         this.objToXml(out, Proprieta.class, proprieta, false);
  660.     }
  661.     /**
  662.      * Serialize to output stream <var>out</var> the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  663.      *
  664.      * @param out OutputStream to serialize the object <var>proprieta</var>
  665.      * @param proprieta Object to be serialized in xml file <var>fileName</var>
  666.      * @param prettyPrint if true output the XML with indenting
  667.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  668.      */
  669.     public void write(OutputStream out,Proprieta proprieta,boolean prettyPrint) throws SerializerException {
  670.         this.objToXml(out, Proprieta.class, proprieta, prettyPrint);
  671.     }
  672.            
  673.     /**
  674.      * Serialize to byte array the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  675.      *
  676.      * @param proprieta Object to be serialized
  677.      * @return Object to be serialized in byte array
  678.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  679.      */
  680.     public byte[] toByteArray(Proprieta proprieta) throws SerializerException {
  681.         return this.objToXml(Proprieta.class, proprieta, false).toByteArray();
  682.     }
  683.     /**
  684.      * Serialize to byte array the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  685.      *
  686.      * @param proprieta Object to be serialized
  687.      * @param prettyPrint if true output the XML with indenting
  688.      * @return Object to be serialized in byte array
  689.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  690.      */
  691.     public byte[] toByteArray(Proprieta proprieta,boolean prettyPrint) throws SerializerException {
  692.         return this.objToXml(Proprieta.class, proprieta, prettyPrint).toByteArray();
  693.     }
  694.    
  695.     /**
  696.      * Serialize to String the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  697.      *
  698.      * @param proprieta Object to be serialized
  699.      * @return Object to be serialized as String
  700.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  701.      */
  702.     public String toString(Proprieta proprieta) throws SerializerException {
  703.         return this.objToXml(Proprieta.class, proprieta, false).toString();
  704.     }
  705.     /**
  706.      * Serialize to String the object <var>proprieta</var> of type {@link org.openspcoop2.core.diagnostica.Proprieta}
  707.      *
  708.      * @param proprieta Object to be serialized
  709.      * @param prettyPrint if true output the XML with indenting
  710.      * @return Object to be serialized as String
  711.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  712.      */
  713.     public String toString(Proprieta proprieta,boolean prettyPrint) throws SerializerException {
  714.         return this.objToXml(Proprieta.class, proprieta, prettyPrint).toString();
  715.     }
  716.    
  717.    
  718.    
  719.     /*
  720.      =================================================================================
  721.      Object: protocollo
  722.      =================================================================================
  723.     */
  724.    
  725.     /**
  726.      * Serialize to file system in <var>fileName</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  727.      *
  728.      * @param fileName Xml file to serialize the object <var>protocollo</var>
  729.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  730.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  731.      */
  732.     public void write(String fileName,Protocollo protocollo) throws SerializerException {
  733.         this.objToXml(fileName, Protocollo.class, protocollo, false);
  734.     }
  735.     /**
  736.      * Serialize to file system in <var>fileName</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  737.      *
  738.      * @param fileName Xml file to serialize the object <var>protocollo</var>
  739.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  740.      * @param prettyPrint if true output the XML with indenting
  741.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  742.      */
  743.     public void write(String fileName,Protocollo protocollo,boolean prettyPrint) throws SerializerException {
  744.         this.objToXml(fileName, Protocollo.class, protocollo, prettyPrint);
  745.     }
  746.    
  747.     /**
  748.      * Serialize to file system in <var>file</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  749.      *
  750.      * @param file Xml file to serialize the object <var>protocollo</var>
  751.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  752.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  753.      */
  754.     public void write(File file,Protocollo protocollo) throws SerializerException {
  755.         this.objToXml(file, Protocollo.class, protocollo, false);
  756.     }
  757.     /**
  758.      * Serialize to file system in <var>file</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  759.      *
  760.      * @param file Xml file to serialize the object <var>protocollo</var>
  761.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  762.      * @param prettyPrint if true output the XML with indenting
  763.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  764.      */
  765.     public void write(File file,Protocollo protocollo,boolean prettyPrint) throws SerializerException {
  766.         this.objToXml(file, Protocollo.class, protocollo, prettyPrint);
  767.     }
  768.    
  769.     /**
  770.      * Serialize to output stream <var>out</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  771.      *
  772.      * @param out OutputStream to serialize the object <var>protocollo</var>
  773.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  774.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  775.      */
  776.     public void write(OutputStream out,Protocollo protocollo) throws SerializerException {
  777.         this.objToXml(out, Protocollo.class, protocollo, false);
  778.     }
  779.     /**
  780.      * Serialize to output stream <var>out</var> the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  781.      *
  782.      * @param out OutputStream to serialize the object <var>protocollo</var>
  783.      * @param protocollo Object to be serialized in xml file <var>fileName</var>
  784.      * @param prettyPrint if true output the XML with indenting
  785.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  786.      */
  787.     public void write(OutputStream out,Protocollo protocollo,boolean prettyPrint) throws SerializerException {
  788.         this.objToXml(out, Protocollo.class, protocollo, prettyPrint);
  789.     }
  790.            
  791.     /**
  792.      * Serialize to byte array the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  793.      *
  794.      * @param protocollo Object to be serialized
  795.      * @return Object to be serialized in byte array
  796.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  797.      */
  798.     public byte[] toByteArray(Protocollo protocollo) throws SerializerException {
  799.         return this.objToXml(Protocollo.class, protocollo, false).toByteArray();
  800.     }
  801.     /**
  802.      * Serialize to byte array the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  803.      *
  804.      * @param protocollo Object to be serialized
  805.      * @param prettyPrint if true output the XML with indenting
  806.      * @return Object to be serialized in byte array
  807.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  808.      */
  809.     public byte[] toByteArray(Protocollo protocollo,boolean prettyPrint) throws SerializerException {
  810.         return this.objToXml(Protocollo.class, protocollo, prettyPrint).toByteArray();
  811.     }
  812.    
  813.     /**
  814.      * Serialize to String the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  815.      *
  816.      * @param protocollo Object to be serialized
  817.      * @return Object to be serialized as String
  818.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  819.      */
  820.     public String toString(Protocollo protocollo) throws SerializerException {
  821.         return this.objToXml(Protocollo.class, protocollo, false).toString();
  822.     }
  823.     /**
  824.      * Serialize to String the object <var>protocollo</var> of type {@link org.openspcoop2.core.diagnostica.Protocollo}
  825.      *
  826.      * @param protocollo Object to be serialized
  827.      * @param prettyPrint if true output the XML with indenting
  828.      * @return Object to be serialized as String
  829.      * @throws SerializerException The exception that is thrown when an error occurs during serialization
  830.      */
  831.     public String toString(Protocollo protocollo,boolean prettyPrint) throws SerializerException {
  832.         return this.objToXml(Protocollo.class, protocollo, prettyPrint).toString();
  833.     }
  834.    
  835.    
  836.    

  837. }