ImporterStrutsBean.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.servlet.archivi;

  21. import java.io.Serializable;
  22. import java.util.List;

  23. import javax.servlet.http.HttpServletRequest;
  24. import javax.servlet.http.HttpSession;

  25. import org.openspcoop2.core.config.Credenziali;
  26. import org.openspcoop2.core.config.InvocazioneServizio;
  27. import org.openspcoop2.core.registry.Connettore;
  28. import org.openspcoop2.core.registry.PortType;
  29. import org.openspcoop2.protocol.engine.constants.Costanti;
  30. import org.openspcoop2.protocol.sdk.archive.MapPlaceholder;
  31. import org.openspcoop2.web.lib.mvc.ServletUtils;

  32. /**
  33.  * ImporterStrutsBean
  34.  *
  35.  * @author Andrea Poli (apoli@link.it)
  36.  * @author Stefano Corallo (corallo@link.it)
  37.  * @author Sandra Giangrandi (sandra@link.it)
  38.  * @author $Author$
  39.  * @version $Rev$, $Date$
  40.  *
  41.  */
  42. public class ImporterStrutsBean {

  43.     private static final String IMPORT_MAP_PLACE_HOLDER = Costanti.CONSOLE_ATTRIBUTO_TAB_SESSION_KEY_PREFIX + "importMap";
  44.     private static final String IMPORT_STEP = Costanti.CONSOLE_ATTRIBUTO_TAB_SESSION_KEY_PREFIX + "step";
  45.    
  46.     public ImporterStrutsBean(HttpServletRequest request, HttpSession session, boolean newInstance) {
  47.         if(!newInstance && session!=null) {
  48.             this.importInformationMissingGlobalPlaceholder = ServletUtils.getObjectFromSession(request, session, MapPlaceholder.class, IMPORT_MAP_PLACE_HOLDER);
  49.             this.stepCounter = ServletUtils.getObjectFromSession(request, session, StepCounter.class, IMPORT_STEP);
  50.         }
  51.         else {
  52.             this.importInformationMissingGlobalPlaceholder = new MapPlaceholder();
  53.             ServletUtils.setObjectIntoSession(request, session,
  54.                     this.importInformationMissingGlobalPlaceholder,
  55.                     IMPORT_MAP_PLACE_HOLDER);
  56.            
  57.             this.stepCounter = new StepCounter();
  58.             ServletUtils.setObjectIntoSession(request, session,
  59.                     this.stepCounter,
  60.                     IMPORT_STEP);
  61.         }
  62.     }
  63.    
  64.     protected String filePath;
  65.     protected String protocollo;
  66.     protected String importMode;
  67.     protected String importType;
  68.    
  69.     protected String importInformationMissingObjectId = null;
  70.     protected String importInformationMissingCollectionFilePath = null;
  71.    
  72.     // Campi per lo specifico missingObjectId in corso
  73.     protected Class<?> importInformationMissingClassObject = null;
  74.     protected Object importInformationMissingObject = null;
  75.     protected String importInformationMissingSoggettoInput = null;
  76.     protected String importInformationMissingVersioneInput = null;
  77.     protected List<PortType> importInformationMissingPortTypes = null;
  78.     protected String importInformationMissingModalitaAcquisizioneInformazioniProtocollo = null;
  79.     protected String importInformationMissingPortTypeImplementedInput = null;
  80.     protected String importInformationMissingAccordoServizioParteComuneInput = null;
  81.     protected String importInformationMissingAccordoCooperazioneInput = null;
  82.     protected InvocazioneServizio importInformationMissingInvocazioneServizio = null;
  83.     protected Connettore importInformationMissingConnettore = null;
  84.     protected Credenziali importInformationMissingCredenziali = null;
  85.    
  86.     protected boolean validazioneDocumenti = true;
  87.     protected boolean updateEnabled = false;
  88.     protected boolean importDeletePolicyConfig = false;
  89.     protected boolean importDeletePluginConfig = false;
  90.     protected boolean importConfig = false;
  91.    
  92.     // Variabili in sessione
  93.     protected MapPlaceholder importInformationMissingGlobalPlaceholder = new MapPlaceholder();
  94.     protected StepCounter stepCounter = null;

  95. }

  96. class StepCounter implements Serializable {
  97.    
  98.     private static final long serialVersionUID = 1L;
  99.    
  100.     private int step = 0;

  101.     public int getStep() {
  102.         return this.step;
  103.     }

  104.     public void increment() {
  105.         this.step++;
  106.     }
  107. }