IDConnettore.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.id;

  21. import java.io.Serializable;

  22. import org.openspcoop2.utils.Utilities;

  23. /**
  24.  * Classe utilizzata per rappresentare un identificatore di un Servizio Applicativo nella configurazione
  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 IDConnettore extends IDServizioApplicativo implements Serializable, Cloneable {

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

  37.     private String nomeConnettore;
  38.    
  39.    
  40.     public String getNomeConnettore() {
  41.         return this.nomeConnettore;
  42.     }
  43.     public void setNomeConnettore(String nomeConnettore) {
  44.         this.nomeConnettore = nomeConnettore;
  45.     }

  46.     @Override
  47.     public String toString(){
  48.         StringBuilder bf = new StringBuilder();
  49.         bf.append(super.toString());
  50.         bf.append(" ");
  51.         if(this.nomeConnettore!=null)
  52.             bf.append("Connettore:"+this.nomeConnettore);
  53.         else
  54.             bf.append("Connettore:NonDefinito");
  55.         return bf.toString();
  56.     }
  57.    
  58.     @Override
  59.     public boolean equals(Object object){
  60.         if(object == null)
  61.             return false;
  62.         if(!Utilities.equalsClass(object,this))
  63.             return false;
  64.         IDConnettore id = (IDConnettore) object;
  65.        
  66.         if(this.nomeConnettore==null){
  67.             if(id.nomeConnettore!=null)
  68.                 return false;
  69.         }else{
  70.             if(this.nomeConnettore.equals(id.nomeConnettore)==false)
  71.                 return false;
  72.         }

  73.         return super.equals(object);
  74.     }
  75.    
  76.     // Utile per usare l'oggetto in hashtable come chiave
  77.     @Override
  78.     public int hashCode(){
  79.         return this.toString().hashCode();
  80.     }
  81.    
  82.     @Override
  83.     public IDConnettore clone(){
  84.         IDConnettore idSA = new IDConnettore();
  85.         if(this.nome!=null){
  86.             idSA.nome = new String(this.nome);
  87.         }
  88.         if(this.idSoggettoProprietario!=null){
  89.             idSA.idSoggettoProprietario = this.idSoggettoProprietario.clone();
  90.         }
  91.         if(this.nomeConnettore!=null){
  92.             idSA.nomeConnettore = new String(this.nomeConnettore);
  93.         }
  94.         return idSA;
  95.     }
  96. }