Resource.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.pdd.config;

  21. import java.util.Date;

  22. import org.openspcoop2.core.id.IDSoggetto;
  23. import org.openspcoop2.utils.id.UUIDUtilsGenerator;
  24. import org.openspcoop2.utils.id.UniqueIdentifierException;

  25. /**
  26.  * Identifica una risorsa rilasciata dai Manager
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */

  32. public class Resource {

  33.     /** Identificatore univoco risorsa */
  34.     private String id = null;
  35.    
  36.     /** Data di rilascio della risorsa */
  37.     private Date date = null;
  38.    
  39.     /** Identificativo Porta richiedente della risorsa */
  40.     private IDSoggetto identificativoPorta = null;
  41.    
  42.     /** Modulo funzionale richiedente della risorsa */
  43.     private String moduloFunzionale = null;
  44.    
  45.     /** IDTransazione */
  46.     private String idTransazione = null;
  47.    
  48.     /** Tipo della risorsa */
  49.     private String resourceType = null;
  50.    
  51.     /** Risorsa */
  52.     private Object resource = null;

  53.    
  54.     public static String generaIdentificatoreUnivoco(IDSoggetto identificativoPorta,String moduloFunzionale) throws UniqueIdentifierException{
  55.         if(identificativoPorta==null) {
  56.             throw new UniqueIdentifierException("Identificativo porta is null");
  57.         }
  58.         return identificativoPorta.getCodicePorta()+"_"+moduloFunzionale+"_"+
  59.                 UUIDUtilsGenerator.newUUID();
  60.                 // Inefficiente: UniqueIDGenerator.getUniqueID();
  61.     }
  62.    
  63.     /**
  64.      * @return the identificatoreUnivocoRisorsa
  65.      */
  66.     public String getId() {
  67.         return this.id;
  68.     }

  69.     /**
  70.      * @param identificatoreUnivocoRisorsa the identificatoreUnivocoRisorsa to set
  71.      */
  72.     public void setId(String identificatoreUnivocoRisorsa) {
  73.         this.id = identificatoreUnivocoRisorsa;
  74.     }

  75.     /**
  76.      * @return the dataRilascioRisorsa
  77.      */
  78.     public Date getDate() {
  79.         return this.date;
  80.     }

  81.     /**
  82.      * @param dataRilascioRisorsa the dataRilascioRisorsa to set
  83.      */
  84.     public void setDate(Date dataRilascioRisorsa) {
  85.         this.date = dataRilascioRisorsa;
  86.     }

  87.     /**
  88.      * @return the identificativoPorta
  89.      */
  90.     public IDSoggetto getIdentificativoPorta() {
  91.         return this.identificativoPorta;
  92.     }

  93.     /**
  94.      * @param identificativoPorta the identificativoPorta to set
  95.      */
  96.     public void setIdentificativoPorta(IDSoggetto identificativoPorta) {
  97.         this.identificativoPorta = identificativoPorta;
  98.     }

  99.     /**
  100.      * @return the moduloFunzionale
  101.      */
  102.     public String getModuloFunzionale() {
  103.         return this.moduloFunzionale;
  104.     }

  105.     /**
  106.      * @param moduloFunzionale the moduloFunzionale to set
  107.      */
  108.     public void setModuloFunzionale(String moduloFunzionale) {
  109.         this.moduloFunzionale = moduloFunzionale;
  110.     }

  111.     /**
  112.      * @return the tipoRisorsa
  113.      */
  114.     public String getResourceType() {
  115.         return this.resourceType;
  116.     }

  117.     /**
  118.      * @param tipoRisorsa the tipoRisorsa to set
  119.      */
  120.     public void setResourceType(String tipoRisorsa) {
  121.         this.resourceType = tipoRisorsa;
  122.     }

  123.     /**
  124.      * @return the risorsa
  125.      */
  126.     public Object getResource() {
  127.         return this.resource;
  128.     }

  129.     /**
  130.      * @param risorsa the risorsa to set
  131.      */
  132.     public void setResource(Object risorsa) {
  133.         this.resource = risorsa;
  134.     }
  135.    
  136.     public String getIdTransazione() {
  137.         return this.idTransazione;
  138.     }

  139.     public void setIdTransazione(String idTransazione) {
  140.         this.idTransazione = idTransazione;
  141.     }
  142.    
  143. }