FiltroRicercaBase.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.config.driver;

  21. import java.io.Serializable;
  22. import java.util.Date;

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

  32. public class FiltroRicercaBase implements Serializable{

  33.    
  34.     /**
  35.      *
  36.      */
  37.     private static final long serialVersionUID = 1L;

  38.     /** Intervallo inferiore */
  39.     private Date minDate;
  40.    
  41.     /** Intervallo superiore */
  42.     private Date maxDate;
  43.    
  44.     /** Nome */
  45.     private String nome;
  46.    

  47.     /**
  48.      * @return the maxDate
  49.      */
  50.     public Date getMaxDate() {
  51.         return this.maxDate;
  52.     }

  53.     /**
  54.      * @param maxDate the maxDate to set
  55.      */
  56.     public void setMaxDate(Date maxDate) {
  57.         this.maxDate = maxDate;
  58.     }

  59.     /**
  60.      * @return the minDate
  61.      */
  62.     public Date getMinDate() {
  63.         return this.minDate;
  64.     }

  65.     /**
  66.      * @param minDate the minDate to set
  67.      */
  68.     public void setMinDate(Date minDate) {
  69.         this.minDate = minDate;
  70.     }

  71.     /**
  72.      * @return the nome
  73.      */
  74.     public String getNome() {
  75.         return this.nome;
  76.     }

  77.     /**
  78.      * @param nome the nome to set
  79.      */
  80.     public void setNome(String nome) {
  81.         this.nome = nome;
  82.     }

  83.    

  84.    
  85.     @Override
  86.     public String toString(){
  87.         return this.toString(true);
  88.     }
  89.     public String toString(boolean checkEmpty){
  90.         StringBuilder bf = new StringBuilder();
  91.         bf.append("Filtro:");
  92.         if(this.minDate!=null)
  93.             bf.append(" [intervallo-inferiore-data:"+this.minDate+"]");
  94.         if(this.maxDate!=null)
  95.             bf.append(" [intervallo-superiore-data:"+this.maxDate+"]");
  96.         if(this.nome!=null)
  97.             bf.append(" [nome:"+this.nome+"]");
  98.         if(checkEmpty){
  99.             if(bf.length()=="Filtro:".length()){
  100.                 bf.append(" nessun filtro presente");
  101.             }
  102.         }
  103.         return bf.toString();
  104.     }
  105. }