Filtro.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.web.lib.audit.dao;

  21. import java.io.Serializable;

  22. import org.openspcoop2.web.lib.audit.log.constants.Stato;
  23. import org.openspcoop2.web.lib.audit.log.constants.Tipologia;


  24. /**
  25.  * Dao contenente i valori della Configurazione dell'audit (Filtri)
  26.  *
  27.  *
  28.  * @author Andrea Poli (apoli@link.it)
  29.  * @author Stefano Corallo (corallo@link.it)
  30.  * @author Sandra Giangrandi (sandra@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  *
  34.  */
  35. public class Filtro implements Serializable {

  36.     /**
  37.      *
  38.      */
  39.     private static final long serialVersionUID = -5870944802330378174L;
  40.    
  41.     private String username;
  42.     private Tipologia tipoOperazione;
  43.     private String tipoOggettoInModifica; // es. AccordoServizio etc...
  44.     private Stato statoOperazione;
  45.     private String dump;
  46.     private boolean dumpExprRegular;
  47.    
  48.     // Action
  49.     private boolean auditEnabled = false;
  50.     private boolean dumpEnabled = false;
  51.    
  52.     private long id;

  53.    
  54.    
  55.    
  56.    
  57.     public String getUsername() {
  58.         return this.username;
  59.     }

  60.     public void setUsername(String username) {
  61.         this.username = username;
  62.     }

  63.     public Tipologia getTipoOperazione() {
  64.         return this.tipoOperazione;
  65.     }

  66.     public void setTipoOperazione(Tipologia tipoOperazione) {
  67.         this.tipoOperazione = tipoOperazione;
  68.     }

  69.     public String getTipoOggettoInModifica() {
  70.         return this.tipoOggettoInModifica;
  71.     }

  72.     public void setTipoOggettoInModifica(String tipoOggettoInModifica) {
  73.         this.tipoOggettoInModifica = tipoOggettoInModifica;
  74.     }

  75.     public Stato getStatoOperazione() {
  76.         return this.statoOperazione;
  77.     }

  78.     public void setStatoOperazione(Stato statoOperazione) {
  79.         this.statoOperazione = statoOperazione;
  80.     }

  81.     public String getDump() {
  82.         return this.dump;
  83.     }

  84.     public void setDump(String dump) {
  85.         this.dump = dump;
  86.     }

  87.     public boolean isDumpExprRegular() {
  88.         return this.dumpExprRegular;
  89.     }

  90.     public void setDumpExprRegular(boolean dumpExprRegular) {
  91.         this.dumpExprRegular = dumpExprRegular;
  92.     }
  93.    
  94.     public boolean isAuditEnabled() {
  95.         return this.auditEnabled;
  96.     }

  97.     public void setAuditEnabled(boolean auditEnabled) {
  98.         this.auditEnabled = auditEnabled;
  99.     }

  100.     public boolean isDumpEnabled() {
  101.         return this.dumpEnabled;
  102.     }

  103.     public void setDumpEnabled(boolean dumpEnabled) {
  104.         this.dumpEnabled = dumpEnabled;
  105.     }

  106.     public long getId() {
  107.         return this.id;
  108.     }

  109.     public void setId(long id) {
  110.         this.id = id;
  111.     }
  112.    
  113.    
  114.     @Override
  115.     public String toString(){
  116.         StringBuilder bf = new StringBuilder();
  117.        
  118.         if(this.username!=null){
  119.             bf.append("User["+this.username+"]");
  120.         }
  121.         if(bf.length()>0){
  122.             bf.append(" ");
  123.         }
  124.         if(this.tipoOperazione!=null){
  125.             bf.append("Op["+this.tipoOperazione.toString()+"]");
  126.         }
  127.         if(bf.length()>0){
  128.             bf.append(" ");
  129.         }
  130.         if(this.tipoOggettoInModifica!=null){
  131.             bf.append("Tipo["+this.tipoOggettoInModifica+"]");
  132.         }
  133.         if(bf.length()>0){
  134.             bf.append(" ");
  135.         }
  136.         if(this.statoOperazione!=null){
  137.             bf.append("Stato["+this.statoOperazione.toString()+"]");
  138.         }
  139.         if(bf.length()>0){
  140.             bf.append(" ");
  141.         }
  142.         if(this.dump!=null){
  143.            
  144.             String descr = this.dump;
  145.             if(this.dump.length()>30){
  146.                 descr = descr.substring(0, 27)+"...";
  147.             }
  148.            
  149.             if(this.dumpExprRegular){
  150.                 bf.append("FiltroContenuto-ExprReg["+descr+"]");
  151.             }else{
  152.                 bf.append("FiltroContenuto["+descr+"]");
  153.             }
  154.         }
  155.         return bf.toString();
  156.     }
  157. }