Filter.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.utils.serialization;

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

  23. /**
  24.  * Contiene le informazioni sul filtro da effettuare durante la serializzazione
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class Filter {

  31.     private List<Class<?>> filterByValue = new ArrayList<Class<?>>();
  32.        
  33.     public List<Class<?>> getFilterByValue() {
  34.         return this.filterByValue;
  35.     }

  36.     public void setFilterByValue(List<Class<?>> filter) {
  37.         this.filterByValue = filter;
  38.     }

  39.     public void addFilterByValue(Class<?> c){
  40.         this.filterByValue.add(c);
  41.     }
  42.    
  43.     public Class<?> getFilterByValue(int index){
  44.         return this.filterByValue.get(index);
  45.     }
  46.    
  47.     public Class<?> removeFilterByValue(int index){
  48.         return this.filterByValue.remove(index);
  49.     }
  50.    
  51.     public void clearFiltersByValue(){
  52.         this.filterByValue.clear();
  53.     }
  54.    
  55.     public int sizeFiltersByValue(){
  56.         return this.filterByValue.size();
  57.     }
  58.    
  59.    
  60.    
  61.    
  62.    
  63.     private List<String> filterByName = new ArrayList<>();
  64.    
  65.     public List<String> getFilterByName() {
  66.         return this.filterByName;
  67.     }

  68.     public void setFilterByName(List<String> filter) {
  69.         this.filterByName = filter;
  70.     }

  71.     public void addFilterByName(String c){
  72.         this.filterByName.add(c);
  73.     }
  74.    
  75.     public String getFilterByName(int index){
  76.         return this.filterByName.get(index);
  77.     }
  78.    
  79.     public String removeFilterByName(int index){
  80.         return this.filterByName.remove(index);
  81.     }
  82.    
  83.     public void clearFiltersByName(){
  84.         this.filterByName.clear();
  85.     }
  86.    
  87.     public int sizeFiltersByName(){
  88.         return this.filterByName.size();
  89.     }
  90.    
  91.    
  92.    
  93.    
  94.    
  95.    
  96.    
  97.    
  98.    
  99.    
  100.    
  101.    
  102.    
  103.     private FilterChecksumTypes filterChecksumType = FilterChecksumTypes.CRC;
  104.    
  105.     public FilterChecksumTypes getFilterChecksumType() {
  106.         return this.filterChecksumType;
  107.     }

  108.     public void setFilterChecksumType(FilterChecksumTypes filterChecksumType) {
  109.         this.filterChecksumType = filterChecksumType;
  110.     }


  111.    
  112.    
  113.    

  114.     private List<FilteredObject> oggettiFiltrati = new ArrayList<FilteredObject>();
  115.    
  116.     public void addFilteredObject(FilteredObject o){
  117.         this.oggettiFiltrati.add(o);
  118.     }
  119.    
  120.     public int sizeFilteredObjects(){
  121.         return this.oggettiFiltrati.size();
  122.     }
  123.    
  124.     public void clearFilteredObjects(){
  125.         this.oggettiFiltrati.clear();
  126.     }
  127.    
  128.     public FilteredObject getFilteredObject(int index){
  129.         return this.oggettiFiltrati.get(index);
  130.     }
  131.    
  132.     public FilteredObject removeFilteredObject(int index){
  133.         return this.oggettiFiltrati.remove(index);
  134.     }
  135.    
  136.     public boolean existsFilteredObject(String id){
  137.         for (FilteredObject filter : this.oggettiFiltrati) {
  138.             if(id.equals(filter.getId())){
  139.                 return true;
  140.             }
  141.         }
  142.         return false;
  143.     }
  144.    
  145.     public List<FilteredObject> getOggettiFiltrati() {
  146.         return this.oggettiFiltrati;
  147.     }

  148.     public void setOggettiFiltrati(List<FilteredObject> oggettiFiltrati) {
  149.         this.oggettiFiltrati = oggettiFiltrati;
  150.     }
  151. }