ConnettoreFile_outputConfig.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.core.connettori;

  21. import java.io.File;

  22. /**
  23.  * ConnettoreFile_outputConfig
  24.  *
  25.  * @author Poli Andrea (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public class ConnettoreFile_outputConfig {

  30.     private File outputFile = null;
  31.     private Boolean writable = null;
  32.     private Boolean writable_ownerOnly = null;
  33.     private Boolean readable = null;
  34.     private Boolean readable_ownerOnly = null;
  35.     private Boolean executable = null;
  36.     private Boolean executable_ownerOnly = null;
  37.    
  38.     public File getOutputFile() {
  39.         return this.outputFile;
  40.     }
  41.     public void setOutputFile(File outputFile) {
  42.         this.outputFile = outputFile;
  43.     }
  44.     public Boolean getWritable() {
  45.         return this.writable;
  46.     }
  47.     public void setWritable(Boolean writable) {
  48.         this.writable = writable;
  49.     }
  50.     public Boolean getWritable_ownerOnly() {
  51.         return this.writable_ownerOnly;
  52.     }
  53.     public void setWritable_ownerOnly(Boolean writable_ownerOnly) {
  54.         this.writable_ownerOnly = writable_ownerOnly;
  55.     }
  56.     public Boolean getReadable() {
  57.         return this.readable;
  58.     }
  59.     public void setReadable(Boolean readable) {
  60.         this.readable = readable;
  61.     }
  62.     public Boolean getReadable_ownerOnly() {
  63.         return this.readable_ownerOnly;
  64.     }
  65.     public void setReadable_ownerOnly(Boolean readable_ownerOnly) {
  66.         this.readable_ownerOnly = readable_ownerOnly;
  67.     }
  68.     public Boolean getExecutable() {
  69.         return this.executable;
  70.     }
  71.     public void setExecutable(Boolean executable) {
  72.         this.executable = executable;
  73.     }
  74.     public Boolean getExecutable_ownerOnly() {
  75.         return this.executable_ownerOnly;
  76.     }
  77.     public void setExecutable_ownerOnly(Boolean executable_ownerOnly) {
  78.         this.executable_ownerOnly = executable_ownerOnly;
  79.     }
  80.    
  81.     public boolean isPermission() {
  82.         return this.getReadable()!=null ||
  83.                 this.getWritable()!=null ||
  84.                 this.getExecutable()!=null;
  85.     }
  86.     public String getPermissionAsString() {
  87.         StringBuilder sb = new StringBuilder();
  88.         if(this.readable!=null) {
  89.             if(sb.length()>0) {
  90.                 sb.append(" ");
  91.             }
  92.             if(this.readable_ownerOnly!=null && this.readable_ownerOnly) {
  93.                 sb.append("o");
  94.             }
  95.             if(this.readable) {
  96.                 sb.append("+");
  97.             }
  98.             else {
  99.                 sb.append("-");
  100.             }
  101.             sb.append("r");
  102.         }
  103.        
  104.         if(this.writable!=null) {
  105.             if(sb.length()>0) {
  106.                 sb.append(" ");
  107.             }
  108.             if(this.writable_ownerOnly!=null && this.writable_ownerOnly) {
  109.                 sb.append("o");
  110.             }
  111.             if(this.writable) {
  112.                 sb.append("+");
  113.             }
  114.             else {
  115.                 sb.append("-");
  116.             }
  117.             sb.append("w");
  118.         }
  119.        
  120.         if(this.executable!=null) {
  121.             if(sb.length()>0) {
  122.                 sb.append(" ");
  123.             }
  124.             if(this.executable_ownerOnly!=null && this.executable_ownerOnly) {
  125.                 sb.append("o");
  126.             }
  127.             if(this.executable) {
  128.                 sb.append("+");
  129.             }
  130.             else {
  131.                 sb.append("-");
  132.             }
  133.             sb.append("x");
  134.         }
  135.         return sb.toString();
  136.     }
  137.    
  138. }