FiltroRicercaSoggetti.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.Map;

  23. import org.openspcoop2.core.id.IDRuolo;
  24. import org.openspcoop2.core.registry.CredenzialiSoggetto;
  25. import org.openspcoop2.utils.crypt.CryptConfig;

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

  35. public class FiltroRicercaSoggetti extends FiltroRicerca implements Serializable{

  36.     /**
  37.      *
  38.      */
  39.     private static final long serialVersionUID = 1L;
  40.    
  41.     /** Pdd */
  42.     private String nomePdd;
  43.        
  44.     public String getNomePdd() {
  45.         return this.nomePdd;
  46.     }

  47.     public void setNomePdd(String nomePdd) {
  48.         this.nomePdd = nomePdd;
  49.     }
  50.    
  51.     /** Ruolo */
  52.     private IDRuolo idRuolo;
  53.        
  54.     public IDRuolo getIdRuolo() {
  55.         return this.idRuolo;
  56.     }

  57.     public void setIdRuolo(IDRuolo idRuolo) {
  58.         this.idRuolo = idRuolo;
  59.     }

  60.    
  61.     /** CredenzialeSoggetto */
  62.     private CredenzialiSoggetto credenzialiSoggetto;
  63.     private CryptConfig cryptConfig;
  64.    
  65.     public CryptConfig getCryptConfig() {
  66.         return this.cryptConfig;
  67.     }
  68.     public CredenzialiSoggetto getCredenzialiSoggetto() {
  69.         return this.credenzialiSoggetto;
  70.     }

  71.     public void setCredenzialiSoggetto(CredenzialiSoggetto credenzialiSoggetto, CryptConfig cryptConfig) {
  72.         this.credenzialiSoggetto = credenzialiSoggetto;
  73.         this.cryptConfig = cryptConfig;
  74.     }

  75.     /** Proprieta */
  76.     private Map<String, String> proprieta;
  77.     public Map<String, String> getProprieta() {
  78.         return this.proprieta;
  79.     }
  80.     public void setProprieta(Map<String, String> proprieta) {
  81.         this.proprieta = proprieta;
  82.     }

  83.     @Override
  84.     public String toString(){
  85.         StringBuilder bf = new StringBuilder();
  86.         bf.append("Filtro:");
  87.         this.addDetails(bf);
  88.         if(this.idRuolo!=null)
  89.             bf.append(" [ruolo:"+this.idRuolo+"]");
  90.         if(this.credenzialiSoggetto!=null){
  91.             if(this.credenzialiSoggetto.getTipo()!=null){
  92.                 bf.append(" [credenziali-tipo:"+this.credenzialiSoggetto.getTipo().getValue()+"]");
  93.             }
  94.             if(this.credenzialiSoggetto.getUser()!=null){
  95.                 bf.append(" [credenziali-user:"+this.credenzialiSoggetto.getUser()+"]");
  96.             }
  97.             if(this.credenzialiSoggetto.getPassword()!=null){
  98.                 bf.append(" [credenziali-password:"+this.credenzialiSoggetto.getPassword()+"]");
  99.             }
  100.             if(this.credenzialiSoggetto.getSubject()!=null){
  101.                 bf.append(" [credenziali-subject:"+this.credenzialiSoggetto.getSubject()+"]");
  102.             }
  103.         }
  104.         if(this.proprieta!=null && !this.proprieta.isEmpty()) {
  105.             bf.append(" [proprieta:"+this.proprieta.size()+"]");
  106.             for (String key : this.proprieta.keySet()) {
  107.                 bf.append(" [proprieta["+key+"]:");
  108.                 bf.append(this.proprieta.get(key)!=null ? this.proprieta.get(key):"");
  109.                 bf.append("]");
  110.             }
  111.         }
  112.         if(bf.length()=="Filtro:".length())
  113.             bf.append(" nessun filtro presente");
  114.         return bf.toString();
  115.     }
  116.     @Override
  117.     public void addDetails(StringBuilder bf){
  118.         if(this.nomePdd!=null)
  119.             bf.append(" [nomePdd:"+this.nomePdd+"]");
  120.         super.addDetails(bf);
  121.     }
  122. }