FiltroRicercaProtocolProperty.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.mapping;

  21. import java.io.Serializable;

  22. import org.openspcoop2.utils.sql.LikeConfig;

  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 FiltroRicercaProtocolProperty implements Serializable{

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

  38.     /** Nome */
  39.     private String name;
  40.    
  41.     /** Valore */
  42.     private String valueAsString;
  43.     /** Valore */
  44.     private LikeConfig searchWithLike;
  45.    
  46.     /** ValoreNumerico */
  47.     private Long valueAsLong;
  48.    
  49.     /** ValoreBoolean */
  50.     private Boolean valueAsBoolean;
  51.    
  52.     public String getName() {
  53.         return this.name;
  54.     }
  55.     public void setName(String name) {
  56.         this.name = name;
  57.     }
  58.     public String getValueAsString() {
  59.         return this.valueAsString;
  60.     }
  61.     public void setValueAsString(String valore) {
  62.         this.valueAsString = valore;
  63.     }
  64.     public LikeConfig getSearchWithLike() {
  65.         return this.searchWithLike;
  66.     }
  67.     public void setSearchWithLike(LikeConfig searchWithLike) {
  68.         this.searchWithLike = searchWithLike;
  69.     }
  70.     public Long getValueAsLong() {
  71.         return this.valueAsLong;
  72.     }
  73.     public void setValueAsLong(Long valoreNumerico) {
  74.         this.valueAsLong = valoreNumerico;
  75.     }
  76.     public Boolean getValueAsBoolean() {
  77.         return this.valueAsBoolean;
  78.     }
  79.     public void setValueAsBoolean(Boolean valueAsBoolean) {
  80.         this.valueAsBoolean = valueAsBoolean;
  81.     }
  82.    
  83.     @Override
  84.     public String toString(){
  85.         return this.toString(true);
  86.     }
  87.     public String toString(boolean checkEmpty){
  88.         StringBuilder bf = new StringBuilder();
  89.         bf.append("FiltroProtocolProperty: ");
  90.         this.addDetails(bf);
  91.         if(checkEmpty &&
  92.             bf.length()=="FiltroProtocolProperty: ".length()){
  93.             bf.append(" nessun filtro presente");
  94.         }
  95.         return bf.toString();
  96.     }
  97.     public void addDetails(StringBuilder bf){
  98.         if(this.name!=null)
  99.             bf.append(" [name:"+this.name+"]");
  100.         if(this.valueAsString!=null)
  101.             bf.append(" [value-string:"+this.valueAsString+"]");
  102.         if(this.valueAsLong!=null)
  103.             bf.append(" [value-long:"+this.valueAsLong+"]");
  104.         if(this.valueAsBoolean!=null)
  105.             bf.append(" [value-boolean:"+this.valueAsBoolean+"]");
  106.     }
  107. }