ArchiveUrlInvocazioneRegola.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.  * ArchiveUrlInvocazioneRegola
  24.  *
  25.  * @author Poli Andrea (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class ArchiveUrlInvocazioneRegola implements IPositionArchiveObject {

  30.     public static String buildKey(String nome) throws ProtocolException{
  31.        
  32.         if(nome==null){
  33.             throw new ProtocolException("nome non fornito");
  34.         }
  35.        
  36.         StringBuilder bf = new StringBuilder();
  37.         bf.append("UrlInvocazioneRegola_");
  38.         bf.append(nome);
  39.         return bf.toString();
  40.     }
  41.    
  42.     @Override
  43.     public String key() throws ProtocolException {
  44.         return ArchiveUrlInvocazioneRegola.buildKey(this.nome);
  45.     }
  46.    
  47.     @Override
  48.     public int position() throws ProtocolException {
  49.         return this.posizione;
  50.     }
  51.    
  52.    
  53.     private String nome;
  54.     private int posizione;
  55.     private org.openspcoop2.core.config.ConfigurazioneUrlInvocazioneRegola regola;
  56.    
  57.     private ArchiveIdCorrelazione idCorrelazione; // permette di correlare più oggetti tra di loro

  58.     public ArchiveUrlInvocazioneRegola(org.openspcoop2.core.config.ConfigurazioneUrlInvocazioneRegola regola, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  59.        
  60.         if(regola==null){
  61.             throw new ProtocolException("Regola per url di invocazione non fornita");
  62.         }
  63.         if(regola.getNome()==null){
  64.             throw new ProtocolException("Nome della regola per l'url di invocazione non definita");
  65.         }
  66.         this.nome = regola.getNome();
  67.         this.posizione = regola.getPosizione();
  68.         this.regola = regola;
  69.        
  70.         this.idCorrelazione = idCorrelazione;
  71.        
  72.     }
  73.    
  74.    
  75.     public String getNome() {
  76.         return this.nome;
  77.     }
  78.     public org.openspcoop2.core.config.ConfigurazioneUrlInvocazioneRegola getRegola() {
  79.         return this.regola;
  80.     }
  81.    
  82.     public ArchiveIdCorrelazione getIdCorrelazione() {
  83.         return this.idCorrelazione;
  84.     }

  85. }