ServiziApplicativiCredenzialiList.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.sa;

  21. import javax.servlet.http.HttpServletRequest;
  22. import javax.servlet.http.HttpServletResponse;
  23. import javax.servlet.http.HttpSession;

  24. import org.apache.struts.action.Action;
  25. import org.apache.struts.action.ActionForm;
  26. import org.apache.struts.action.ActionForward;
  27. import org.apache.struts.action.ActionMapping;
  28. import org.openspcoop2.core.config.ServizioApplicativo;
  29. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  30. import org.openspcoop2.web.ctrlstat.servlet.GeneralHelper;
  31. import org.openspcoop2.web.lib.mvc.ForwardParams;
  32. import org.openspcoop2.web.lib.mvc.GeneralData;
  33. import org.openspcoop2.web.lib.mvc.PageData;
  34. import org.openspcoop2.web.lib.mvc.ServletUtils;

  35. /**
  36.  * ServiziApplicativiCredenzialiList
  37.  *
  38.  * @author Andrea Poli (apoli@link.it)
  39.  * @author Giuliano Pintori (pintori@link.it)
  40.  * @author $Author$
  41.  * @version $Rev$, $Date$
  42.  *
  43.  */
  44. public final class ServiziApplicativiCredenzialiList extends Action {

  45.     @Override
  46.     public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

  47.         HttpSession session = request.getSession(true);

  48.         // Inizializzo PageData
  49.         PageData pd = new PageData();

  50.         GeneralHelper generalHelper = new GeneralHelper(session);

  51.         // Inizializzo GeneralData
  52.         GeneralData gd = generalHelper.initGeneralData(request);

  53.         try {
  54.             ServiziApplicativiHelper saHelper = new ServiziApplicativiHelper(request, pd, session);
  55.            
  56.             // prelevo il flag che mi dice da quale pagina ho acceduto la sezione
  57.             Integer parentSA = ServletUtils.getIntegerAttributeFromSession(ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT, session, request);
  58.             if(parentSA == null) parentSA = ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT_NONE;
  59.             Boolean useIdSogg = parentSA == ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT_SOGGETTO;
  60.            
  61.             parentSA = useIdSogg ? ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT_SOGGETTO : ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT_NONE;
  62.            
  63.             String id = saHelper.getParameter(ServiziApplicativiCostanti.PARAMETRO_SERVIZI_APPLICATIVI_ID);
  64.             int idServizioApplicativo = Integer.parseInt(id);

  65.             // salvo il punto di ingresso
  66.             ServletUtils.setObjectIntoSession(request, session, parentSA, ServiziApplicativiCostanti.ATTRIBUTO_SERVIZI_APPLICATIVI_PARENT);

  67.             // Preparo il menu
  68.             saHelper.makeMenu();
  69.            
  70.             ServiziApplicativiCore saCore = new ServiziApplicativiCore();
  71.            
  72.             ServizioApplicativo sa = saCore.getServizioApplicativo(idServizioApplicativo);

  73.             saHelper.prepareServizioApplicativoCredenzialiList(sa, id);

  74.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  75.             return ServletUtils.getStrutsForward(mapping, ServiziApplicativiCostanti.OBJECT_NAME_SERVIZI_APPLICATIVI_CREDENZIALI, ForwardParams.LIST());

  76.         } catch (Exception e) {
  77.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  78.                     ServiziApplicativiCostanti.OBJECT_NAME_SERVIZI_APPLICATIVI_CREDENZIALI, ForwardParams.LIST());
  79.         }
  80.     }
  81. }