FiltroRicercaRuoli.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.registry.driver;

  21. import java.io.Serializable;

  22. import org.openspcoop2.core.registry.constants.RuoloContesto;
  23. import org.openspcoop2.core.registry.constants.RuoloTipologia;

  24. /**
  25.  * Permette il filtro di ricerca attraverso i driver che implementano l'interfaccia 'get'
  26.  *
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author Nardi Lorenzo (nardi@link.it)
  30.  * @author $Author$
  31.  * @version $Rev$, $Date$
  32.  */

  33. public class FiltroRicercaRuoli extends FiltroRicerca implements Serializable{

  34.     /**
  35.      *
  36.      */
  37.     private static final long serialVersionUID = 1L;
  38.    
  39.     /** RuoloTipologia */
  40.     private RuoloTipologia tipologia;
  41.     /** RuoloContesto */
  42.     private RuoloContesto contesto;
  43.        
  44.     public RuoloContesto getContesto() {
  45.         return this.contesto;
  46.     }

  47.     public void setContesto(RuoloContesto contesto) {
  48.         this.contesto = contesto;
  49.     }

  50.     public RuoloTipologia getTipologia() {
  51.         return this.tipologia;
  52.     }

  53.     public void setTipologia(RuoloTipologia tipologia) {
  54.         this.tipologia = tipologia;
  55.     }

  56.     @Override
  57.     public String getTipo() {
  58.         if(this.tipologia!=null){
  59.             return this.tipologia.getValue();
  60.         }
  61.         return null;
  62.     }

  63.     @Override
  64.     public void setTipo(String tipo) {
  65.         this.tipologia = RuoloTipologia.toEnumConstant(tipo);
  66.     }

  67.     @Override
  68.     public String toString(){
  69.         StringBuilder bf = new StringBuilder();
  70.         super.toString(false);
  71.         if(this.contesto!=null)
  72.             bf.append(" [contesto:"+this.contesto.getValue()+"]");
  73. //      Tipo gia' visualizzato con il super.toString        
  74. //      if(this.tipologia!=null)
  75. //          bf.append(" [tipologia:"+this.tipologia.getValue()+"]");
  76.         if(bf.length()=="Filtro:".length())
  77.             bf.append(" nessun filtro presente");
  78.         return bf.toString();
  79.     }
  80. }