GestoreRepositoryDefault.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.protocol.engine.driver.repository;

  21. import org.openspcoop2.protocol.sdk.ProtocolException;



  22. /**
  23.  * Classe utilizzata per accedere ai flag di accesso al repository da parte di:
  24.  *  HISTORY: Busta usata per funzionalita di confermaRicezione(OUTBOX)/FiltroDuplicati(INBOX)
  25.  *  PROFILI: Busta usata per funzionalita di profili di collaborazione
  26.  *  PDD:     Busta usata eventualmente da un PdD
  27.  *
  28.  *
  29.  * @author Poli Andrea (apoli@link.it)
  30.  * @author $Author$
  31.  * @version $Rev$, $Date$
  32.  */
  33. public class GestoreRepositoryDefault implements IGestoreRepository{

  34.    
  35.     /**
  36.      * Imposta la modalita' di accesso per l'history
  37.      *
  38.      * @param value
  39.      */
  40.     @Override
  41.     public String createSQLSet_History(boolean value) throws ProtocolException{
  42.         if(value)
  43.             return "HISTORY=1";
  44.         else
  45.             return "HISTORY=0";
  46.     }
  47.    
  48.     /**
  49.      * Imposta la modalita' di accesso per i profili di collaborazione
  50.      *
  51.       * @param value
  52.      */
  53.     @Override
  54.     public String createSQLSet_ProfiloCollaborazione(boolean value) throws ProtocolException{
  55.         if(value)
  56.             return "PROFILO=1";
  57.         else
  58.             return "PROFILO=0";
  59.     }
  60.    
  61.     /**
  62.      * Imposta la modalita' di accesso per una pdd
  63.      *
  64.       * @param value
  65.      */
  66.     @Override
  67.     public String createSQLSet_PdD(boolean value) throws ProtocolException{
  68.         if(value)
  69.             return "PDD=1";
  70.         else
  71.             return "PDD=0";
  72.     }
  73.    
  74.     /**
  75.      * @param value Indicazione sull'utilizzo
  76.      */
  77.     @Override
  78.     public String createSQLCondition_History(boolean value) throws ProtocolException{
  79.         if(value)
  80.             return "HISTORY=1";
  81.         else
  82.             return "HISTORY=0";
  83.     }
  84.    
  85.     /**
  86.      * @param value Indicazione sull'utilizzo
  87.      */
  88.     @Override
  89.     public String createSQLCondition_ProfiloCollaborazione(boolean value) throws ProtocolException{
  90.         if(value)
  91.             return "PROFILO=1";
  92.         else
  93.             return "PROFILO=0";
  94.     }
  95.    
  96.     /**
  97.      * @param value Indicazione sull'utilizzo
  98.      */
  99.     @Override
  100.     public String createSQLCondition_PdD(boolean value) throws ProtocolException{
  101.         if(value)
  102.             return "PDD=1";
  103.         else
  104.             return "PDD=0";
  105.     }
  106.    

  107.     @Override
  108.     public String createSQLCondition_enableOnlyHistory() throws ProtocolException{
  109.         return "( HISTORY=1 AND PROFILO=0 AND PDD=0 )";
  110.     }
  111.    

  112.     @Override
  113.     public String createSQLCondition_enableOnlyPdd() throws ProtocolException{
  114.         return "( HISTORY=0 AND PROFILO=0 AND PDD=1 )";
  115.     }
  116.        

  117.     @Override
  118.     public String createSQLCondition_enableOnlyProfilo() throws ProtocolException{
  119.         return "( HISTORY=0 AND PROFILO=1 AND PDD=0 )";
  120.     }
  121.    

  122.     @Override
  123.     public String createSQLCondition_enableOnlyPddAndProfilo() throws ProtocolException{
  124.         return "( HISTORY=0 AND PROFILO=1 AND PDD=1 )";
  125.     }
  126.    

  127.     @Override
  128.     public String createSQLCondition_disabledAll() throws ProtocolException{
  129.         return "( HISTORY=0 AND PROFILO=0 AND PDD=0 )";
  130.     }

  131.    
  132.     /**
  133.      * Ritorna il valore da associare al field che gestisce l'History
  134.      *
  135.      * @return SQLField Value
  136.      * @throws ProtocolException
  137.      */
  138.     @Override
  139.     public String getSQLValueHistory(boolean history) throws ProtocolException{
  140.         if(history)
  141.             return "1";
  142.         else
  143.             return "0";
  144.     }
  145.    
  146.     /**
  147.      * Ritorna i field che gestiscono la modalita di accesso al Repository
  148.      *
  149.      * @return SQLField
  150.      * @throws ProtocolException
  151.      */
  152.     @Override
  153.     public String createSQLFields() throws ProtocolException{
  154.         return "HISTORY,PROFILO,PDD";
  155.     }
  156.    
  157.     /**
  158.      * Ritorna il field che gestisce la modalita di accesso all'History flag
  159.      *
  160.      * @return SQL Field History
  161.      * @throws ProtocolException
  162.      */
  163.     @Override
  164.     public String createSQLFieldHistory() throws ProtocolException{
  165.         return "HISTORY";
  166.     }
  167. }