IDServizioApplicativoDB.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.db;

  21. import java.io.Serializable;

  22. import org.openspcoop2.core.id.IDServizioApplicativo;

  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 IDServizioApplicativoDB extends IDServizioApplicativo implements Serializable {

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

  37.     private Long id;

  38.     public Long getId() {
  39.         return this.id;
  40.     }

  41.     public void setId(Long id) {
  42.         this.id = id;
  43.     }
  44.    
  45.     public IDServizioApplicativoDB() {
  46.        
  47.     }
  48.     public IDServizioApplicativoDB(IDServizioApplicativo idSA) {
  49.         super.setNome(idSA.getNome());
  50.         super.setIdSoggettoProprietario(idSA.getIdSoggettoProprietario());
  51.     }

  52.     @Override
  53.     public String toString(){
  54.         StringBuilder bf = new StringBuilder();
  55.         bf.append(super.toString());
  56.         bf.append(" ");
  57.         if(this.id!=null)
  58.             bf.append("Id:"+this.id);
  59.         else
  60.             bf.append("Id");
  61.         return bf.toString();
  62.     }
  63.    
  64.     @Override
  65.     public boolean equals(Object object){
  66.         return super.equals(object);
  67.     }
  68.    
  69.     // Utile per usare l'oggetto in hashtable come chiave
  70.     @Override
  71.     public int hashCode(){
  72.         return this.toString().hashCode();
  73.     }
  74.    
  75.     @Override
  76.     public IDServizioApplicativoDB clone(){
  77.         IDServizioApplicativoDB idSA = new IDServizioApplicativoDB();
  78.         if(this.getNome()!=null){
  79.             idSA.setNome(new String(this.getNome()));
  80.         }
  81.         if(this.getIdSoggettoProprietario()!=null){
  82.             idSA.setIdSoggettoProprietario(this.getIdSoggettoProprietario().clone());
  83.         }
  84.         if(this.id!=null){
  85.             idSA.setId(Long.valueOf(this.id.longValue()+""));
  86.         }
  87.         return idSA;
  88.     }
  89. }