TipoCredenzialeMittente.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.transazioni.utils;

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

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

  30.     TRASPORTO("trasporto"),
  31.    
  32.     TOKEN_ISSUER("token_issuer"),
  33.     TOKEN_CLIENT_ID("token_clientId"),
  34.     TOKEN_SUBJECT("token_subject"),
  35.     TOKEN_USERNAME("token_username"),
  36.     TOKEN_EMAIL("token_eMail"),
  37.    
  38.     PDND_CLIENT_JSON("pdnd_client_json"),
  39.     PDND_ORGANIZATION_JSON("pdnd_org_json"),
  40.     PDND_ORGANIZATION_NAME("pdnd_org_name"),
  41.    
  42.     CLIENT_ADDRESS("client_address"),
  43.     EVENTI("eventi"),
  44.     GRUPPI("gruppi"),
  45.     API("api");
  46.    
  47.     private String rawValue; // finisce sul db
  48.    
  49.     public String getRawValue() {
  50.         return this.rawValue;
  51.     }

  52.     TipoCredenzialeMittente(String rawValue){
  53.         this.rawValue = rawValue;
  54.     }
  55.    
  56.     public static TipoCredenzialeMittente toEnumConstant(String rawValue){
  57.         try{
  58.             return toEnumConstant(rawValue,false);
  59.         }catch(NotFoundException notFound){
  60.             return null;
  61.         }
  62.     }
  63.     public static TipoCredenzialeMittente toEnumConstant(String rawValue, boolean throwNotFoundException) throws NotFoundException{
  64.         TipoCredenzialeMittente res = null;
  65.         for (TipoCredenzialeMittente tmp : values()) {
  66.             if(tmp.getRawValue().equals(rawValue)){
  67.                 res = tmp;
  68.                 break;
  69.             }
  70.         }
  71.         if(res==null && throwNotFoundException){
  72.             throw new NotFoundException("Enum with value ["+rawValue+"] not found");
  73.         }
  74.         return res;
  75.     }
  76. }