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.     PDND_ORGANIZATION_EXTERNAL_ID("pdnd_org_ext_id"),
  42.     PDND_ORGANIZATION_CONSUMER_ID("pdnd_org_con_id"),
  43.    
  44.     CLIENT_ADDRESS("client_address"),
  45.     EVENTI("eventi"),
  46.     GRUPPI("gruppi"),
  47.     API("api");
  48.    
  49.     private String rawValue; // finisce sul db
  50.    
  51.     public String getRawValue() {
  52.         return this.rawValue;
  53.     }

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