ArchiveConfigurationPolicy.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.protocol.sdk.archive;

  21. import org.openspcoop2.protocol.sdk.ProtocolException;

  22. /**
  23.  * ArchiveConfigurationPolicy
  24.  *
  25.  * @author Poli Andrea (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class ArchiveConfigurationPolicy implements IArchiveObject {

  30.     public static String buildKey(String idPolicy) throws ProtocolException{
  31.        
  32.         if(idPolicy==null){
  33.             throw new ProtocolException("idPolicy non fornito");
  34.         }
  35.        
  36.         StringBuilder bf = new StringBuilder();
  37.         bf.append("ControlloTraffico_ConfigurationPolicy_");
  38.         bf.append(idPolicy);
  39.         return bf.toString();
  40.     }
  41.    
  42.     @Override
  43.     public String key() throws ProtocolException {
  44.         return ArchiveConfigurationPolicy.buildKey(this.idPolicy);
  45.     }
  46.    
  47.    
  48.    
  49.     private String idPolicy;
  50.     private org.openspcoop2.core.controllo_traffico.ConfigurazionePolicy policy;
  51.    
  52.     private ArchiveIdCorrelazione idCorrelazione; // permette di correlare più oggetti tra di loro

  53.     public ArchiveConfigurationPolicy(org.openspcoop2.core.controllo_traffico.ConfigurazionePolicy policy, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  54.        
  55.         if(policy==null){
  56.             throw new ProtocolException("Policy non fornito");
  57.         }
  58.         if(policy.getIdPolicy()==null){
  59.             throw new ProtocolException("Policy.idPolicy non definito");
  60.         }
  61.         this.idPolicy = policy.getIdPolicy();
  62.         this.policy = policy;
  63.        
  64.         this.idCorrelazione = idCorrelazione;
  65.        
  66.     }
  67.    
  68.    
  69.     public String getNomePolicy() {
  70.         return this.idPolicy;
  71.     }
  72.     public org.openspcoop2.core.controllo_traffico.ConfigurazionePolicy getPolicy() {
  73.         return this.policy;
  74.     }
  75.    
  76.     public ArchiveIdCorrelazione getIdCorrelazione() {
  77.         return this.idCorrelazione;
  78.     }

  79. }