IDUnivocoGroupByPolicyMapId.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.controllo_traffico.beans;

  21. import java.io.Serializable;

  22. /**    
  23.  *  IDUnivocoGroupByPolicyMapId
  24.  *
  25.  * @author Francesco Scarlato (scarlato@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class IDUnivocoGroupByPolicyMapId extends IDUnivocoGroupByPolicy implements Serializable  {

  30.     private static final long serialVersionUID = 1L;
  31.    
  32.     private String uniqueMapId = QUALSIASI;
  33.    
  34.     public IDUnivocoGroupByPolicyMapId() {
  35.     }
  36.    
  37.     public IDUnivocoGroupByPolicyMapId(IDUnivocoGroupByPolicy idSuper, String uniqueMapId) {
  38.         this.setRuoloPorta(idSuper.getRuoloPorta());
  39.         this.setProtocollo(idSuper.getProtocollo());
  40.         this.setFruitore(idSuper.getFruitore());
  41.         this.setServizioApplicativoFruitore(idSuper.getServizioApplicativoFruitore());
  42.         this.setServizioApplicativoToken(idSuper.getServizioApplicativoToken());
  43.         this.setErogatore(idSuper.getErogatore());
  44.         this.setServizioApplicativoErogatore(idSuper.getServizioApplicativoErogatore());
  45.         this.setServizio(idSuper.getServizio());
  46.         this.setAzione(idSuper.getAzione());
  47.         this.setTipoKey(idSuper.getTipoKey());
  48.         this.setNomeKey(idSuper.getNomeKey());
  49.         this.setValoreKey(idSuper.getValoreKey());
  50.         this.setIdentificativoAutenticato(idSuper.getIdentificativoAutenticato());
  51.         this.setTokenSubject(idSuper.getTokenSubject());
  52.         this.setTokenIssuer(idSuper.getTokenIssuer());
  53.         this.setTokenUsername(idSuper.getTokenUsername());
  54.         this.setTokenClientId(idSuper.getTokenClientId());
  55.         this.setTokenEMail(idSuper.getTokenEMail());
  56.         this.setPdndOrganizationName(idSuper.getPdndOrganizationName());
  57.        
  58.         // aggiunta
  59.         this.setUniqueMapId(uniqueMapId);
  60.     }
  61.    
  62.     @Override
  63.     public boolean match(IDUnivocoGroupByPolicy filtro){
  64.         if (filtro instanceof IDUnivocoGroupByPolicyMapId) {
  65.             return this.uniqueMapId.equals(((IDUnivocoGroupByPolicyMapId) filtro).uniqueMapId) && super.match(filtro);
  66.         } else {
  67.             return super.match(filtro);
  68.         }
  69.     }
  70.    
  71.    
  72.     @Override
  73.     public boolean equals(Object param){
  74.         if(param==null) {
  75.             return false;
  76.         }
  77.         return checkInstance(param);
  78.     }
  79.     private boolean checkInstance(Object param) {
  80.         if(param instanceof IDUnivocoGroupByPolicyMapId) {
  81.             return this.match((IDUnivocoGroupByPolicyMapId) param);
  82.         }
  83.         return false;
  84.     }
  85.    
  86.     // Utile per usare l'oggetto in hashtable come chiave
  87.     @Override
  88.     public int hashCode(){
  89.         return this.toString().hashCode();
  90.     }
  91.    

  92.     @Override
  93.     public String toString(){
  94.         return this.toString(false);
  95.     }
  96.     @Override
  97.     public String toString(boolean filterGroupByNotSet){
  98.        
  99.         StringBuilder bf = new StringBuilder(super.toString(filterGroupByNotSet));

  100.         if(!QUALSIASI.equals(this.uniqueMapId) || !filterGroupByNotSet){
  101.             if(filterGroupByNotSet){
  102.                 if(bf.length()>0){
  103.                     bf.append("\n");
  104.                 }
  105.                 bf.append("\t");
  106.             }
  107.             else{
  108.                 bf.append(" ");
  109.             }
  110.             bf.append("UniqueMapId:");
  111.             if(filterGroupByNotSet){
  112.                 bf.append(" ");
  113.             }
  114.             bf.append(this.uniqueMapId);
  115.         }
  116.        
  117.         return bf.toString();
  118.     }
  119.    
  120.     public String getUniqueMapId() {
  121.         return this.uniqueMapId;
  122.     }
  123.    
  124.     public void setUniqueMapId(String value) {
  125.         this.uniqueMapId = value;
  126.     }
  127. }