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.         this.setPdndOrganizationExternalId(idSuper.getPdndOrganizationExternalId());
  58.         this.setPdndOrganizationConsumerId(idSuper.getPdndOrganizationConsumerId());
  59.        
  60.         // aggiunta
  61.         this.setUniqueMapId(uniqueMapId);
  62.     }
  63.    
  64.     @Override
  65.     public boolean match(IDUnivocoGroupByPolicy filtro){
  66.         if (filtro instanceof IDUnivocoGroupByPolicyMapId) {
  67.             return this.uniqueMapId.equals(((IDUnivocoGroupByPolicyMapId) filtro).uniqueMapId) && super.match(filtro);
  68.         } else {
  69.             return super.match(filtro);
  70.         }
  71.     }
  72.    
  73.    
  74.     @Override
  75.     public boolean equals(Object param){
  76.         if(param==null) {
  77.             return false;
  78.         }
  79.         return checkInstance(param);
  80.     }
  81.     private boolean checkInstance(Object param) {
  82.         if(param instanceof IDUnivocoGroupByPolicyMapId) {
  83.             return this.match((IDUnivocoGroupByPolicyMapId) param);
  84.         }
  85.         return false;
  86.     }
  87.    
  88.     // Utile per usare l'oggetto in hashtable come chiave
  89.     @Override
  90.     public int hashCode(){
  91.         return this.toString().hashCode();
  92.     }
  93.    

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

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