ArchiveScope.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.core.id.IDScope;
  22. import org.openspcoop2.protocol.sdk.ProtocolException;

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

  31.     public static String buildKey(String nomeScope) throws ProtocolException{
  32.        
  33.         if(nomeScope==null){
  34.             throw new ProtocolException("nomeScope non fornito");
  35.         }
  36.        
  37.         StringBuilder bf = new StringBuilder();
  38.         bf.append("Scope_");
  39.         bf.append(nomeScope);
  40.         return bf.toString();
  41.     }
  42.    
  43.     @Override
  44.     public String key() throws ProtocolException {
  45.         return ArchiveScope.buildKey(this.idScope.getNome());
  46.     }
  47.    
  48.    
  49.    
  50.     private IDScope idScope;

  51.     private org.openspcoop2.core.registry.Scope scope;
  52.    
  53.     private ArchiveIdCorrelazione idCorrelazione; // permette di correlare più oggetti tra di loro

  54.     public ArchiveScope(org.openspcoop2.core.registry.Scope scope, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  55.        
  56.         if(scope==null){
  57.             throw new ProtocolException("Scope non fornito");
  58.         }
  59.         if(scope.getNome()==null){
  60.             throw new ProtocolException("Scope.nome non definito");
  61.         }
  62.         this.idScope = new IDScope(scope.getNome());
  63.         this.scope = scope;
  64.        
  65.         this.idCorrelazione = idCorrelazione;
  66.        
  67.     }
  68.    
  69.    
  70.     public IDScope getIdScope() {
  71.         return this.idScope;
  72.     }
  73.     public org.openspcoop2.core.registry.Scope getScope() {
  74.         return this.scope;
  75.     }
  76.    
  77.     public ArchiveIdCorrelazione getIdCorrelazione() {
  78.         return this.idCorrelazione;
  79.     }

  80. }