AbstractDeserializer.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 it.cnipa.collprofiles.utils.serializer;

  21. import org.openspcoop2.generic_project.exception.DeserializerException;

  22. import it.cnipa.collprofiles.OperationType;
  23. import it.cnipa.collprofiles.OperationListType;
  24. import it.cnipa.collprofiles.EgovDecllElement;

  25. import java.io.InputStream;
  26. import java.io.File;

  27. /**    
  28.  * XML Deserializer of beans
  29.  *
  30.  * @author Poli Andrea (poli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */

  34. public abstract class AbstractDeserializer extends org.openspcoop2.generic_project.serializer.AbstractDeserializerBase {



  35.     /*
  36.      =================================================================================
  37.      Object: operationType
  38.      =================================================================================
  39.     */
  40.    
  41.     /**
  42.      * Transform the xml in <var>fileName</var> in the object type {@link it.cnipa.collprofiles.OperationType}
  43.      *
  44.      * @param fileName Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationType}
  45.      * @return Object type {@link it.cnipa.collprofiles.OperationType}
  46.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  47.      */
  48.     public OperationType readOperationType(String fileName) throws DeserializerException {
  49.         return (OperationType) this.xmlToObj(fileName, OperationType.class);
  50.     }
  51.    
  52.     /**
  53.      * Transform the xml in <var>file</var> in the object type {@link it.cnipa.collprofiles.OperationType}
  54.      *
  55.      * @param file Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationType}
  56.      * @return Object type {@link it.cnipa.collprofiles.OperationType}
  57.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  58.      */
  59.     public OperationType readOperationType(File file) throws DeserializerException {
  60.         return (OperationType) this.xmlToObj(file, OperationType.class);
  61.     }
  62.    
  63.     /**
  64.      * Transform the input stream <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationType}
  65.      *
  66.      * @param in InputStream to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationType}
  67.      * @return Object type {@link it.cnipa.collprofiles.OperationType}
  68.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  69.      */
  70.     public OperationType readOperationType(InputStream in) throws DeserializerException {
  71.         return (OperationType) this.xmlToObj(in, OperationType.class);
  72.     }  
  73.    
  74.     /**
  75.      * Transform the byte array <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationType}
  76.      *
  77.      * @param in Byte array to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationType}
  78.      * @return Object type {@link it.cnipa.collprofiles.OperationType}
  79.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  80.      */
  81.     public OperationType readOperationType(byte[] in) throws DeserializerException {
  82.         return (OperationType) this.xmlToObj(in, OperationType.class);
  83.     }  
  84.    
  85.     /**
  86.      * Transform the String <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationType}
  87.      *
  88.      * @param in String to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationType}
  89.      * @return Object type {@link it.cnipa.collprofiles.OperationType}
  90.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  91.      */
  92.     public OperationType readOperationTypeFromString(String in) throws DeserializerException {
  93.         return (OperationType) this.xmlToObj(in.getBytes(), OperationType.class);
  94.     }  
  95.    
  96.    
  97.    
  98.     /*
  99.      =================================================================================
  100.      Object: operationListType
  101.      =================================================================================
  102.     */
  103.    
  104.     /**
  105.      * Transform the xml in <var>fileName</var> in the object type {@link it.cnipa.collprofiles.OperationListType}
  106.      *
  107.      * @param fileName Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationListType}
  108.      * @return Object type {@link it.cnipa.collprofiles.OperationListType}
  109.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  110.      */
  111.     public OperationListType readOperationListType(String fileName) throws DeserializerException {
  112.         return (OperationListType) this.xmlToObj(fileName, OperationListType.class);
  113.     }
  114.    
  115.     /**
  116.      * Transform the xml in <var>file</var> in the object type {@link it.cnipa.collprofiles.OperationListType}
  117.      *
  118.      * @param file Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationListType}
  119.      * @return Object type {@link it.cnipa.collprofiles.OperationListType}
  120.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  121.      */
  122.     public OperationListType readOperationListType(File file) throws DeserializerException {
  123.         return (OperationListType) this.xmlToObj(file, OperationListType.class);
  124.     }
  125.    
  126.     /**
  127.      * Transform the input stream <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationListType}
  128.      *
  129.      * @param in InputStream to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationListType}
  130.      * @return Object type {@link it.cnipa.collprofiles.OperationListType}
  131.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  132.      */
  133.     public OperationListType readOperationListType(InputStream in) throws DeserializerException {
  134.         return (OperationListType) this.xmlToObj(in, OperationListType.class);
  135.     }  
  136.    
  137.     /**
  138.      * Transform the byte array <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationListType}
  139.      *
  140.      * @param in Byte array to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationListType}
  141.      * @return Object type {@link it.cnipa.collprofiles.OperationListType}
  142.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  143.      */
  144.     public OperationListType readOperationListType(byte[] in) throws DeserializerException {
  145.         return (OperationListType) this.xmlToObj(in, OperationListType.class);
  146.     }  
  147.    
  148.     /**
  149.      * Transform the String <var>in</var> in the object type {@link it.cnipa.collprofiles.OperationListType}
  150.      *
  151.      * @param in String to use for the reconstruction of the object type {@link it.cnipa.collprofiles.OperationListType}
  152.      * @return Object type {@link it.cnipa.collprofiles.OperationListType}
  153.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  154.      */
  155.     public OperationListType readOperationListTypeFromString(String in) throws DeserializerException {
  156.         return (OperationListType) this.xmlToObj(in.getBytes(), OperationListType.class);
  157.     }  
  158.    
  159.    
  160.    
  161.     /*
  162.      =================================================================================
  163.      Object: egovDecllElement
  164.      =================================================================================
  165.     */
  166.    
  167.     /**
  168.      * Transform the xml in <var>fileName</var> in the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  169.      *
  170.      * @param fileName Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  171.      * @return Object type {@link it.cnipa.collprofiles.EgovDecllElement}
  172.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  173.      */
  174.     public EgovDecllElement readEgovDecllElement(String fileName) throws DeserializerException {
  175.         return (EgovDecllElement) this.xmlToObj(fileName, EgovDecllElement.class);
  176.     }
  177.    
  178.     /**
  179.      * Transform the xml in <var>file</var> in the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  180.      *
  181.      * @param file Xml file to use for the reconstruction of the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  182.      * @return Object type {@link it.cnipa.collprofiles.EgovDecllElement}
  183.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  184.      */
  185.     public EgovDecllElement readEgovDecllElement(File file) throws DeserializerException {
  186.         return (EgovDecllElement) this.xmlToObj(file, EgovDecllElement.class);
  187.     }
  188.    
  189.     /**
  190.      * Transform the input stream <var>in</var> in the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  191.      *
  192.      * @param in InputStream to use for the reconstruction of the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  193.      * @return Object type {@link it.cnipa.collprofiles.EgovDecllElement}
  194.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  195.      */
  196.     public EgovDecllElement readEgovDecllElement(InputStream in) throws DeserializerException {
  197.         return (EgovDecllElement) this.xmlToObj(in, EgovDecllElement.class);
  198.     }  
  199.    
  200.     /**
  201.      * Transform the byte array <var>in</var> in the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  202.      *
  203.      * @param in Byte array to use for the reconstruction of the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  204.      * @return Object type {@link it.cnipa.collprofiles.EgovDecllElement}
  205.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  206.      */
  207.     public EgovDecllElement readEgovDecllElement(byte[] in) throws DeserializerException {
  208.         return (EgovDecllElement) this.xmlToObj(in, EgovDecllElement.class);
  209.     }  
  210.    
  211.     /**
  212.      * Transform the String <var>in</var> in the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  213.      *
  214.      * @param in String to use for the reconstruction of the object type {@link it.cnipa.collprofiles.EgovDecllElement}
  215.      * @return Object type {@link it.cnipa.collprofiles.EgovDecllElement}
  216.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  217.      */
  218.     public EgovDecllElement readEgovDecllElementFromString(String in) throws DeserializerException {
  219.         return (EgovDecllElement) this.xmlToObj(in.getBytes(), EgovDecllElement.class);
  220.     }  
  221.    
  222.    
  223.    

  224. }