ExtendedConnettoreItem.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 org.openspcoop2.utils.regexp.RegularExpressionEngine;

  22. /**    
  23.  * ExtendedConnettoreItem
  24.  *
  25.  * @author Poli Andrea (poli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class ExtendedConnettoreItem {
  30.    
  31.     private String id;
  32.     private String label;
  33.     private String note;
  34.     private String value;
  35.     private boolean required;
  36.     private String regularExpression;
  37.    
  38.     private static final String EXTENDED_PREFIX = "ExtCntItem";
  39.     private static final int MAX_LENGTH = 95;
  40.    
  41.     public String getId() {
  42.         return this.id;
  43.     }
  44.     public void setId(String id) throws ExtendedException {
  45.         if(id.length()>MAX_LENGTH){
  46.             throw new ExtendedException("ExtendedInfoConnettore [id:"+id+"] troppo lungo (max-length:"+MAX_LENGTH+")");
  47.         }
  48.         try{
  49.             if(!RegularExpressionEngine.isMatch(id,"^[0-9A-Za-z]+$")){
  50.                 throw new ExtendedException("ExtendedInfoConnettore [id:"+id+"] con caratteri non permessi. L'identificativo dev'essere formato solo da caratteri e cifre");
  51.             }
  52.         }catch(Exception e){
  53.             throw new ExtendedException(e.getMessage(),e);
  54.         }
  55.        
  56.         this.id = EXTENDED_PREFIX+id;
  57.     }
  58.     public String getLabel() {
  59.         return this.label;
  60.     }
  61.     public void setLabel(String label) {
  62.         this.label = label;
  63.     }
  64.     public String getNote() {
  65.         return this.note;
  66.     }
  67.     public void setNote(String note) {
  68.         this.note = note;
  69.     }
  70.     public String getValue() {
  71.         return this.value;
  72.     }
  73.     public void setValue(String value) {
  74.         this.value = value;
  75.     }
  76.     public boolean isRequired() {
  77.         return this.required;
  78.     }
  79.     public void setRequired(boolean required) {
  80.         this.required = required;
  81.     }
  82.     public String getRegularExpression() {
  83.         return this.regularExpression;
  84.     }
  85.     public void setRegularExpression(String regularExpression) {
  86.         this.regularExpression = regularExpression;
  87.     }


  88. }