ExtendedConnettore.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.ctrlstat.plugins;

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

  23. import org.openspcoop2.utils.regexp.RegularExpressionEngine;

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

  32.     private String id;
  33.     private String idForOldValue;
  34.     private String section;
  35.     private String label;
  36.     private boolean enabled;
  37.     private List<ExtendedConnettoreItem> listItem = new ArrayList<ExtendedConnettoreItem>();
  38.    
  39.     private static final String EXTENDED_PREFIX_OLD = "ExtCntOld";
  40.     private static final String EXTENDED_PREFIX = "ExtCnt";
  41.     private static final int MAX_LENGTH = 90;
  42.    
  43.     public String getId() {
  44.         return this.id;
  45.     }
  46.     public String getIdForOldValue() {
  47.         return this.idForOldValue;
  48.     }
  49.     public void setId(String id) throws ExtendedException {
  50.        
  51.         if(id.length()>MAX_LENGTH){
  52.             throw new ExtendedException("ExtendedInfoConnettore [id:"+id+"] troppo lungo (max-length:"+MAX_LENGTH+")");
  53.         }
  54.         try{
  55.             if(!RegularExpressionEngine.isMatch(id,"^[0-9A-Za-z]+$")){
  56.                 throw new ExtendedException("ExtendedInfoConnettore [id:"+id+"] con caratteri non permessi. L'identificativo dev'essere formato solo da caratteri e cifre");
  57.             }
  58.         }catch(Exception e){
  59.             throw new ExtendedException(e.getMessage(),e);
  60.         }
  61.        
  62.         this.id = EXTENDED_PREFIX+id;
  63.         this.idForOldValue = EXTENDED_PREFIX_OLD+id;
  64.     }
  65.     public String getSection() {
  66.         return this.section;
  67.     }
  68.     public void setSection(String section) {
  69.         this.section = section;
  70.     }
  71.     public boolean isEnabled() {
  72.         return this.enabled;
  73.     }
  74.     public void setEnabled(boolean enabled) {
  75.         this.enabled = enabled;
  76.     }
  77.     public List<ExtendedConnettoreItem> getListItem() {
  78.         return this.listItem;
  79.     }
  80.     public void setListItem(List<ExtendedConnettoreItem> listItem) {
  81.         this.listItem = listItem;
  82.     }
  83.     public String getLabel() {
  84.         return this.label;
  85.     }
  86.     public void setLabel(String label) {
  87.         this.label = label;
  88.     }
  89.    
  90.    
  91. }