TipoOraRegistrazione.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.protocol.sdk.constants;

  21. import org.apache.commons.lang.NotImplementedException;

  22. /**
  23.  * TipoOraRegistrazione
  24.  *
  25.  * @author Andrea Poli (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public enum TipoOraRegistrazione {
  30.     LOCALE("Locale"),
  31.     SINCRONIZZATO("Sincronizzato"),
  32.     UNKNOWN("Sconosciuto");
  33.    
  34.     private final String tipoOra;

  35.     TipoOraRegistrazione(String tipoOra){
  36.         this.tipoOra = tipoOra;
  37.     }
  38.    
  39.     @Override
  40.     public String toString() {
  41.         throw new NotImplementedException("Use ProtocolFactory.createTraduttore().toString(tipoOra) or getEngineValue()");
  42.     }
  43.    
  44.     public boolean equals(String t){
  45.         if(t==null){
  46.             return false;
  47.         }
  48.         return this.tipoOra.equals(t);
  49.     }
  50.    
  51.     public String getEngineValue(){
  52.         return this.tipoOra;
  53.     }
  54.    
  55.     public static TipoOraRegistrazione toTipoOraRegistrazione(String metaValue){
  56.         if(LOCALE.tipoOra.equals(metaValue))
  57.             return LOCALE;
  58.         if(SINCRONIZZATO.tipoOra.equals(metaValue))
  59.             return SINCRONIZZATO;
  60.         return UNKNOWN;
  61.     }
  62.    
  63. }