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 org.openspcoop2.web.lib.audit.log.utils.serializer;

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

  22. import org.openspcoop2.web.lib.audit.log.Operation;
  23. import org.openspcoop2.web.lib.audit.log.Binary;

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

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

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



  34.     /*
  35.      =================================================================================
  36.      Object: operation
  37.      =================================================================================
  38.     */
  39.    
  40.     /**
  41.      * Transform the xml in <var>fileName</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  42.      *
  43.      * @param fileName Xml file to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  44.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  45.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  46.      */
  47.     public Operation readOperation(String fileName) throws DeserializerException {
  48.         return (Operation) this.xmlToObj(fileName, Operation.class);
  49.     }
  50.    
  51.     /**
  52.      * Transform the xml in <var>file</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  53.      *
  54.      * @param file Xml file to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  55.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  56.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  57.      */
  58.     public Operation readOperation(File file) throws DeserializerException {
  59.         return (Operation) this.xmlToObj(file, Operation.class);
  60.     }
  61.    
  62.     /**
  63.      * Transform the input stream <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  64.      *
  65.      * @param in InputStream to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  66.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  67.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  68.      */
  69.     public Operation readOperation(InputStream in) throws DeserializerException {
  70.         return (Operation) this.xmlToObj(in, Operation.class);
  71.     }  
  72.    
  73.     /**
  74.      * Transform the byte array <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  75.      *
  76.      * @param in Byte array to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  77.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  78.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  79.      */
  80.     public Operation readOperation(byte[] in) throws DeserializerException {
  81.         return (Operation) this.xmlToObj(in, Operation.class);
  82.     }  
  83.    
  84.     /**
  85.      * Transform the String <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  86.      *
  87.      * @param in String to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  88.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Operation}
  89.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  90.      */
  91.     public Operation readOperationFromString(String in) throws DeserializerException {
  92.         return (Operation) this.xmlToObj(in.getBytes(), Operation.class);
  93.     }  
  94.    
  95.    
  96.    
  97.     /*
  98.      =================================================================================
  99.      Object: binary
  100.      =================================================================================
  101.     */
  102.    
  103.     /**
  104.      * Transform the xml in <var>fileName</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  105.      *
  106.      * @param fileName Xml file to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  107.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  108.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  109.      */
  110.     public Binary readBinary(String fileName) throws DeserializerException {
  111.         return (Binary) this.xmlToObj(fileName, Binary.class);
  112.     }
  113.    
  114.     /**
  115.      * Transform the xml in <var>file</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  116.      *
  117.      * @param file Xml file to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  118.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  119.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  120.      */
  121.     public Binary readBinary(File file) throws DeserializerException {
  122.         return (Binary) this.xmlToObj(file, Binary.class);
  123.     }
  124.    
  125.     /**
  126.      * Transform the input stream <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  127.      *
  128.      * @param in InputStream to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  129.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  130.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  131.      */
  132.     public Binary readBinary(InputStream in) throws DeserializerException {
  133.         return (Binary) this.xmlToObj(in, Binary.class);
  134.     }  
  135.    
  136.     /**
  137.      * Transform the byte array <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  138.      *
  139.      * @param in Byte array to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  140.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  141.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  142.      */
  143.     public Binary readBinary(byte[] in) throws DeserializerException {
  144.         return (Binary) this.xmlToObj(in, Binary.class);
  145.     }  
  146.    
  147.     /**
  148.      * Transform the String <var>in</var> in the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  149.      *
  150.      * @param in String to use for the reconstruction of the object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  151.      * @return Object type {@link org.openspcoop2.web.lib.audit.log.Binary}
  152.      * @throws DeserializerException The exception that is thrown when an error occurs during deserialization
  153.      */
  154.     public Binary readBinaryFromString(String in) throws DeserializerException {
  155.         return (Binary) this.xmlToObj(in.getBytes(), Binary.class);
  156.     }  
  157.    
  158.    
  159.    

  160. }