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

  30.     public static String buildKey(String object, String tipologiaPolicy, String nomePolicy) throws ProtocolException{
  31.        
  32.         if(tipologiaPolicy==null){
  33.             throw new ProtocolException("tipologiaPolicy non fornito");
  34.         }
  35.         if(nomePolicy==null){
  36.             throw new ProtocolException("nomePolicy non fornito");
  37.         }
  38.        
  39.         StringBuilder bf = new StringBuilder();
  40.         bf.append(object);
  41.         bf.append("_");
  42.         bf.append(tipologiaPolicy);
  43.         bf.append("_");
  44.         bf.append(nomePolicy);
  45.         return bf.toString();
  46.     }
  47.    
  48.    
  49.     protected String tipologiaPolicy; // validazione/negoziazione/attributeAuthority
  50.     protected String idPolicy;
  51.     protected org.openspcoop2.core.config.GenericProperties policy;
  52.    
  53.     protected ArchiveIdCorrelazione idCorrelazione; // permette di correlare più oggetti tra di loro

  54.     public AbstractArchiveGenericProperties(org.openspcoop2.core.config.GenericProperties policy, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  55.        
  56.         if(policy==null){
  57.             throw new ProtocolException("Policy non fornito");
  58.         }
  59.         if(policy.getTipologia()==null){
  60.             throw new ProtocolException("Policy.tipologia non definito");
  61.         }
  62.         if(policy.getNome()==null){
  63.             throw new ProtocolException("Policy.nome non definito");
  64.         }
  65.         this.tipologiaPolicy = policy.getTipologia();
  66.         this.idPolicy = policy.getNome();
  67.         this.policy = policy;
  68.        
  69.         this.idCorrelazione = idCorrelazione;
  70.        
  71.     }
  72.    
  73.     public String getTipologiaPolicy() {
  74.         return this.tipologiaPolicy;
  75.     }
  76.     public String getNomePolicy() {
  77.         return this.idPolicy;
  78.     }
  79.     public org.openspcoop2.core.config.GenericProperties getPolicy() {
  80.         return this.policy;
  81.     }
  82.    
  83.     public ArchiveIdCorrelazione getIdCorrelazione() {
  84.         return this.idCorrelazione;
  85.     }

  86. }