ConfigurazioneAllarmiAdd.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.config;

  21. import java.text.MessageFormat;
  22. import java.util.ArrayList;
  23. import java.util.Date;
  24. import java.util.List;

  25. import javax.servlet.http.HttpServletRequest;
  26. import javax.servlet.http.HttpServletResponse;
  27. import javax.servlet.http.HttpSession;

  28. import org.apache.struts.action.Action;
  29. import org.apache.struts.action.ActionForm;
  30. import org.apache.struts.action.ActionForward;
  31. import org.apache.struts.action.ActionMapping;
  32. import org.openspcoop2.core.allarmi.AllarmeFiltro;
  33. import org.openspcoop2.core.allarmi.AllarmeMail;
  34. import org.openspcoop2.core.allarmi.AllarmeParametro;
  35. import org.openspcoop2.core.allarmi.AllarmeRaggruppamento;
  36. import org.openspcoop2.core.allarmi.AllarmeScript;
  37. import org.openspcoop2.core.allarmi.constants.RuoloPorta;
  38. import org.openspcoop2.core.allarmi.constants.StatoAllarme;
  39. import org.openspcoop2.core.allarmi.constants.TipoAllarme;
  40. import org.openspcoop2.core.allarmi.utils.AllarmiConverterUtils;
  41. import org.openspcoop2.core.allarmi.utils.AllarmiDriverUtils;
  42. import org.openspcoop2.core.commons.Filtri;
  43. import org.openspcoop2.core.commons.Liste;
  44. import org.openspcoop2.core.config.PortaApplicativa;
  45. import org.openspcoop2.core.config.PortaDelegata;
  46. import org.openspcoop2.core.id.IDPortaApplicativa;
  47. import org.openspcoop2.core.id.IDPortaDelegata;
  48. import org.openspcoop2.core.plugins.Plugin;
  49. import org.openspcoop2.core.plugins.constants.TipoPlugin;
  50. import org.openspcoop2.message.constants.ServiceBinding;
  51. import org.openspcoop2.monitor.engine.alarm.AlarmEngineConfig;
  52. import org.openspcoop2.monitor.engine.alarm.utils.AllarmiUtils;
  53. import org.openspcoop2.monitor.engine.alarm.wrapper.ConfigurazioneAllarmeBean;
  54. import org.openspcoop2.monitor.engine.dynamic.DynamicFactory;
  55. import org.openspcoop2.monitor.engine.dynamic.IDynamicLoader;
  56. import org.openspcoop2.monitor.sdk.condition.Context;
  57. import org.openspcoop2.monitor.sdk.plugins.IAlarmProcessing;
  58. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  59. import org.openspcoop2.web.ctrlstat.core.ConsoleSearch;
  60. import org.openspcoop2.web.ctrlstat.servlet.GeneralHelper;
  61. import org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeCore;
  62. import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateCore;
  63. import org.openspcoop2.web.ctrlstat.servlet.soggetti.SoggettiCore;
  64. import org.openspcoop2.web.lib.mvc.Costanti;
  65. import org.openspcoop2.web.lib.mvc.DataElement;
  66. import org.openspcoop2.web.lib.mvc.ForwardParams;
  67. import org.openspcoop2.web.lib.mvc.GeneralData;
  68. import org.openspcoop2.web.lib.mvc.PageData;
  69. import org.openspcoop2.web.lib.mvc.Parameter;
  70. import org.openspcoop2.web.lib.mvc.ServletUtils;
  71. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  72. /**    
  73.  * ConfigurazioneAllarmiAdd
  74.  *
  75.  * @author Pintori Giuliano (pintori@link.it)
  76.  * @author $Author$
  77.  * @version $Rev$, $Date$
  78.  */
  79. public class ConfigurazioneAllarmiAdd extends Action {

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

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

  83.         // Inizializzo PageData
  84.         PageData pd = new PageData();

  85.         GeneralHelper generalHelper = new GeneralHelper(session);

  86.         // Inizializzo GeneralData
  87.         GeneralData gd = generalHelper.initGeneralData(request);

  88.         String userLogin = ServletUtils.getUserLoginFromSession(session);  
  89.        
  90.         TipoOperazione tipoOperazione = TipoOperazione.ADD;
  91.        
  92.         String pluginSelectedExceptionMessage = null;

  93.         try {
  94.             StringBuilder sbParsingError = new StringBuilder();
  95.            
  96.             ConfigurazioneHelper confHelper = new ConfigurazioneHelper(request, pd, session);
  97.            
  98.             // controllo primo accesso
  99.             boolean first = confHelper.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
  100.                        
  101.             String ruoloPortaParam = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA);
  102.             RuoloPorta ruoloPorta = null;
  103.             if(ruoloPortaParam!=null) {
  104.                 ruoloPorta = RuoloPorta.toEnumConstant(ruoloPortaParam);
  105.             }
  106.             String nomePorta = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA);
  107.             ServiceBinding serviceBinding = null;
  108.             String serviceBindingParam = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING);
  109.             if(serviceBindingParam!=null && !"".equals(serviceBindingParam)) {
  110.                 serviceBinding = ServiceBinding.valueOf(serviceBindingParam);
  111.             }
  112.             String nomePlugin = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN);
  113.            
  114.             ConfigurazioneCore confCore = new ConfigurazioneCore();
  115.             SoggettiCore soggettiCore = new SoggettiCore(confCore);
  116.             PorteDelegateCore pdCore = new PorteDelegateCore(confCore);
  117.             PorteApplicativeCore paCore = new PorteApplicativeCore(confCore);
  118.            
  119.             AlarmEngineConfig alarmEngineConfig = confCore.getAllarmiConfig();
  120.            
  121.             ConfigurazioneAllarmeBean allarme = new ConfigurazioneAllarmeBean();
  122.             allarme.setEnabled(1);
  123.             allarme.setTipo(null);
  124.             allarme.setTipoAllarme(null);
  125.             allarme.setMail(new AllarmeMail());
  126.             allarme.getMail().setInvia(0);
  127.             allarme.getMail().setInviaWarning(0);
  128.             allarme.setScript(new AllarmeScript());
  129.             allarme.getScript().setInvoca(0);
  130.             allarme.getScript().setInvocaWarning(0);
  131.             allarme.setFiltro(new AllarmeFiltro());
  132.             allarme.setGroupBy(new AllarmeRaggruppamento());
  133.            
  134.             if(first) {
  135.                 confHelper.savePluginIntoSession(request, session, null);
  136.                 confHelper.saveParametriIntoSession(request, session, null);
  137.             }
  138.            
  139.             List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters = confHelper.readParametriFromSession(request, session);
  140.            
  141.             String applicabilita = Filtri.FILTRO_APPLICABILITA_VALORE_CONFIGURAZIONE;
  142.             if(ruoloPorta!=null) {
  143.                 if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
  144.                     applicabilita = Filtri.FILTRO_APPLICABILITA_VALORE_FRUIZIONE;
  145.                 }
  146.                 else {
  147.                     applicabilita = Filtri.FILTRO_APPLICABILITA_VALORE_EROGAZIONE;
  148.                 }
  149.             }
  150.            
  151.             List<Plugin> listaPlugin = confCore.pluginsAllarmiList(applicabilita, true);
  152.             int numeroPluginRegistrati = listaPlugin.size();
  153.            
  154.             Plugin plugin = confHelper.readPluginFromSession(request, session);
  155.             allarme.setPlugin(plugin);
  156.                        
  157.             // Dati Attivazione
  158.             String errorAttivazione = confHelper.readAllarmeFromRequest(tipoOperazione, first, allarme, alarmEngineConfig, plugin, parameters);
  159.             if(errorAttivazione!=null){
  160.                 confHelper.addParsingError(sbParsingError,errorAttivazione);
  161.             }
  162.            
  163.             if(ruoloPorta!=null) {
  164.                
  165.                 String protocollo = null;
  166.                 String tipoSoggettoProprietario = null;
  167.                 String nomeSoggettoProprietario = null;
  168.                 if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
  169.                     IDPortaDelegata idPD = new IDPortaDelegata();
  170.                     idPD.setNome(nomePorta);
  171.                     PortaDelegata porta = pdCore.getPortaDelegata(idPD);
  172.                     protocollo = soggettiCore.getProtocolloAssociatoTipoSoggetto(porta.getTipoSoggettoProprietario());
  173.                     // il tipo e nome serve per l'applicativo fruitore
  174.                     tipoSoggettoProprietario = porta.getTipoSoggettoProprietario();
  175.                     nomeSoggettoProprietario = porta.getNomeSoggettoProprietario();
  176.                 }
  177.                 else {
  178.                     IDPortaApplicativa idPA = new IDPortaApplicativa();
  179.                     idPA.setNome(nomePorta);
  180.                     PortaApplicativa porta = paCore.getPortaApplicativa(idPA);
  181.                     protocollo = soggettiCore.getProtocolloAssociatoTipoSoggetto(porta.getTipoSoggettoProprietario());
  182.                 }
  183.                
  184.                 allarme.getFiltro().setEnabled(true);
  185.                 allarme.getFiltro().setProtocollo(protocollo);
  186.                 allarme.getFiltro().setRuoloPorta(ruoloPorta);
  187.                 allarme.getFiltro().setNomePorta(nomePorta);
  188.                 if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
  189.                     allarme.getFiltro().setTipoFruitore(tipoSoggettoProprietario);
  190.                     allarme.getFiltro().setNomeFruitore(nomeSoggettoProprietario);
  191.                 }
  192.                
  193.             }
  194.            
  195.            
  196.             // Preparo il menu
  197.             confHelper.makeMenu();
  198.            
  199.             String postBackElementName = confHelper.getPostBackElementName();
  200.             if (postBackElementName != null) {
  201.                 // selezione del plugin
  202.                 if(postBackElementName.equals(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN)) {
  203.                     if(nomePlugin.equals(ConfigurazioneCostanti.DEFAULT_VALUE_NESSUNO)) {
  204.                         allarme.setNome(null);
  205.                         allarme.setTipoAllarme(null);
  206.                         allarme.setPlugin(null);
  207.                         parameters=null;
  208.                        
  209.                         confHelper.removeParametriFromSession(request, session);
  210.                         confHelper.removePluginFromSession(request, session);
  211.                     } else {
  212.                         for (Plugin pluginBean : listaPlugin) {
  213.                             String key = pluginBean.getLabel() + ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN_NOME_SEP + pluginBean.getClassName();
  214.                             if(key.equals(nomePlugin)) {
  215.                                 plugin = pluginBean;
  216.                                 break;
  217.                             }
  218.                         }
  219.                        
  220.                        
  221.                         allarme.setPlugin(plugin);
  222.                         parameters=null;
  223.                        
  224.                         if(allarme.getPlugin() != null) {
  225.                             allarme.setNome(allarme.getPlugin().getLabel());
  226.                             allarme.setTipo(allarme.getPlugin().getTipo());
  227.                             try{
  228.                                 Context context = confHelper.createAlarmContext(allarme, parameters);  
  229.                                
  230.                                 if(confCore.isShowAllarmiFormNomeSuggeritoCreazione()!=null && confCore.isShowAllarmiFormNomeSuggeritoCreazione().booleanValue()) {
  231.                                     allarme.setAlias(AllarmiUtils.costruisciAliasAllarme(allarme, ControlStationCore.getLog(), context));
  232.                                 }
  233.                                
  234.                                 String serialId = confCore.getNextAlarmInstanceSerialId(allarme.getPlugin().getTipo());
  235.                                 allarme.setNome(AllarmiDriverUtils.buildIdAlarm(allarme.getPlugin().getTipo(), serialId));
  236.                                                                
  237.                                 allarme.setDescrizione(allarme.getPlugin().getDescrizione());
  238.                                
  239.                                 IDynamicLoader dl = DynamicFactory.getInstance().newDynamicLoader(TipoPlugin.ALLARME, allarme.getPlugin().getTipo(), allarme.getPlugin().getClassName(), ControlStationCore.getLog());
  240.                                 IAlarmProcessing alarm = (IAlarmProcessing) dl.newInstance();
  241.                                 switch (alarm.getAlarmType()) {
  242.                                 case ACTIVE:
  243.                                     allarme.setTipoAllarme(TipoAllarme.ATTIVO);
  244.                                     break;
  245.                                 case PASSIVE:
  246.                                     allarme.setTipoAllarme(TipoAllarme.PASSIVO);
  247.                                     break;
  248.                                 }
  249.                                            
  250.                                 parameters = confCore.getParameters(allarme, context);
  251.                                                                
  252.                                 confHelper.saveParametriIntoSession(request, session, parameters);
  253.                                 confHelper.savePluginIntoSession(request, session, allarme.getPlugin());
  254.                             }catch(Exception e){
  255.                                 ControlStationCore.getLog().error(e.getMessage(), e);
  256.                                 allarme.setNome(null);
  257.                                 allarme.setTipoAllarme(null);
  258.                                 allarme.setPlugin(null);
  259.                                 allarme.setTipo(null);
  260.                                 parameters=null;
  261.                                 pluginSelectedExceptionMessage = e.getMessage();
  262.                                 confHelper.removeParametriFromSession(request, session);
  263.                                 confHelper.removePluginFromSession(request, session);
  264.                             }
  265.                         }
  266.                     }
  267.                 }
  268.             }
  269.            
  270.             List<Parameter> lstParamSession = new ArrayList<>();

  271.             Parameter parRuoloPorta = null;
  272.             if(ruoloPorta!=null) {
  273.                 parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
  274.                 lstParamSession.add(parRuoloPorta);
  275.             }
  276.             Parameter parNomePorta = null;
  277.             if(nomePorta!=null) {
  278.                 parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
  279.                 lstParamSession.add(parNomePorta);
  280.             }
  281.             Parameter parServiceBinding = null;
  282.             if(serviceBinding!=null) {
  283.                 parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
  284.                 lstParamSession.add(parServiceBinding);
  285.             }
  286.            
  287.             List<Parameter> lstParamPorta = null;
  288.             if(ruoloPorta!=null) {
  289.                 lstParamPorta = confHelper.getTitleListAllarmi(ruoloPorta, nomePorta, serviceBinding, Costanti.PAGE_DATA_TITLE_LABEL_AGGIUNGI);
  290.             }
  291.            
  292.             // setto la barra del titolo
  293.             List<Parameter> lstParam = null;
  294.             if(lstParamPorta!=null) {
  295.                 lstParam = lstParamPorta;
  296.             }
  297.             else {
  298.                 lstParam = new ArrayList<>();
  299.                
  300.                 if(!lstParamSession.isEmpty()) {
  301.                     lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
  302.                         ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST, lstParamSession.toArray(new Parameter[lstParamSession.size()])));
  303.                 } else {
  304.                     lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
  305.                         ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST));
  306.                 }
  307.                
  308.                 lstParam.add(ServletUtils.getParameterAggiungi());
  309.             }
  310.            
  311.             // Se tipo = null, devo visualizzare la pagina per l'inserimento
  312.             // dati
  313.             if (confHelper.isEditModeInProgress()) {
  314.                 ServletUtils.setPageDataTitle(pd, lstParam);
  315.                
  316.                 // preparo i campi
  317.                 List<DataElement> dati = new ArrayList<>();
  318.                 dati.add(ServletUtils.getDataElementForEditModeFinished());
  319.                
  320.                 confHelper.addAllarmeToDati(dati, tipoOperazione, allarme, alarmEngineConfig, listaPlugin, parameters, ruoloPorta, nomePorta, serviceBinding);
  321.                
  322.                 // Set First is false
  323.                 confHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
  324.                
  325.                 if(pluginSelectedExceptionMessage != null) {
  326.                     pd.setMessage(pluginSelectedExceptionMessage);
  327.                 }
  328.                
  329.                 pd.setDati(dati);

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

  331.                 return ServletUtils.getStrutsForwardEditModeInProgress(mapping, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI, ForwardParams.ADD());
  332.             }
  333.                
  334.             // Controlli sui campi immessi
  335.             boolean isOk = confHelper.allarmeCheckData(sbParsingError, TipoOperazione.ADD, null, allarme, numeroPluginRegistrati, parameters);
  336.             if (!isOk) {
  337.                 ServletUtils.setPageDataTitle(pd, lstParam);
  338.                
  339.                 // preparo i campi
  340.                 List<DataElement> dati = new ArrayList<>();
  341.                 dati.add(ServletUtils.getDataElementForEditModeFinished());
  342.                
  343.                 confHelper.addAllarmeToDati(dati, tipoOperazione, allarme, alarmEngineConfig, listaPlugin, parameters, ruoloPorta, nomePorta, serviceBinding);
  344.                
  345.                 // Set First is false
  346.                 confHelper.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
  347.                
  348.                 pd.setDati(dati);

  349.                 ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);
  350.                
  351.                 return ServletUtils.getStrutsForwardEditModeCheckError(mapping,
  352.                         ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI,
  353.                         ForwardParams.ADD());
  354.             }
  355.                
  356.             // salvataggio dei parametri
  357.             if(parameters!=null && !parameters.isEmpty()) {
  358.                 for (org.openspcoop2.monitor.sdk.parameters.Parameter<?> par : parameters) {
  359.                     boolean found = false;
  360.                     for (AllarmeParametro parDB : allarme.getAllarmeParametroList()) {
  361.                         if(parDB.getIdParametro().equals(par.getId())){
  362.                             parDB.setValore(par.getValueAsString());
  363.                             found = true;
  364.                             break;
  365.                         }
  366.                     }
  367.                     if(!found){
  368.                         AllarmeParametro parDB = new AllarmeParametro();
  369.                         parDB.setIdParametro(par.getId());
  370.                         parDB.setValore(par.getValueAsString());
  371.                         allarme.addAllarmeParametro(parDB);
  372.                     }
  373.                 }
  374.             }
  375.            
  376.             // imposto lo stato di default per l'allarme:
  377.             allarme.setStato(AllarmiConverterUtils.toIntegerValue(StatoAllarme.OK));
  378.             allarme.setStatoPrecedente(AllarmiConverterUtils.toIntegerValue(StatoAllarme.OK));
  379.             allarme.setLasttimestampCreate(new Date());
  380.             allarme.setAcknowledged(Integer.valueOf(0));
  381.            
  382.             // imposto il dettaglio dell'ack
  383.             if(allarme.getPlugin() != null) {
  384.                 try{
  385.                     IDynamicLoader dl = DynamicFactory.getInstance().newDynamicLoader(TipoPlugin.ALLARME, allarme.getPlugin().getTipo(), allarme.getPlugin().getClassName(), ControlStationCore.getLog());
  386.                     IAlarmProcessing alarm = (IAlarmProcessing) dl.newInstance();
  387.                     if(alarm.isManuallyAckCriteria()) {
  388.                         Context context = confHelper.createAlarmContext(allarme, parameters);
  389.                         String ackCriteria = alarm.getDefaultManuallyAckCriteria(context);
  390.                         if(ackCriteria!=null) {
  391.                             allarme.setDettaglioAcknowledged(ackCriteria);
  392.                         }
  393.                     }
  394.                 }catch(Exception e){
  395.                     ControlStationCore.getLog().error(e.getMessage(), e);
  396.                 }
  397.             }
  398.            
  399.             // insert sul db
  400.             confCore.performCreateOperation(userLogin, confHelper.smista(), allarme);
  401.            
  402.             /* ******** GESTIONE AVVIO THREAD NEL CASO DI ATTIVO *************** */
  403.            
  404.             try {
  405.                 AllarmiUtils.notifyStateActiveThread(true, false, false, null, allarme, ControlStationCore.getLog(), alarmEngineConfig);
  406.             } catch(Exception e) {
  407.                 String errorMsg = MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_SALVATO_NOTIFICA_FALLITA, allarme.getAlias(),e.getMessage());
  408.                 ControlStationCore.getLog().error(errorMsg, e);
  409.                 pd.setMessage(errorMsg);
  410.             }
  411.                
  412.             // Preparo la lista
  413.             int idLista = Liste.CONFIGURAZIONE_ALLARMI;
  414.            
  415.             ConsoleSearch ricerca = (ConsoleSearch) ServletUtils.getSearchObjectFromSession(request, session, ConsoleSearch.class);
  416.            
  417.             ricerca = confHelper.checkSearchParameters(idLista, ricerca);

  418.             List<ConfigurazioneAllarmeBean> lista = confCore.allarmiList(ricerca, ruoloPorta, nomePorta);
  419.            
  420.             confHelper.prepareAllarmiList(ricerca, lista, ruoloPorta, nomePorta, serviceBinding);
  421.            
  422.             // salvo l'oggetto ricerca nella sessione
  423.             ServletUtils.setSearchObjectIntoSession(request, session, ricerca);
  424.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);
  425.            
  426.             // Forward control to the specified success URI
  427.             return ServletUtils.getStrutsForwardEditModeFinished(mapping, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI, ForwardParams.ADD());
  428.         } catch (Exception e) {
  429.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  430.                     ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI, ForwardParams.ADD());
  431.         }  
  432.     }
  433. }