SoggettiRuoliList.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.soggetti;

  21. import java.util.List;

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

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

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

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

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

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

  51.         GeneralHelper generalHelper = new GeneralHelper(session);

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

  54.         try {
  55.             SoggettiHelper soggettiHelper = new SoggettiHelper(request, pd, session);

  56.             String id = soggettiHelper.getParameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID);
  57.             int idSogg = Integer.parseInt(id);
  58.            
  59.             SoggettiCore soggettiCore = new SoggettiCore();

  60.             // Preparo il menu
  61.             soggettiHelper.makeMenu();

  62.             // Preparo la lista
  63.             ConsoleSearch ricerca = (ConsoleSearch) ServletUtils.getSearchObjectFromSession(request, session, ConsoleSearch.class);

  64.             int idLista = Liste.SOGGETTI_RUOLI;

  65.             ricerca = soggettiHelper.checkSearchParameters(idLista, ricerca);
  66.            
  67.             List<String> lista = soggettiCore.soggettiRuoliList(idSogg, ricerca);
  68.            
  69.             soggettiHelper.prepareRuoliList(ricerca, lista);
  70.            
  71.             // salvo l'oggetto ricerca nella sessione
  72.             ServletUtils.setSearchObjectIntoSession(request, session, ricerca);

  73.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);
  74.             // Forward control to the specified success URI
  75.             return ServletUtils.getStrutsForward (mapping,
  76.                     SoggettiCostanti.OBJECT_NAME_SOGGETTI_RUOLI,
  77.                     ForwardParams.LIST());
  78.         } catch (Exception e) {
  79.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  80.                     SoggettiCostanti.OBJECT_NAME_SOGGETTI_RUOLI, ForwardParams.LIST());
  81.         }
  82.     }
  83. }