Permessi.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.users.dao;
  21. /**
  22.  * Permessi associabili ad un utente
  23.  *
  24.  *
  25.  * @author Andrea Poli (apoli@link.it)
  26.  * @author Stefano Corallo (corallo@link.it)
  27.  * @author Sandra Giangrandi (sandra@link.it)
  28.  * @author $Author$
  29.  * @version $Rev$, $Date$
  30.  *
  31.  */
  32. public enum Permessi {
  33.     SERVIZI("S"),DIAGNOSTICA("D"),REPORTISTICA("R"),SISTEMA("C"),CODE_MESSAGGI("M"),AUDITING("A"),UTENTI("U"),ACCORDI_COOPERAZIONE("P");
  34.    
  35.     private String value = null;
  36.     private Permessi(String s){
  37.         this.value = s;
  38.     }
  39.    
  40.     public static Permessi toPermessi(String value){
  41.         if("S".equals(value))
  42.             return SERVIZI;
  43.         else if("D".equals(value))
  44.             return DIAGNOSTICA;
  45.         else if("R".equals(value))
  46.             return REPORTISTICA;
  47.         else if("C".equals(value))
  48.             return SISTEMA;
  49.         else if("M".equals(value))
  50.             return CODE_MESSAGGI;
  51.         else if("A".equals(value))
  52.             return AUDITING;
  53.         else if("U".equals(value))
  54.             return UTENTI;
  55.         else if("P".equals(value))
  56.             return ACCORDI_COOPERAZIONE;
  57.         else
  58.             return null;
  59.     }
  60.    
  61.     public static String toString(Permessi value){
  62.         return value.toString();
  63.     }
  64.     public static String toString_HumanReadable(Permessi value){
  65.         return value.toString_HumanReadable();
  66.     }
  67.    
  68.    
  69.     @Override
  70.     public String toString(){
  71.         return this.value;
  72.     }
  73.    
  74.     public String toString_HumanReadable(){
  75.         if("S".equals(this.value))
  76.             return "Servizi";
  77.         else if("D".equals(this.value))
  78.             return "Monitoraggio";
  79.         else if("R".equals(this.value))
  80.             return "Reportistica";
  81.         else if("C".equals(this.value))
  82.             return "Sistema";
  83.         else if("M".equals(this.value))
  84.             return "Code Messaggi";
  85.         else if("A".equals(this.value))
  86.             return "Auditing";
  87.         else if("U".equals(this.value))
  88.             return "Utenti";
  89.         else if("P".equals(this.value))
  90.             return "Accordi Cooperazione";
  91.         else
  92.             return null;
  93.     }
  94. }