FiltroRicercaResources.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 java.util.ArrayList;
  23. import java.util.List;

  24. /**
  25.  * Permette il filtro di ricerca attraverso i driver che implementano l'interfaccia 'get'
  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 FiltroRicercaResources extends FiltroRicercaAccordi implements Serializable{

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

  37.     /** Nome */
  38.     private String resourceName;

  39.     /** ProtocolProperty */
  40.     private List<FiltroRicercaProtocolPropertyRegistry> protocolPropertiesResources = new ArrayList<FiltroRicercaProtocolPropertyRegistry>();

  41.     public List<FiltroRicercaProtocolPropertyRegistry> getProtocolPropertiesResources() {
  42.         return this.protocolPropertiesResources;
  43.     }

  44.     public void setProtocolPropertiesResources(
  45.             List<FiltroRicercaProtocolPropertyRegistry> list) {
  46.         this.protocolPropertiesResources = list;
  47.     }

  48.     public void addProtocolPropertyResource(FiltroRicercaProtocolPropertyRegistry filtro){
  49.         this.protocolPropertiesResources.add(filtro);
  50.     }
  51.    
  52.     public String getResourceName() {
  53.         return this.resourceName;
  54.     }

  55.     public void setResourceName(String nome) {
  56.         this.resourceName = nome;
  57.     }
  58.    
  59.    
  60.     @Override
  61.     public String toString(){
  62.         StringBuilder bf = new StringBuilder();
  63.         bf.append("Filtro Resources: ");
  64.         this.addDetails(bf);
  65.         if(bf.length()=="Filtro Resources: ".length())
  66.             bf.append(" nessun filtro presente");
  67.         return bf.toString();
  68.     }
  69.     @Override
  70.     public void addDetails(StringBuilder bf){
  71.         if(this.resourceName!=null)
  72.             bf.append(" [nome-risorsa:"+this.resourceName+"]");
  73.         if(this.protocolPropertiesResources!=null && this.protocolPropertiesResources.size()>0){
  74.             bf.append(" [protocol-properties-resource:"+this.protocolPropertiesResources.size()+"]");
  75.             for (int i = 0; i < this.protocolPropertiesResources.size(); i++) {
  76.                 bf.append(" [protocol-properties-resource["+i+"]:"+this.protocolPropertiesResources.get(i).toString()+"]");
  77.             }
  78.         }
  79.         super.addDetails(bf);
  80.     }

  81. }