TipiConnettore.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.constants;

  21. /**
  22.  * Contiene i tipi di connettori di default
  23.  *
  24.  * @author corallo@link.it
  25.  * @author $Author$
  26.  * @version $Rev$, $Date$
  27.  */

  28. public enum TipiConnettore {

  29.     DISABILITATO ("disabilitato",null,null),
  30.     HTTP ("http",null,null),
  31.     HTTPS ("https",null,"Consente di ridefinire i certificati server e/o client"),
  32.     JMS ("jms",null,"Consente di consegnare la richiesta su una coda di un broker JMS"),
  33.     NULL ("null",null,"Consuma la richiesta e ritorna una risposta vuota"),
  34.     NULLECHO("nullEcho","echo","Restituisce in risposta la richiesta ricevuta"),
  35.     FILE ("file",null,"Consente di salvare la richiesta su filesystem e restituire una risposta"),
  36.     CUSTOM("custom",org.openspcoop2.core.constants.Costanti.LABEL_PARAMETRO_CUSTOM_IN_SELECT,null),
  37.     STATUS("status",null,"restituisce lo stato dell'API");
  38.    
  39.    
  40.     private final String nome;
  41.     private final String label;
  42.     private final String note;

  43.     TipiConnettore(String nome, String label, String note)
  44.     {
  45.         this.nome = nome;
  46.         this.label = label;
  47.         this.note = note;
  48.     }

  49.     public String getNome()
  50.     {
  51.         return this.nome;
  52.     }

  53.     public String getLabel() {
  54.         if(this.label!=null) {
  55.             return this.label;
  56.         }
  57.         return this.nome;
  58.     }

  59.     public String getNote() {
  60.         return this.note;
  61.     }
  62.    
  63.     @Override
  64.     public String toString() {
  65.         return this.nome;
  66.     }
  67.    
  68.     public static TipiConnettore toEnumFromName(String name) {
  69.         TipiConnettore [] tipi = TipiConnettore.values();
  70.         for (int i = 0; i < tipi.length; i++) {
  71.             TipiConnettore tipo = tipi[i];
  72.             if(tipo.getNome().equals(name)) {
  73.                 return tipo;
  74.             }
  75.         }
  76.         return null;
  77.     }
  78. }