ProprietaProtocolloValore.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.config.constants;

  21. import java.io.Serializable;
  22. import java.util.List;

  23. import org.openspcoop2.generic_project.beans.IEnumeration;
  24. import org.openspcoop2.generic_project.exception.NotFoundException;

  25. /**    
  26.  * Enumeration dell'elemento ProprietaProtocolloValore xsd (tipo:string)
  27.  *
  28.  * @author Poli Andrea (poli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. @javax.xml.bind.annotation.XmlType(name = "ProprietaProtocolloValore")
  33. @javax.xml.bind.annotation.XmlEnum(String.class)
  34. public enum ProprietaProtocolloValore implements IEnumeration , Serializable , Cloneable {

  35.     @javax.xml.bind.annotation.XmlEnumValue("tipoMittente")
  36.     TIPO_MITTENTE ("tipoMittente"),
  37.     @javax.xml.bind.annotation.XmlEnumValue("mittente")
  38.     MITTENTE ("mittente"),
  39.     @javax.xml.bind.annotation.XmlEnumValue("identificativoPortaMittente")
  40.     IDENTIFICATIVO_PORTA_MITTENTE ("identificativoPortaMittente"),
  41.     @javax.xml.bind.annotation.XmlEnumValue("tipoDestinatario")
  42.     TIPO_DESTINATARIO ("tipoDestinatario"),
  43.     @javax.xml.bind.annotation.XmlEnumValue("destinatario")
  44.     DESTINATARIO ("destinatario"),
  45.     @javax.xml.bind.annotation.XmlEnumValue("identificativoPortaDestinatario")
  46.     IDENTIFICATIVO_PORTA_DESTINATARIO ("identificativoPortaDestinatario"),
  47.     @javax.xml.bind.annotation.XmlEnumValue("tipoServizio")
  48.     TIPO_SERVIZIO ("tipoServizio"),
  49.     @javax.xml.bind.annotation.XmlEnumValue("servizio")
  50.     SERVIZIO ("servizio"),
  51.     @javax.xml.bind.annotation.XmlEnumValue("versioneServizio")
  52.     VERSIONE_SERVIZIO ("versioneServizio"),
  53.     @javax.xml.bind.annotation.XmlEnumValue("azione")
  54.     AZIONE ("azione"),
  55.     @javax.xml.bind.annotation.XmlEnumValue("identificativo")
  56.     IDENTIFICATIVO ("identificativo"),
  57.     @javax.xml.bind.annotation.XmlEnumValue("identificativoCorrelazioneApplicativa")
  58.     IDENTIFICATIVO_CORRELAZIONE_APPLICATIVA ("identificativoCorrelazioneApplicativa");
  59.    
  60.    
  61.     /** Value */
  62.     private String value;
  63.     @Override
  64.     public String getValue()
  65.     {
  66.         return this.value;
  67.     }


  68.     /** Official Constructor */
  69.     ProprietaProtocolloValore(String value)
  70.     {
  71.         this.value = value;
  72.     }


  73.    
  74.     @Override
  75.     public String toString(){
  76.         return this.value;
  77.     }
  78.     public boolean equals(String object){
  79.         if(object==null)
  80.             return false;
  81.         return object.equals(this.getValue());  
  82.     }
  83.    
  84.        
  85.    
  86.     /** compatibility with the generated bean (reflection) */
  87.     public boolean equals(Object object,List<String> fieldsNotCheck){
  88.         if( !(object instanceof ProprietaProtocolloValore) ){
  89.             java.lang.StringBuilder sb = new java.lang.StringBuilder();
  90.             if(fieldsNotCheck!=null && !fieldsNotCheck.isEmpty()){
  91.                 sb.append(" (fieldsNotCheck: ").append(fieldsNotCheck).append(")");
  92.             }
  93.             throw new org.openspcoop2.utils.UtilsRuntimeException("Wrong type"+sb.toString()+": "+object.getClass().getName());
  94.         }
  95.         return this.equals(object);
  96.     }
  97.     private String toStringEngine(Object object,boolean reportHTML,List<String> fieldsNotIncluded, StringBuilder bf){
  98.         java.lang.StringBuilder sb = new java.lang.StringBuilder();
  99.         if(reportHTML){
  100.             sb.append(" (reportHTML)");
  101.         }
  102.         if(fieldsNotIncluded!=null && !fieldsNotIncluded.isEmpty()){
  103.             sb.append(" (fieldsNotIncluded: ").append(fieldsNotIncluded).append(")");
  104.         }
  105.         if(object!=null){
  106.             sb.append(" (object: ").append(object.getClass().getName()).append(")");
  107.         }
  108.         if(sb.length()>0) {
  109.             bf.append(sb.toString());
  110.         }
  111.         return sb.length()>0 ? this.toString()+sb.toString() : this.toString();
  112.     }
  113.     public String toString(boolean reportHTML){
  114.         return toStringEngine(null, reportHTML, null, null);
  115.     }
  116.     public String toString(boolean reportHTML,List<String> fieldsNotIncluded){
  117.         return toStringEngine(null, reportHTML, fieldsNotIncluded, null);
  118.     }
  119.     public String diff(Object object,StringBuilder bf,boolean reportHTML){
  120.         return toStringEngine(object, reportHTML, null, bf);
  121.     }
  122.     public String diff(Object object,StringBuilder bf,boolean reportHTML,List<String> fieldsNotIncluded){
  123.         return toStringEngine(object, reportHTML, fieldsNotIncluded, bf);
  124.     }
  125.    
  126.    
  127.     /** Utilities */
  128.    
  129.     public static String[] toArray(){
  130.         String[] res = new String[values().length];
  131.         int i=0;
  132.         for (ProprietaProtocolloValore tmp : values()) {
  133.             res[i]=tmp.getValue();
  134.             i++;
  135.         }
  136.         return res;
  137.     }  
  138.     public static String[] toStringArray(){
  139.         String[] res = new String[values().length];
  140.         int i=0;
  141.         for (ProprietaProtocolloValore tmp : values()) {
  142.             res[i]=tmp.toString();
  143.             i++;
  144.         }
  145.         return res;
  146.     }
  147.     public static String[] toEnumNameArray(){
  148.         String[] res = new String[values().length];
  149.         int i=0;
  150.         for (ProprietaProtocolloValore tmp : values()) {
  151.             res[i]=tmp.name();
  152.             i++;
  153.         }
  154.         return res;
  155.     }
  156.    
  157.     public static boolean contains(String value){
  158.         return toEnumConstant(value)!=null;
  159.     }
  160.    
  161.     public static ProprietaProtocolloValore toEnumConstant(String value){
  162.         try{
  163.             return toEnumConstant(value,false);
  164.         }catch(NotFoundException notFound){
  165.             return null;
  166.         }
  167.     }
  168.     public static ProprietaProtocolloValore toEnumConstant(String value, boolean throwNotFoundException) throws NotFoundException{
  169.         ProprietaProtocolloValore res = null;
  170.         for (ProprietaProtocolloValore tmp : values()) {
  171.             if(tmp.getValue().equals(value)){
  172.                 res = tmp;
  173.                 break;
  174.             }
  175.         }
  176.         if(res==null && throwNotFoundException){
  177.             throw new NotFoundException("Enum with value ["+value+"] not found");
  178.         }
  179.         return res;
  180.     }
  181.    
  182.     public static IEnumeration toEnumConstantFromString(String value){
  183.         try{
  184.             return toEnumConstantFromString(value,false);
  185.         }catch(NotFoundException notFound){
  186.             return null;
  187.         }
  188.     }
  189.     public static IEnumeration toEnumConstantFromString(String value, boolean throwNotFoundException) throws NotFoundException{
  190.         ProprietaProtocolloValore res = null;
  191.         for (ProprietaProtocolloValore tmp : values()) {
  192.             if(tmp.toString().equals(value)){
  193.                 res = tmp;
  194.                 break;
  195.             }
  196.         }
  197.         if(res==null && throwNotFoundException){
  198.             throw new NotFoundException("Enum with value ["+value+"] not found");
  199.         }
  200.         return res;
  201.     }
  202. }