OperazioniList.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.operazioni;

  21. import java.util.ArrayList;
  22. import java.util.List;

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

  26. import org.apache.struts.action.Action;
  27. import org.apache.struts.action.ActionForm;
  28. import org.apache.struts.action.ActionForward;
  29. import org.apache.struts.action.ActionMapping;
  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. import org.openspcoop2.web.lib.queue.dao.Operation;

  38. /**
  39.  * OperazioniList
  40.  *
  41.  * @author Pintori Giuliano (pintori@link.it)
  42.  * @author $Author$
  43.  * @version $Rev$, $Date$
  44.  */
  45. public class OperazioniList 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.    
  55.         try {
  56.             OperazioniHelper opHelper = new OperazioniHelper(request, pd, session);
  57.            
  58.             ArrayList<String> errors = new ArrayList<>();
  59.             OperazioniFormBean formBean = opHelper.getBeanForm(errors );
  60.            
  61.             OperazioniCore opCore = new OperazioniCore();
  62.            
  63.             opHelper.makeMenu();

  64.             // Eseguo la ricerca
  65.             int idLista = opCore.getIdLista(formBean);
  66.            
  67.             ConsoleSearch ricerca = (ConsoleSearch) ServletUtils.getSearchObjectFromSession(request, session, ConsoleSearch.class);
  68.             ricerca = opHelper.checkSearchParameters(idLista, ricerca);
  69.             List<Operation> lista = opCore.operationsList(ricerca,formBean,ServletUtils.getUserLoginFromSession(session));

  70.             opHelper.prepareOperazioniList(ricerca, lista);

  71.             // salvo l'oggetto ricerca nella sessione
  72.             ServletUtils.setSearchObjectIntoSession(request, session, ricerca);
  73.        
  74.             ServletUtils.setObjectIntoSession(request, session, formBean, OperazioniCostanti.SESSION_ATTRIBUTE_FORM_BEAN);

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

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

  82. }