Topic.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.logger.filetrace;

  21. import java.util.ArrayList;
  22. import java.util.List;

  23. import org.openspcoop2.monitor.sdk.transaction.FaseTracciamento;
  24. import org.slf4j.Logger;

  25. /**    
  26.  * Topic
  27.  *
  28.  * @author Poli Andrea (poli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class Topic {

  33.     private boolean erogazioni;
  34.     private String nome;
  35.     private boolean onlyRequestSent = false;
  36.     private boolean onlyInRequestContentDefined = false;
  37.     private boolean onlyOutRequestContentDefined = false;
  38.     private boolean onlyInResponseContentDefined = false;
  39.     private boolean onlyOutResponseContentDefined = false;
  40.     private List<FaseTracciamento> onlyInTrackingPhase = new ArrayList<>();
  41.    
  42.     private String categoryName;
  43.     private Logger log;
  44.    
  45.     private String format;
  46.    
  47.     public boolean isErogazioni() {
  48.         return this.erogazioni;
  49.     }
  50.     public void setErogazioni(boolean erogazioni) {
  51.         this.erogazioni = erogazioni;
  52.     }
  53.     public String getNome() {
  54.         return this.nome;
  55.     }
  56.     public void setNome(String nome) {
  57.         this.nome = nome;
  58.     }
  59.     public String getCategoryName() {
  60.         return this.categoryName;
  61.     }
  62.     public void setCategoryName(String categoryName) {
  63.         this.categoryName = categoryName;
  64.     }
  65.     public Logger getLog() {
  66.         return this.log;
  67.     }
  68.     public void setLog(Logger log) {
  69.         this.log = log;
  70.     }
  71.     @Deprecated
  72.     public boolean isOnlyRequestSended() {
  73.         return this.onlyRequestSent;
  74.     }
  75.     @Deprecated
  76.     public void setOnlyRequestSended(boolean onlyRequestSent) {
  77.         this.onlyRequestSent = onlyRequestSent;
  78.     }
  79.     public boolean isOnlyRequestSent() {
  80.         return this.onlyRequestSent;
  81.     }
  82.     public void setOnlyRequestSent(boolean onlyRequestSent) {
  83.         this.onlyRequestSent = onlyRequestSent;
  84.     }
  85.     public boolean isOnlyInRequestContentDefined() {
  86.         return this.onlyInRequestContentDefined;
  87.     }
  88.     public void setOnlyInRequestContentDefined(boolean onlyInRequestContentDefined) {
  89.         this.onlyInRequestContentDefined = onlyInRequestContentDefined;
  90.     }
  91.     public boolean isOnlyOutRequestContentDefined() {
  92.         return this.onlyOutRequestContentDefined;
  93.     }
  94.     public void setOnlyOutRequestContentDefined(boolean onlyOutRequestContentDefined) {
  95.         this.onlyOutRequestContentDefined = onlyOutRequestContentDefined;
  96.     }
  97.     public boolean isOnlyInResponseContentDefined() {
  98.         return this.onlyInResponseContentDefined;
  99.     }
  100.     public void setOnlyInResponseContentDefined(boolean onlyInResponseContentDefined) {
  101.         this.onlyInResponseContentDefined = onlyInResponseContentDefined;
  102.     }
  103.     public boolean isOnlyOutResponseContentDefined() {
  104.         return this.onlyOutResponseContentDefined;
  105.     }
  106.     public void setOnlyOutResponseContentDefined(boolean onlyOutResponseContentDefined) {
  107.         this.onlyOutResponseContentDefined = onlyOutResponseContentDefined;
  108.     }
  109.     public void addFaseTracciamento(FaseTracciamento fase) {
  110.         this.onlyInTrackingPhase.add(fase);
  111.     }
  112.     public boolean isEnabled(FaseTracciamento fase) {
  113.         if(this.onlyInTrackingPhase == null || this.onlyInTrackingPhase.isEmpty()) {
  114.             // default
  115.             /**System.out.println("ENABLE DEFAULT '"+this.nome+"' ["+fase+"]: "+(FaseTracciamento.POST_OUT_RESPONSE.equals(fase)));*/
  116.             //return FaseTracciamento.POST_OUT_RESPONSE.equals(fase);
  117.             /**System.out.println("ENABLE DEFAULT '"+this.nome+"' ["+fase+"]: "+true);*/
  118.             return true; // devo usare le fasi nella config per decidere se applicare solo in una fase
  119.         }
  120.         /**System.out.println("ENABLE '"+this.nome+"' ["+fase+"]: "+(this.onlyInTrackingPhase.contains(fase)));*/
  121.         return this.onlyInTrackingPhase.contains(fase);
  122.     }
  123.     public String getFormat() {
  124.         return this.format;
  125.     }
  126.     public void setFormat(String format) {
  127.         this.format = format;
  128.     }  
  129. }