DynamicExtendedInfoDiagnosticoType.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.pdd.logger.diagnostica;

  21. import org.openspcoop2.core.commons.CoreException;

  22. /**    
  23.  * DynamicExtendedInfoDiagnosticoType
  24.  *
  25.  * @author Poli Andrea (poli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public enum DynamicExtendedInfoDiagnosticoType {

  30.     NON_RICOSTRUIBILE("SYS"),
  31.     POLICY_CONTROLLO_TRAFFICO("CT");
  32.     // Aggiungere altre gestioni qua
  33.    
  34.     private String value;
  35.     DynamicExtendedInfoDiagnosticoType(String v){
  36.         this.value= v;
  37.     }
  38.    
  39.     public String getValue() {
  40.         return this.value;
  41.     }
  42.    
  43.     public boolean equals(String d){
  44.         return this.value.equals(d);
  45.     }
  46.    
  47.     public static DynamicExtendedInfoDiagnosticoType getEnum(String v) throws CoreException{
  48.         if(NON_RICOSTRUIBILE.getValue().equals(v)){
  49.             return NON_RICOSTRUIBILE;
  50.         }
  51.         else if(POLICY_CONTROLLO_TRAFFICO.getValue().equals(v)){
  52.             return POLICY_CONTROLLO_TRAFFICO;
  53.         }
  54.         throw new CoreException("DynamicExtendedInfoDiagnosticoType ["+v+"] unknow");
  55.     }
  56. }