ConfigurazioneHelper.java
- /*
- * GovWay - A customizable API Gateway
- * https://govway.org
- *
- * Copyright (c) 2005-2025 Link.it srl (https://link.it).
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3, as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
- package org.openspcoop2.web.ctrlstat.servlet.config;
- import java.net.URL;
- import java.nio.file.InvalidPathException;
- import java.nio.file.Paths;
- import java.text.MessageFormat;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Date;
- import java.util.Enumeration;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.Properties;
- import java.util.Scanner;
- import java.util.Set;
- import java.util.stream.Collectors;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpSession;
- import org.apache.commons.lang.StringEscapeUtils;
- import org.apache.commons.lang.StringUtils;
- import org.openspcoop2.core.allarmi.Allarme;
- import org.openspcoop2.core.allarmi.AllarmeFiltro;
- import org.openspcoop2.core.allarmi.constants.RuoloPorta;
- import org.openspcoop2.core.allarmi.constants.StatoAllarme;
- import org.openspcoop2.core.allarmi.constants.TipoAllarme;
- import org.openspcoop2.core.allarmi.constants.TipoPeriodo;
- import org.openspcoop2.core.allarmi.utils.AllarmiConverterUtils;
- import org.openspcoop2.core.commons.ErrorsHandlerCostant;
- import org.openspcoop2.core.commons.Filtri;
- import org.openspcoop2.core.commons.ISearch;
- import org.openspcoop2.core.commons.Liste;
- import org.openspcoop2.core.commons.ModalitaIdentificazione;
- import org.openspcoop2.core.commons.SearchUtils;
- import org.openspcoop2.core.commons.dao.DAOFactoryException;
- import org.openspcoop2.core.config.AccessoRegistro;
- import org.openspcoop2.core.config.AccessoRegistroRegistro;
- import org.openspcoop2.core.config.CanaleConfigurazione;
- import org.openspcoop2.core.config.CanaleConfigurazioneNodo;
- import org.openspcoop2.core.config.CanaliConfigurazione;
- import org.openspcoop2.core.config.Configurazione;
- import org.openspcoop2.core.config.ConfigurazioneHandler;
- import org.openspcoop2.core.config.ConfigurazioneUrlInvocazioneRegola;
- import org.openspcoop2.core.config.Connettore;
- import org.openspcoop2.core.config.Dump;
- import org.openspcoop2.core.config.GenericProperties;
- import org.openspcoop2.core.config.GestioneToken;
- import org.openspcoop2.core.config.MessaggiDiagnostici;
- import org.openspcoop2.core.config.OpenspcoopAppender;
- import org.openspcoop2.core.config.OpenspcoopSorgenteDati;
- import org.openspcoop2.core.config.PortaApplicativa;
- import org.openspcoop2.core.config.PortaDelegata;
- import org.openspcoop2.core.config.Property;
- import org.openspcoop2.core.config.Proprieta;
- import org.openspcoop2.core.config.RegistroPlugin;
- import org.openspcoop2.core.config.RegistroPluginArchivio;
- import org.openspcoop2.core.config.ResponseCachingConfigurazioneRegola;
- import org.openspcoop2.core.config.Route;
- import org.openspcoop2.core.config.RoutingTable;
- import org.openspcoop2.core.config.RoutingTableDestinazione;
- import org.openspcoop2.core.config.SystemProperties;
- import org.openspcoop2.core.config.Tracciamento;
- import org.openspcoop2.core.config.constants.CostantiConfigurazione;
- import org.openspcoop2.core.config.constants.FaseMessageHandler;
- import org.openspcoop2.core.config.constants.FaseServiceHandler;
- import org.openspcoop2.core.config.constants.PluginCostanti;
- import org.openspcoop2.core.config.constants.PluginSorgenteArchivio;
- import org.openspcoop2.core.config.constants.StatoFunzionalita;
- import org.openspcoop2.core.config.constants.StatoFunzionalitaCacheDigestQueryParameter;
- import org.openspcoop2.core.config.constants.StatoFunzionalitaConWarning;
- import org.openspcoop2.core.config.constants.TipoGestioneCORS;
- import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
- import org.openspcoop2.core.config.driver.db.DriverConfigurazioneDBLib;
- import org.openspcoop2.core.config.driver.db.IDServizioApplicativoDB;
- import org.openspcoop2.core.constants.CostantiLabel;
- import org.openspcoop2.core.constants.TipoPdD;
- import org.openspcoop2.core.controllo_traffico.AttivazionePolicy;
- import org.openspcoop2.core.controllo_traffico.AttivazionePolicyFiltro;
- import org.openspcoop2.core.controllo_traffico.AttivazionePolicyRaggruppamento;
- import org.openspcoop2.core.controllo_traffico.Cache;
- import org.openspcoop2.core.controllo_traffico.ConfigurazioneControlloTraffico;
- import org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale;
- import org.openspcoop2.core.controllo_traffico.ConfigurazionePolicy;
- import org.openspcoop2.core.controllo_traffico.ConfigurazioneRateLimiting;
- import org.openspcoop2.core.controllo_traffico.ConfigurazioneRateLimitingProprieta;
- import org.openspcoop2.core.controllo_traffico.TempiRispostaErogazione;
- import org.openspcoop2.core.controllo_traffico.TempiRispostaFruizione;
- import org.openspcoop2.core.controllo_traffico.beans.InfoPolicy;
- import org.openspcoop2.core.controllo_traffico.beans.JMXConstants;
- import org.openspcoop2.core.controllo_traffico.beans.UniqueIdentifierUtilities;
- import org.openspcoop2.core.controllo_traffico.constants.CacheAlgorithm;
- import org.openspcoop2.core.controllo_traffico.constants.RuoloPolicy;
- import org.openspcoop2.core.controllo_traffico.constants.TipoApplicabilita;
- import org.openspcoop2.core.controllo_traffico.constants.TipoBanda;
- import org.openspcoop2.core.controllo_traffico.constants.TipoControlloPeriodo;
- import org.openspcoop2.core.controllo_traffico.constants.TipoErrore;
- import org.openspcoop2.core.controllo_traffico.constants.TipoFiltroApplicativo;
- import org.openspcoop2.core.controllo_traffico.constants.TipoFinestra;
- import org.openspcoop2.core.controllo_traffico.constants.TipoLatenza;
- import org.openspcoop2.core.controllo_traffico.constants.TipoPeriodoRealtime;
- import org.openspcoop2.core.controllo_traffico.constants.TipoPeriodoStatistico;
- import org.openspcoop2.core.controllo_traffico.constants.TipoRisorsa;
- import org.openspcoop2.core.controllo_traffico.constants.TipoRisorsaPolicyAttiva;
- import org.openspcoop2.core.controllo_traffico.driver.PolicyGroupByActiveThreadsType;
- import org.openspcoop2.core.controllo_traffico.utils.PolicyUtilities;
- import org.openspcoop2.core.id.IDPortaApplicativa;
- import org.openspcoop2.core.id.IDPortaDelegata;
- import org.openspcoop2.core.id.IDServizio;
- import org.openspcoop2.core.id.IDServizioApplicativo;
- import org.openspcoop2.core.id.IDSoggetto;
- import org.openspcoop2.core.mapping.MappingErogazionePortaApplicativa;
- import org.openspcoop2.core.mapping.MappingFruizionePortaDelegata;
- import org.openspcoop2.core.mvc.properties.utils.ConfigManager;
- import org.openspcoop2.core.mvc.properties.utils.PropertiesSourceConfiguration;
- import org.openspcoop2.core.plugins.Plugin;
- import org.openspcoop2.core.plugins.constants.TipoPlugin;
- import org.openspcoop2.core.plugins.utils.handlers.ConfigurazioneHandlerBean;
- import org.openspcoop2.core.registry.AccordoServizioParteSpecifica;
- import org.openspcoop2.core.registry.Soggetto;
- import org.openspcoop2.core.registry.beans.AccordoServizioParteComuneSintetico;
- import org.openspcoop2.core.registry.constants.CostantiRegistroServizi;
- import org.openspcoop2.core.registry.constants.CredenzialeTipo;
- import org.openspcoop2.core.registry.constants.PddTipologia;
- import org.openspcoop2.core.registry.constants.RuoloTipologia;
- import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
- import org.openspcoop2.core.registry.driver.FiltroRicercaGruppi;
- import org.openspcoop2.core.registry.driver.FiltroRicercaRuoli;
- import org.openspcoop2.core.registry.driver.IDServizioFactory;
- import org.openspcoop2.core.registry.driver.db.IDSoggettoDB;
- import org.openspcoop2.core.transazioni.utils.TipoCredenzialeMittente;
- import org.openspcoop2.generic_project.exception.NotFoundException;
- import org.openspcoop2.message.constants.ServiceBinding;
- import org.openspcoop2.monitor.engine.alarm.AlarmContext;
- import org.openspcoop2.monitor.engine.alarm.AlarmEngineConfig;
- import org.openspcoop2.monitor.engine.alarm.utils.AllarmiUtils;
- import org.openspcoop2.monitor.engine.alarm.wrapper.ConfigurazioneAllarmeBean;
- import org.openspcoop2.monitor.engine.alarm.wrapper.ConfigurazioneAllarmeHistoryBean;
- import org.openspcoop2.monitor.engine.dynamic.DynamicFactory;
- import org.openspcoop2.monitor.engine.dynamic.IDynamicValidator;
- import org.openspcoop2.monitor.sdk.condition.Context;
- import org.openspcoop2.monitor.sdk.constants.ParameterType;
- import org.openspcoop2.monitor.sdk.exceptions.ValidationException;
- import org.openspcoop2.monitor.sdk.plugins.FiltersConfiguration;
- import org.openspcoop2.monitor.sdk.plugins.GroupByConfiguration;
- import org.openspcoop2.pdd.config.ConfigurazionePdD;
- import org.openspcoop2.pdd.core.CostantiPdD;
- import org.openspcoop2.pdd.core.GestoreRichieste;
- import org.openspcoop2.pdd.core.connettori.ConnettoreCheck;
- import org.openspcoop2.pdd.core.controllo_traffico.policy.config.PolicyConfiguration;
- import org.openspcoop2.pdd.core.integrazione.GruppoIntegrazione;
- import org.openspcoop2.pdd.core.jmx.JMXUtils;
- import org.openspcoop2.pdd.core.token.PolicyGestioneToken;
- import org.openspcoop2.pdd.core.token.PolicyNegoziazioneToken;
- import org.openspcoop2.pdd.core.token.TokenUtilities;
- import org.openspcoop2.pdd.core.token.attribute_authority.TipologiaResponseAttributeAuthority;
- import org.openspcoop2.pdd.logger.LogLevels;
- import org.openspcoop2.pdd.logger.filetrace.FileTraceGovWayState;
- import org.openspcoop2.pdd.timers.TimerState;
- import org.openspcoop2.protocol.engine.ProtocolFactoryManager;
- import org.openspcoop2.protocol.engine.utils.NamingUtils;
- import org.openspcoop2.protocol.sdk.IProtocolFactory;
- import org.openspcoop2.protocol.sdk.InformazioniProtocollo;
- import org.openspcoop2.protocol.sdk.archive.ExportMode;
- import org.openspcoop2.protocol.sdk.constants.ArchiveType;
- import org.openspcoop2.protocol.utils.ProtocolUtils;
- import org.openspcoop2.utils.Utilities;
- import org.openspcoop2.utils.UtilsException;
- import org.openspcoop2.utils.certificate.byok.BYOKManager;
- import org.openspcoop2.utils.date.DateManager;
- import org.openspcoop2.utils.date.DateUtils;
- import org.openspcoop2.utils.properties.PropertiesUtilities;
- import org.openspcoop2.utils.regexp.RegularExpressionEngine;
- import org.openspcoop2.utils.resources.MapReader;
- import org.openspcoop2.utils.transport.http.HttpResponse;
- import org.openspcoop2.utils.transport.http.HttpUtilities;
- import org.openspcoop2.web.ctrlstat.core.ConsoleSearch;
- import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
- import org.openspcoop2.web.ctrlstat.core.DAOConsoleFactory;
- import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
- import org.openspcoop2.web.ctrlstat.costanti.InUsoType;
- import org.openspcoop2.web.ctrlstat.costanti.MultitenantSoggettiErogazioni;
- import org.openspcoop2.web.ctrlstat.costanti.MultitenantSoggettiFruizioni;
- import org.openspcoop2.web.ctrlstat.driver.DriverControlStationException;
- import org.openspcoop2.web.ctrlstat.driver.DriverControlStationNotFound;
- import org.openspcoop2.web.ctrlstat.servlet.ApiKeyState;
- import org.openspcoop2.web.ctrlstat.servlet.ConsoleHelper;
- import org.openspcoop2.web.ctrlstat.servlet.apc.AccordiServizioParteComuneCostanti;
- import org.openspcoop2.web.ctrlstat.servlet.aps.AccordiServizioParteSpecificaCostanti;
- import org.openspcoop2.web.ctrlstat.servlet.archivi.ArchiviCostanti;
- import org.openspcoop2.web.ctrlstat.servlet.archivi.ExporterUtils;
- import org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeCostanti;
- import org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeHelper;
- import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateCostanti;
- import org.openspcoop2.web.ctrlstat.servlet.pd.PorteDelegateHelper;
- import org.openspcoop2.web.ctrlstat.servlet.soggetti.SoggettiCostanti;
- import org.openspcoop2.web.lib.mvc.AreaBottoni;
- import org.openspcoop2.web.lib.mvc.BinaryParameter;
- import org.openspcoop2.web.lib.mvc.CheckboxStatusType;
- import org.openspcoop2.web.lib.mvc.Costanti;
- import org.openspcoop2.web.lib.mvc.DataElement;
- import org.openspcoop2.web.lib.mvc.DataElementImage;
- import org.openspcoop2.web.lib.mvc.DataElementInfo;
- import org.openspcoop2.web.lib.mvc.DataElementType;
- import org.openspcoop2.web.lib.mvc.MessageType;
- import org.openspcoop2.web.lib.mvc.PageData;
- import org.openspcoop2.web.lib.mvc.Parameter;
- import org.openspcoop2.web.lib.mvc.ServletUtils;
- import org.openspcoop2.web.lib.mvc.TipoOperazione;
- import org.openspcoop2.web.lib.mvc.dynamic.components.BaseComponent;
- import org.openspcoop2.web.lib.mvc.dynamic.components.Hidden;
- import org.openspcoop2.web.lib.users.dao.User;
- /**
- * ConfigurazioneHelper
- *
- * @author Poli Andrea (apoli@link.it)
- * @author $Author$
- * @version $Rev$, $Date$
- */
- public class ConfigurazioneHelper extends ConsoleHelper{
- public ConfigurazioneHelper(HttpServletRequest request, PageData pd,
- HttpSession session) throws Exception {
- super(request, pd, session);
- }
- public ConfigurazioneHelper(ControlStationCore core, HttpServletRequest request, PageData pd,
- HttpSession session) throws Exception {
- super(core, request, pd, session);
- }
- public List<DataElement> addIdProprietaToDati(TipoOperazione tipoOp, String idprop, List<DataElement> dati) {
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA);
- de.setValue(idprop);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA);
- dati.add(de);
- return dati;
- }
- public List<DataElement> addTipoTracciamentoAppenderToDati(TipoOperazione tipoOp, String tipo,
- List<DataElement> dati,String idAppenderDati, int dimensioneAppenderDati) {
-
- DataElement de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setValue(tipo);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- if(tipoOp.equals(TipoOperazione.CHANGE)){
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_PROPERTIES_LIST ,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, idAppenderDati));
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) dimensioneAppenderDati);
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
- }
- return dati;
- }
- public String convertLifeCacheValue(String v) {
- if(v==null) {
- return "-1";
- }
- try {
- int vInt = Integer.valueOf(v);
- if(vInt>0) {
- return vInt+"";
- }
- else {
- return "-1";
- }
- }catch(Exception e) {
- return "-1";
- }
- }
-
- public void setDataElementCRLCacheInfo(List<DataElement> dati,
- String nomeParametroCrlLifeCache, String crllifecache,
- boolean allHidden){
-
- boolean view = this.isModalitaAvanzata() && !allHidden;
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE);
- int value = -1;
- try {
- value = Integer.valueOf(crllifecache);
- }catch(Exception e) {
- // value
- }
- if(value>0){
- de.setValue(value+"");
- }
- if(view){
- de.setType(DataElementType.TEXT_EDIT);
- de.setNote(ConfigurazioneCostanti.LABEL_CACHE_SECONDS_NOTE);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setName(nomeParametroCrlLifeCache);
- de.setSize( getSize());
- dati.add(de);
-
- }
-
- public void setDataElementCache(List<DataElement> dati, String intestazioneSezione,
- String nomeParametroStatoCache, String statocache,
- String nomeParametroDimensioneCache, String dimensionecache,
- String nomeParametroAlgoritmoCache, String algoritmocache,
- String nomeParametroIdleCache, String idlecache,
- String nomeParametroLifeCache, String lifecache,
- boolean allHidden){
-
- boolean view = this.isModalitaAvanzata() && !allHidden;
-
- if(view){
- DataElement de = new DataElement();
- de.setLabel(intestazioneSezione);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
- String[] tipoStatoCache = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_CACHE);
- de.setName(nomeParametroStatoCache);
- if(view &&
- !ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_RISPOSTE.equals(intestazioneSezione) &&
- !ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI.equals(intestazioneSezione)){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoStatoCache);
- de.setSelected(statocache);
- de.setPostBack(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(statocache);
- }
- dati.add(de);
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE);
- de.setValue(dimensionecache);
- if(view){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setName(nomeParametroDimensioneCache);
- de.setSize( getSize());
- dati.add(de);
- String[] tipoAlg = {
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_LRU,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_MRU
- };
- String[] labelsAlg = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_LRU,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_MRU
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE);
- de.setName(nomeParametroAlgoritmoCache);
- if(view){
- de.setType(DataElementType.SELECT);
- de.setLabels(labelsAlg);
- de.setValues(tipoAlg);
- de.setSelected(algoritmocache);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(algoritmocache);
- }
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIFE_CACHE);
- int value = -1;
- try {
- value = Integer.valueOf(lifecache);
- }catch(Exception e) {
- // value
- }
- if(value>0){
- de.setValue(value+"");
- }
- if(view &&
- !ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_RISPOSTE.equals(intestazioneSezione) &&
- !ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI.equals(intestazioneSezione)){
- de.setType(DataElementType.TEXT_EDIT);
- //de.setRequired(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setName(nomeParametroLifeCache);
- de.setSize( getSize());
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_IDLE_CACHE);
- de.setValue(idlecache);
- if(view &&
- !ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI.equals(intestazioneSezione)){
- de.setType(DataElementType.TEXT_EDIT);
- if(!ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_KEYSTORE.equals(intestazioneSezione)){
- de.setNote(ConfigurazioneCostanti.LABEL_CACHE_SECONDS_NOTE);
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setName(nomeParametroIdleCache);
- de.setSize( getSize());
- dati.add(de);
- }
-
- }
-
- public List<DataElement> addConfigurazioneRegistroToDati(String statocache,
- String dimensionecache, String algoritmocache, String idlecache,
- String lifecache, List<DataElement> dati) {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_REGISTRI_LIST);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_REGISTRI);
- dati.add(de);
- this.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_REGISTRY,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY,statocache,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY,dimensionecache,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY,algoritmocache,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY,idlecache,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY,lifecache,
- false);
- if(this.isModalitaStandard()){
- this.pd.disableEditMode();
- }
-
- dati = this.addParameterApplicaModifica(dati);
-
- return dati;
- }
- public List<DataElement> addTipoDiagnosticaAppenderToDati(TipoOperazione tipoOp, String tipo,
- List<DataElement> dati,String idAppenderDati, int dimensioneAppenderDati) {
-
- DataElement de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setValue(tipo);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- if(tipoOp.equals(TipoOperazione.CHANGE)){
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_PROPERTIES_LIST,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, idAppenderDati));
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) dimensioneAppenderDati);
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
- }
- return dati;
- }
- public List<DataElement> addDiagnosticaDatasourceToDati(TipoOperazione tipoOp, String nome, String nomeJndi,
- String tipoDatabase, String[] tipoDbList, List<DataElement> dati, String idSorgenteDati, int dimensioneSorgenteDati) {
-
- DataElement de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- de.setValue(nomeJndi);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- de.setValues(tipoDbList);
- if(tipoDatabase != null){
- de.setSelected(tipoDatabase);
- }
- de.setRequired(true);
- dati.add(de);
- if(tipoOp .equals(TipoOperazione.CHANGE)){
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_PROPERTIES_LIST,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, idSorgenteDati));
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) dimensioneSorgenteDati);
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
- }
- return dati;
- }
- public List<DataElement> addTracciamentoDatasourceToDati(TipoOperazione tipoOp, String nome, String nomeJndi,
- String tipoDatabase, String[] tipoDbList, List<DataElement> dati, String idSorgenteDati, int dimensioneSorgenteDati) {
- DataElement de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- de.setValue(nomeJndi);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- de.setValues(tipoDbList);
- if(tipoDatabase != null){
- de.setSelected(tipoDatabase);
- }
- de.setRequired(true);
- dati.add(de);
- if(tipoOp .equals(TipoOperazione.CHANGE)){
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_PROPERTIES_LIST,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, idSorgenteDati));
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) dimensioneSorgenteDati);
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
- }
- return dati;
- }
- // Prepara la lista di datasource del tracciamento
- public void prepareTracciamentoDatasourceList(List<OpenspcoopSorgenteDati> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE);
- Boolean contaListe = ServletUtils.getConfigurazioniPersonalizzateFromSession(this.session);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_SORGENTI_DATI_TRACCIAMENTO , null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_JNDI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- OpenspcoopSorgenteDati od = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pid = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, od.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_CHANGE, pid);
- de.setValue(od.getNome());
- de.setIdToRemove(""+od.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(od.getNomeJndi());
- e.add(de);
- de = new DataElement();
- de.setValue(od.getTipoDatabase());
- e.add(de);
- de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_PROPERTIES_LIST, pid);
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) od.sizePropertyList());
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati del sorgente dati del tracciamento
- public boolean tracciamentoDatasourceCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String nomeJndi = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- String tipoDatabase = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (nomeJndi == null || "".equals(nomeJndi)) {
- this.pd.setMessage("Il campo Nome Jndi deve essere specificato.");
- return false;
- }
- if (tipoDatabase == null || "".equals(tipoDatabase)) {
- this.pd.setMessage("Il campo Tipo Database deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che il sorgente dati non sia gia' stato registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovatoDatasource = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Tracciamento t = newConfigurazione.getTracciamento();
- if (t != null) {
- List<OpenspcoopSorgenteDati> lista = t.getOpenspcoopSorgenteDatiList();
- OpenspcoopSorgenteDati od = null;
- for (int j = 0; j < t.sizeOpenspcoopSorgenteDatiList(); j++) {
- od = lista.get(j);
- if (nome.equals(od.getNome())) {
- trovatoDatasource = true;
- break;
- }
- }
- }
- if (trovatoDatasource) {
- this.pd.setMessage("Esiste già un sorgente dati con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di property di appender del tracciamento
- public void prepareTracciamentoAppenderPropList(OpenspcoopAppender oa,
- List<Property> lista)
- throws Exception {
- try {
- Parameter pOaId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, ""+oa.getId());
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_PROPERTIES,
- pOaId);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_TRACCIAMENTO ,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_LIST));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA+ " di " + oa.getTipo(), null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- Property oap = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pOapId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA, oap.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_PROPERTIES_CHANGE, pOaId, pOapId
- );
- de.setValue(oap.getNome());
- de.setIdToRemove(""+oap.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(oap.getValore());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle property dell'appender del tracciamento
- public boolean tracciamentoAppenderPropCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- int idInt = Integer.parseInt(id);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (valore == null || "".equals(valore)) {
- this.pd.setMessage("Il campo Valore deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che la property non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovataProp = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Tracciamento t = newConfigurazione.getTracciamento();
- OpenspcoopAppender oa = null;
- for (int j = 0; j < t.sizeOpenspcoopAppenderList(); j++) {
- oa = t.getOpenspcoopAppender(j);
- if (idInt == oa.getId().intValue()) {
- break;
- }
- }
-
- if(oa==null) {
- throw new DriverControlStationException("Appender non trovato");
- }
-
- Property oap = null;
- for (int i = 0; i < oa.sizePropertyList(); i++) {
- oap = oa.getProperty(i);
- if (nome.equals(oap.getNome())) {
- trovataProp = true;
- break;
- }
- }
- if (trovataProp) {
- this.pd.setMessage("Esiste già una Proprietà con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di property di datasource del tracciamento
- public void prepareTracciamentoDatasourcePropList(OpenspcoopSorgenteDati od,
- List<Property> lista)
- throws Exception {
- try {
- Parameter pOdId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, ""+od.getId());
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_PROPERTIES,
- pOdId);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_SORGENTI_DATI_TRACCIAMENTO ,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_LIST));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA+ " di " + od.getNome(), null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- Property odp = lista.get(i);
- Parameter pOapId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA, odp.getId() + "");
- List<DataElement> e = new ArrayList<>();
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_PROPERTIES_CHANGE, pOdId, pOapId
- );
- de.setValue(odp.getNome());
- de.setIdToRemove(""+odp.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(odp.getValore());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle property del datasource del tracciamento
- public boolean tracciamentoDatasourcePropCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- int idInt = Integer.parseInt(id);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (valore == null || "".equals(valore)) {
- this.pd.setMessage("Il campo Valore deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che la property non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovataProp = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Tracciamento t = newConfigurazione.getTracciamento();
- List<OpenspcoopSorgenteDati> lista = t.getOpenspcoopSorgenteDatiList();
- OpenspcoopSorgenteDati od = null;
- for (int j = 0; j < t.sizeOpenspcoopSorgenteDatiList(); j++) {
- od = lista.get(j);
- if (idInt == od.getId().intValue()) {
- break;
- }
- }
-
- if(od==null) {
- throw new DriverControlStationException("Datasource non trovato");
- }
-
- List<Property> lista1 = od.getPropertyList();
- Property odp = null;
- for (int i = 0; i < od.sizePropertyList(); i++) {
- odp = lista1.get(i);
- if (nome.equals(odp.getNome())) {
- trovataProp = true;
- break;
- }
- }
- if (trovataProp) {
- this.pd.setMessage("Esiste già una Proprietà con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di appender del tracciamento
- public void prepareTracciamentoAppenderList(List<OpenspcoopAppender> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER);
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_TRACCIAMENTO, null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- OpenspcoopAppender oa = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, oa.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_CHANGE, pId);
- de.setValue(oa.getTipo());
- de.setIdToRemove(""+oa.getId());
- e.add(de);
- de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_PROPERTIES_LIST ,pId);
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long)oa.sizePropertyList());
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati dell'appender del tracciamento
- public boolean tracciamentoAppenderCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- if (tipo == null || "".equals(tipo)) {
- this.pd.setMessage("Il campo Tipo deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che l'appender non sia gia' stato registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovatoAppender = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Tracciamento t = newConfigurazione.getTracciamento();
- if (t != null) {
- OpenspcoopAppender oa = null;
- for (int j = 0; j < t.sizeOpenspcoopAppenderList(); j++) {
- oa = t.getOpenspcoopAppender(j);
- if (tipo.equals(oa.getTipo())) {
- trovatoAppender = true;
- break;
- }
- }
- }
- if (trovatoAppender) {
- this.pd.setMessage("Esiste già un Appender con tipo " + tipo);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di appender del dump
- public void prepareDumpAppenderList(List<OpenspcoopAppender> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DUMP_APPENDER);
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_DUMP, null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- OpenspcoopAppender oa = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, oa.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_CHANGE, pId);
- de.setValue(oa.getTipo());
- de.setIdToRemove(""+oa.getId());
- e.add(de);
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_PROPERTIES_LIST ,pId);
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long)oa.sizePropertyList());
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati dell'appender del dump
- public boolean dumpAppenderCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- if (tipo == null || "".equals(tipo)) {
- this.pd.setMessage("Il campo Tipo deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che l'appender non sia gia' stato registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovatoAppender = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Dump dump = newConfigurazione.getDump();
- if (dump != null) {
- OpenspcoopAppender oa = null;
- for (int j = 0; j < dump.sizeOpenspcoopAppenderList(); j++) {
- oa = dump.getOpenspcoopAppender(j);
- if (tipo.equals(oa.getTipo())) {
- trovatoAppender = true;
- break;
- }
- }
- }
- if (trovatoAppender) {
- this.pd.setMessage("Esiste già un Appender con tipo " + tipo);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public List<DataElement> addTipoDumpAppenderToDati(TipoOperazione tipoOp, String tipo, List<DataElement> dati,String idAppenderDati, int dimensioneAppenderDati) {
-
- DataElement de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setValue(tipo);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- if(tipoOp.equals(TipoOperazione.CHANGE)){
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_PROPERTIES_LIST, new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, idAppenderDati));
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) dimensioneAppenderDati);
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
- }
- return dati;
- }
-
- // Prepara la lista di property di appender del dump
- public void prepareDumpAppenderPropList(OpenspcoopAppender oa, List<Property> lista)
- throws Exception {
- try {
- Parameter pOaId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, ""+oa.getId());
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DUMP_APPENDER_PROPERTIES,
- pOaId);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_DUMP ,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_LIST));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA+ " di " + oa.getTipo(), null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- Property oap = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pOapId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA, oap.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_PROPERTIES_CHANGE, pOaId, pOapId );
- de.setValue(oap.getNome());
- de.setIdToRemove(""+oap.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(oap.getValore());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle property dell'appender del dump
- public boolean dumpAppenderPropCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- int idInt = Integer.parseInt(id);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (valore == null || "".equals(valore)) {
- this.pd.setMessage("Il campo Valore deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che la property non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovataProp = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- Dump dump = newConfigurazione.getDump();
- OpenspcoopAppender oa = null;
- for (int j = 0; j < dump.sizeOpenspcoopAppenderList(); j++) {
- oa = dump.getOpenspcoopAppender(j);
- if (idInt == oa.getId().intValue()) {
- break;
- }
- }
-
- if(oa==null) {
- throw new DriverControlStationException("Appender non trovato");
- }
-
- Property oap = null;
- for (int i = 0; i < oa.sizePropertyList(); i++) {
- oap = oa.getProperty(i);
- if (nome.equals(oap.getNome())) {
- trovataProp = true;
- break;
- }
- }
- if (trovataProp) {
- this.pd.setMessage("Esiste già una Proprietà con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati del system properties
- public boolean systemPropertiesCheckData(TipoOperazione tipoOp) throws DriverControlStationException {
- try {
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getLockedParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE, false);
- // Campi obbligatori
- if (nome.equals("") || valore.equals("")) {
- String tmpElenco = "";
- if (nome.equals("")) {
- tmpElenco = "Nome";
- }
- if (valore.equals("")) {
- if (tmpElenco.equals("")) {
- tmpElenco = "Valore";
- } else {
- tmpElenco = tmpElenco + ", Valore";
- }
- }
- this.pd.setMessage("Dati incompleti. È necessario indicare: " + tmpElenco);
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if ((nome.indexOf(" ") != -1) ) {
- this.pd.setMessage("Non inserire spazi nei nomi");
- return false;
- }
- if(!this.checkLength255(nome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME)) {
- return false;
- }
-
- if( !this.core.getDriverBYOKUtilities().isEnabledBYOK() || !this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(valore) ){
- if(valore.startsWith(" ") || valore.endsWith(" ")){
- this.pd.setMessage("Non inserire spazi all'inizio o alla fine dei valori");
- return false;
- }
- if(!this.checkLength255(valore, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE)) {
- return false;
- }
- }
- // Se tipoOp = add, controllo che non sia gia' stato
- // registrato per la porta delegata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean giaRegistrato = false;
- SystemProperties sps = this.confCore.getSystemPropertiesPdD();
- if(sps!=null){
- for (int i = 0; i < sps.sizeSystemPropertyList(); i++) {
- Property tmpSP = sps.getSystemProperty(i);
- if (nome.equals(tmpSP.getNome())) {
- giaRegistrato = true;
- break;
- }
- }
- }
- if (giaRegistrato) {
- this.pd.setMessage("La proprietà di sistema " + nome + " è già stata registrata");
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public void prepareSystemPropertiesList(ISearch ricerca, List<Property> lista)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, id);
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_SYSTEM_PROPERTIES, pId);
- int idLista = Liste.SYSTEM_PROPERTIES;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- if (search.equals("")) {
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA_SISTEMA, null));
- } else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA_SISTEMA,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SYSTEM_PROPERTIES_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA_SISTEMA, search);
- }
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<Property> it = lista.iterator();
- while (it.hasNext()) {
- Property sp = it.next();
- List<DataElement> e = new ArrayList<>();
- Parameter pIdProp = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, ""+sp.getId());
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SYSTEM_PROPERTIES_CHANGE, pIdProp);
- de.setValue(sp.getNome());
- de.setIdToRemove(sp.getNome());
- de.setSize(CostantiControlStation.NOME_PROPRIETA_VISUALIZZATA);
- e.add(de);
- de = new DataElement();
- if(sp.getValore()!=null && StringUtils.isNotEmpty(sp.getValore()) &&
- BYOKManager.isEnabledBYOK() &&
- this.core.getDriverBYOKUtilities().isWrappedWithAnyPolicy(sp.getValore())) {
- de.setValue(CostantiControlStation.VALORE_CIFRATO);
- }
- else {
- de.setValue(sp.getValore());
- }
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public void refreshSystemProperties() {
- // reimposto proprietÃ
- List<String> aliases = this.confCore.getJmxPdDAliases();
- boolean resetOk = false;
- if(aliases!=null && !aliases.isEmpty()){
- resetOk = true;
- for (String alias : aliases) {
- String stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaSystemPropertiesPdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoRefreshPersistentConfiguration(alias));
- if(this.isErroreHttp(stato, "refresh System Properties")){
- // e' un errore
- throw new DriverControlStationException(stato);
- }
- }catch(Exception e){
- ControlStationCore.getLog().error("Errore durante il refresh via jmx delle system properties (alias: "+alias+"): "+e.getMessage(),e);
- resetOk = false;
- }
- }
- }
-
- if(!resetOk) {
- this.pd.setMessage(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA_SISTEMA_MODIFICATA_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);
- }
- }
-
- // Controlla i dati del pannello Configurazione -> Tabella di routing
- public boolean routingCheckData(String[] registriList) throws Exception {
- try{
- String rottaenabled = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ROTTA_ENABLED);
- String tiporotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA);
- if (tiporotta == null) {
- tiporotta = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY;
- }
- String tiposoggrotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- if (tiposoggrotta == null) {
- tiposoggrotta = "";
- }
- String nomesoggrotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- if (nomesoggrotta == null) {
- nomesoggrotta = "";
- }
- String registrorotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- if (registrorotta == null) {
- registrorotta = "";
- }
- // Controllo che i campi "select" abbiano uno dei valori ammessi
- if (!tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) &&
- !tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- this.pd.setMessage("Tipo Rotta dev'essere gateway o registro");
- return false;
- }
- // Campi obbligatori
- if (rottaenabled.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) && ( (tiposoggrotta.equals("") || tiposoggrotta.equals("-")) || nomesoggrotta.equals(""))) {
- this.pd.setMessage("Dati incompleti. È necessario indicare Tipo e Nome Soggetto");
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) && ((tiposoggrotta.indexOf(" ") != -1) || (nomesoggrotta.indexOf(" ") != -1))) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- // Controllo che il registrorotta appartenga alla lista di registri
- // disponibili
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- boolean trovatoReg = false;
- for (int i = 0; i < registriList.length; i++) {
- String tmpReg = registriList[i];
- if (tmpReg.equals(registrorotta)) {
- trovatoReg = true;
- }
- }
- if (!trovatoReg) {
- this.pd.setMessage("Il registro dev'essere 'all' oppure dev'essere scelto tra quelli definiti nel pannello Registri");
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle rotte statiche
- public boolean routingListCheckData(TipoOperazione tipoOp, String[] registriList)
- throws Exception {
- try{
- // String id = this.getParameter("id");
- // int idInt = 0;
- // if (tipoOp.equals("change"))
- // idInt = Integer.parseInt(id);
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String tiporotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA);
- String tiposoggrotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- String nomesoggrotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- String registrorotta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- // Controllo che i campi "select" abbiano uno dei valori ammessi
- if (!tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) && !tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- this.pd.setMessage("Tipo Rotta dev'essere gateway o registro");
- return false;
- }
- // Campi obbligatori
- if (tipo.equals("") || nome.equals("")) {
- this.pd.setMessage("Dati incompleti. È necessario indicare Tipo e Nome");
- return false;
- }
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) && (tiposoggrotta.equals("") || nomesoggrotta.equals(""))) {
- this.pd.setMessage("Dati incompleti. È necessario indicare Tipo e Nome Soggetto");
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if ((tipo.indexOf(" ") != -1) || (nome.indexOf(" ") != -1)) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY) && ((tiposoggrotta.indexOf(" ") != -1) || (nomesoggrotta.indexOf(" ") != -1))) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- // Controllo che il registrorotta appartenga alla lista di registri
- // disponibili
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- boolean trovatoReg = false;
- for (int i = 0; i < registriList.length; i++) {
- String tmpReg = registriList[i];
- if (tmpReg.equals(registrorotta)) {
- trovatoReg = true;
- }
- }
- if (!trovatoReg) {
- this.pd.setMessage("Il registro dev'essere 'all' oppure dev'essere scelto tra quelli definiti nel pannello Registri");
- return false;
- }
- }
- // Se tipoOp = add, controllo che il routing non sia gia' stato
- // registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean giaRegistrato = false;
- RoutingTable rt = this.confCore.getRoutingTable();
- for (int i = 0; i < rt.sizeDestinazioneList(); i++) {
- RoutingTableDestinazione rtd = rt.getDestinazione(i);
- if (nome.equals(rtd.getNome()) && tipo.equals(rtd.getTipo())) {
- giaRegistrato = true;
- break;
- }
- }
- if (giaRegistrato) {
- this.pd.setMessage("La destinazione " + tipo + "/" + nome + " è già stata registrata");
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di rotte statiche
- public void prepareRoutingList(ISearch ricerca, List<RoutingTableDestinazione> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ROTTE_ROUTING);
- int idLista = Liste.ROUTING;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TABELLA_DI_ROUTING,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ROUTING));
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINAZIONI,
- null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINAZIONI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ROTTE_ROUTING_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINAZIONI, search);
- }
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINATARIO,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<RoutingTableDestinazione> it = lista.iterator();
- while (it.hasNext()) {
- RoutingTableDestinazione rtd = it.next();
- List<DataElement> e = new ArrayList<>();
- DataElement de = new DataElement();
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, rtd.getId() + "");
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ROTTE_ROUTING_CHANGE, pId);
- de.setValue(rtd.getTipo()+"/"+rtd.getNome());
- e.add(de);
- Route r = rtd.getRoute(0);
- de = new DataElement();
- if (r.getGateway() != null) {
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY);
- } else {
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO);
- }
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Controlla i dati del pannello Configurazione -> Registro
- public boolean registroCheckData() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY);
- return checkDatiCache(CostantiPdD.JMX_REGISTRO_SERVIZI, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean checkDatiCache(String nomeCache, String statocache, String dimensionecache, String algoritmocache, String idlecache, String lifecache) throws Exception {
- try{
- // Campi obbligatori
- if (statocache.equals("")) {
- this.pd.setMessage("Dati incompleti. È necessario indicare lo Stato in "+nomeCache);
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && ((dimensionecache.indexOf(" ") != -1) || (idlecache.indexOf(" ") != -1) || (lifecache.indexOf(" ") != -1))) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- // Controllo che i campi "select" abbiano uno dei valori ammessi
- if (!statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && !statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Stato Cache "+nomeCache+" dev'essere abilitato o disabilitato");
- return false;
- }
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !algoritmocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_LRU) &&
- !algoritmocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_MRU)) {
- this.pd.setMessage("Algoritmo della Cache "+nomeCache+" dev'essere LRU o MRU");
- return false;
- }
- // dimensionecache, idlecache e lifecache devono essere numerici
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && (dimensionecache==null || dimensionecache.equals("")) ) {
- this.pd.setMessage("Deve essere indicato un valore per la Dimensione della Cache "+nomeCache);
- return false;
- }
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && !dimensionecache.equals("") &&
- !this.checkNumber(dimensionecache, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE+ "("+nomeCache+")", false)) {
- return false;
- }
-
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && !idlecache.equals("") &&
- !this.checkNumber(idlecache, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_IDLE_CACHE+ "("+nomeCache+")", false)) {
- return false;
- }
-
- // if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && (lifecache==null || lifecache.equals("")) ) {
- // this.pd.setMessage("Deve essere indicato un valore per l'impostazione 'Life second' della Cache "+nomeCache);
- // return false;
- // }
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && lifecache!=null && !lifecache.equals("") &&
- !this.checkNumber(lifecache, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIFE_CACHE+ "("+nomeCache+")", false)) {
- return false;
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati del registro
- public boolean registriCheckData(TipoOperazione tipoOp) throws Exception {
- try{
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String location = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOCATION);
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- String utente = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTENTE);
- String password = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PW);
- String confpw = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONFERMA_PW);
- // Campi obbligatori
- if (nome.equals("") || location.equals("") || tipo.equals("")) {
- String tmpElenco = "";
- if (nome.equals("")) {
- tmpElenco = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME;
- }
- if (location.equals("")) {
- if (tmpElenco.equals("")) {
- tmpElenco = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOCATION;
- } else {
- tmpElenco = tmpElenco + ", "+ ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOCATION;
- }
- }
- if (tipo.equals("")) {
- if (tmpElenco.equals("")) {
- tmpElenco = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO;
- } else {
- tmpElenco = tmpElenco + ", "+ ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO;
- }
- }
- this.pd.setMessage("Dati incompleti. È necessario indicare: " + tmpElenco);
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if ((nome.indexOf(" ") != -1) || (location.indexOf(" ") != -1)) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- if (tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_UDDI) &&
- ((utente.indexOf(" ") != -1) || (password.indexOf(" ") != -1) || (confpw.indexOf(" ") != -1))) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- // length
- if(this.checkLength255(nome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME)==false) {
- return false;
- }
- if(this.checkLength255(location, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOCATION)==false) {
- return false;
- }
- if(utente!=null && !"".equals(utente)) {
- if(this.checkLength255(utente, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_UTENTE)==false) {
- return false;
- }
- }
- if(password!=null && !"".equals(password)) {
- if(this.checkLength255(password, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PW)==false) {
- return false;
- }
- }
-
- // Controllo che i campi "select" abbiano uno dei valori ammessi
- if (!tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_XML) &&
- !tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_DB) &&
- !tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_UDDI) &&
- !tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_WEB) &&
- !tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_WS)) {
- this.pd.setMessage("Tipo dev'essere xml, db, uddi, web o ws");
- return false;
- }
- // Controllo che le password corrispondano
- if (tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_UDDI) && !password.equals(confpw)) {
- this.pd.setMessage("Le password non corrispondono");
- return false;
- }
- // Se tipoOp = add, controllo che il registro non sia gia' stato
- // registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean giaRegistrato = false;
- AccessoRegistro ar = this.confCore.getAccessoRegistro();
- for (int i = 0; i < ar.sizeRegistroList(); i++) {
- AccessoRegistroRegistro arr = ar.getRegistro(i);
- if (nome.equals(arr.getNome())) {
- giaRegistrato = true;
- break;
- }
- }
- if (giaRegistrato) {
- this.pd.setMessage("Il registro " + nome + " è già stato registrato");
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Prepara la lista di registri
- public void prepareRegistriList(ISearch ricerca, List<AccessoRegistroRegistro> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_REGISTRI);
- int idLista = Liste.REGISTRI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ACCESSO_REGISTRO_SERVIZI));
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_REGISTRI,
- null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_REGISTRI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_REGISTRI_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRI, search);
- }
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<AccessoRegistroRegistro> it = lista.iterator();
- while (it.hasNext()) {
- AccessoRegistroRegistro arr = it.next();
- List<DataElement> e = new ArrayList<>();
- DataElement de = new DataElement();
- Parameter pNome = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME, arr.getNome());
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_REGISTRI_CHANGE , pNome);
- de.setValue(arr.getNome());
- de.setIdToRemove(arr.getNome());
- e.add(de);
- de = new DataElement();
- de.setValue(arr.getTipo().toString());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Prepara la lista delle regole di configurazione del caching risposta
- public void prepareResponseCachingConfigurazioneRegolaList(ISearch ricerca, List<ResponseCachingConfigurazioneRegola> lista, Integer defaultCacheSeconds) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA);
- int idLista = Liste.CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setSearch("");
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- this.pd.setSearchDescription("");
-
- ServletUtils.disabledPageDataSearch(this.pd);
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLE, null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_CACHE_TIMEOUT_SECONDS
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<ResponseCachingConfigurazioneRegola> it = lista.iterator();
- while (it.hasNext()) {
- ResponseCachingConfigurazioneRegola regola = it.next();
- List<DataElement> e = new ArrayList<>();
- DataElement de = new DataElement();
- de.setIdToRemove(regola.getId() + "");
-
- Integer statusMin = regola.getReturnCodeMin();
- Integer statusMax = regola.getReturnCodeMax();
-
- // se e' stato salvato il valore 0 lo tratto come null
- if(statusMin != null && statusMin.intValue() <= 0) {
- statusMin = null;
- }
-
- if(statusMax != null && statusMax.intValue() <= 0) {
- statusMax = null;
- }
-
- String statusValue = null;
- // Intervallo
- if(statusMin != null && statusMax != null) {
- if(statusMax.longValue() == statusMin.longValue()) // esatto
- statusValue = statusMin + "";
- else
- statusValue = "[" + statusMin + " - " + statusMax + "]";
- } else if(statusMin != null && statusMax == null) { // definito solo l'estremo inferiore
- statusValue = ">" + statusMin;
- } else if(statusMin == null && statusMax != null) { // definito solo l'estremo superiore
- statusValue = "<" + statusMax;
- } else { //entrambi null
- statusValue = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI;
- }
-
- de.setValue(statusValue);
- e.add(de);
-
- de = new DataElement();
- de.setValue(regola.getFault() ? CostantiControlStation.LABEL_SI : CostantiControlStation.LABEL_NO);
- e.add(de);
-
- de = new DataElement();
- de.setValue(regola.getCacheTimeoutSeconds() != null ? regola.getCacheTimeoutSeconds() + "" : "default ("+defaultCacheSeconds+")");
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Controlla i dati del registro
- public boolean responseCachingConfigurazioneRegolaCheckData(TipoOperazione tipoOp) throws Exception {
- try{
-
- if(this.checkRegolaResponseCaching() == false) {
- return false;
- }
-
- String returnCode = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE);
- String statusMinS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MIN);
- String statusMaxS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_RETURN_CODE_MAX);
- String faultS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_FAULT);
-
- Integer statusMin = null;
- Integer statusMax = null;
- boolean fault = ServletUtils.isCheckBoxEnabled(faultS);
-
- if(!returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_QUALSIASI)) {
- if(StringUtils.isNotEmpty(statusMinS)) {
- statusMin = Integer.parseInt(statusMinS);
- }
-
- if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_INTERVALLO)) {
- if(StringUtils.isNotEmpty(statusMaxS)) {
- statusMax = Integer.parseInt(statusMaxS);
- }
- }
-
- // return code esatto, ho salvato lo stesso valore nel campo return code;
- if(returnCode.equals(CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_RETURN_CODE_ESATTO))
- statusMax = statusMin;
- }
-
- // Se tipoOp = add, controllo che il registro non sia gia' stato
- // registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean giaRegistrato = this.confCore.existsResponseCachingConfigurazioneRegola(statusMin, statusMax, fault);
- if (giaRegistrato) {
- this.pd.setMessage("È già presente una Regola di Response Caching con in parametri indicati.");
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati del pannello Configurazione -> Generale
- public boolean configurazioneCheckData() throws Exception {
- try{
- String inoltromin = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO);
- String controllo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO);
- //String severita = this.getParameter("severita");
- //String severita_log4j = this.getParameter("severita_log4j");
- String integman = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INTEGMAN);
- String nomeintegman = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_INTEGMAN);
- String profcoll = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
- String connessione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
- String utilizzo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTILIZZO);
- String validman = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALIDMAN);
- String gestman = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTMAN);
- String registrazioneTracce = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- // String dumpApplicativo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_APPLICATIVO);
- // String dumpPD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- // String dumpPA = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- // Campi obbligatori
- if (inoltromin.equals("")) {
- this.pd.setMessage("Dati incompleti. È necessario indicare una cadenza");
- return false;
- }
- // Controllo che non ci siano spazi nei campi di testo
- if (inoltromin.indexOf(" ") != -1) {
- this.pd.setMessage("Non inserire spazi nei campi di testo");
- return false;
- }
- // Controllo che i campi "select" abbiano uno dei valori ammessi
- if (stato != null && !stato.equals("") && !stato.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !stato.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO) && !stato.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY)) {
- this.pd.setMessage("Stato dev'essere abilitato, disabilitato o warningOnly");
- return false;
- }
- if (controllo != null && !controllo.equals("") &&
- !controllo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_RIGIDO) &&
- !controllo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_NORMALE)) {
- this.pd.setMessage("Controllo dev'essere rigido o normale");
- return false;
- }
- /*if (!spcoop.equals("off") && !spcoop.equals("fatalOpenspcoop") && !spcoop.equals("errorSpcoop") && !spcoop.equals("errorOpenspcoop") && !spcoop.equals("infoSpcoop") && !spcoop.equals("infoOpenspcoop") && !spcoop.equals("debugLow") && !spcoop.equals("debugMedium") && !spcoop.equals("debugHigh") && !spcoop.equals("all")) {
- this.pd.setMessage("Livello SPCoop dev'essere off, fatalOpenspcoop, errorSpcoop, errorOpenspcoop, infoSpcoop, infoOpenspcoop, debugLow, debugMedium, debugHigh o all");
- return false;
- }
- if (!openspcoop.equals("off") && !openspcoop.equals("fatalOpenspcoop") && !openspcoop.equals("errorSpcoop") && !openspcoop.equals("errorOpenspcoop") && !openspcoop.equals("infoSpcoop") && !openspcoop.equals("infoOpenspcoop") && !openspcoop.equals("debugLow") && !openspcoop.equals("debugMedium") && !openspcoop.equals("debugHigh") && !openspcoop.equals("all")) {
- this.pd.setMessage("Livello OpenSPCoop dev'essere off, fatalOpenspcoop, errorSpcoop, errorOpenspcoop, infoSpcoop, infoOpenspcoop, debugLow, debugMedium, debugHigh o all");
- return false;
- }*/
- boolean foundIM = false;
- for (int i = 0; i < ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM.length; i++) {
- if(ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM[i].equals(integman)){
- foundIM = true;
- break;
- }
- }
- if (!foundIM &&
- !integman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM)) {
- this.pd.setMessage("Tipo autenticazione per integrationManager sconosciuto");
- return false;
- }
- if (profcoll != null && !profcoll.equals("") &&
- !profcoll.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !profcoll.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Profilo di collaborazione dev'essere abilitato o disabilitato");
- return false;
- }
- if (connessione != null && !connessione.equals("") &&
- !connessione.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONNESSIONE_NEW) &&
- !connessione.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONNESSIONE_REPLY)) {
- this.pd.setMessage("Connessione dev'essere abilitato o disabilitato");
- return false;
- }
- if (utilizzo != null && !utilizzo.equals("") && !utilizzo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !utilizzo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Utilizzo dev'essere abilitato o disabilitato");
- return false;
- }
- if (validman != null && !validman.equals("") && !validman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !validman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Manifest attachments dev'essere abilitato o disabilitato");
- return false;
- }
- if (!gestman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !gestman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Gestione dev'essere abilitato o disabilitato");
- return false;
- }
- if (!registrazioneTracce.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !registrazioneTracce.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Buste dev'essere abilitato o disabilitato");
- return false;
- }
- // if (!dumpApplicativo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- // !dumpApplicativo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- // this.pd.setMessage("Dump Applicativo dev'essere abilitato o disabilitato");
- // return false;
- // }
- // if (!dumpPD.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- // !dumpPD.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- // this.pd.setMessage("Dump Binario Porta Delegata dev'essere abilitato o disabilitato");
- // return false;
- // }
- // if (!dumpPA.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- // !dumpPA.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- // this.pd.setMessage("Dump Binario Porta Applicativa dev'essere abilitato o disabilitato");
- // return false;
- // }
- // inoltromin dev'essere numerico
- if (!this.checkNumber(inoltromin, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INOLTRO_BUSTE_NON_RISCONTRATE, false) ) {
- return false;
- }
- // Se integman = custom, nomeintegman dev'essere specificato
- if (integman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM) &&
- (nomeintegman == null || nomeintegman.equals(""))) {
- this.pd.setMessage("Indicare un nome per il tipo autenticazione");
- return false;
- }
- String configurazioneCachesTmp = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES);
- boolean isAllHiddenConfigurazione = ServletUtils.isCheckBoxEnabled(configurazioneCachesTmp);
- boolean isAllHiddenCache = !isAllHiddenConfigurazione;
-
- if(!this.registryCheckDataCache()){
- return false;
- }
-
- if(!this.configurazioneCheckDataCache()){
- return false;
- }
-
- if(!this.datiAutorizzazioneCheckDataCache()){
- return false;
- }
-
- if(!this.datiAutenticazioneCheckDataCache()){
- return false;
- }
-
- if(!this.datiGestioneTokenCheckDataCache()){
- return false;
- }
-
- if(!this.datiAttributeAuthorityCheckDataCache()){
- return false;
- }
-
- if(!this.datiKeystoreCheckDataCache()){
- return false;
- }
-
- if(!isAllHiddenCache &&
- (!this.controlloTrafficoCheckDataCache())
- ){
- return false;
- }
-
- if(!this.datiResponseCachingCheckDataCache()){
- return false;
- }
-
- if(!this.datiGestoreConsegnaApplicativiCheckDataCache()){
- return false;
- }
-
- // validazione URL Invocazione
- if(!this.checkDataURLInvocazione()) {
- return false;
- }
-
- // validazione Cors
- if(!this.checkDataCors()) {
- return false;
- }
-
- // validazione caching risposta
- if(!this.checkDataResponseCaching()) {
- return false;
- }
-
- // validazione canali
- if(!this.canaliCheckData()) {
- return false;
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- private boolean canaliCheckData() throws Exception {
- try{
- String canaliEnabledTmp = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_STATO);
- boolean canaliEnabled = ServletUtils.isCheckBoxEnabled(canaliEnabledTmp);
-
- Configurazione configurazione = this.confCore.getConfigurazioneGenerale();
- CanaliConfigurazione gestioneCanali = configurazione.getGestioneCanali();
- List<CanaleConfigurazione> canaleList = gestioneCanali != null ? gestioneCanali.getCanaleList() : null;
-
- if(canaliEnabled) {
- String canaliNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- String canaliDescrizione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- String canaliDefault = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT);
-
- if(canaleList == null || canaleList.size() == 0) { // in questa situazione mi dovrei trovare solo quando attivo la funzionalita'
- if(canaleDatiCheckData(canaliNome, canaliDescrizione) == false) {
- return false;
- }
- } else {
- if(StringUtils.isEmpty(canaliDefault)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT));
- return false;
- }
-
- boolean found = false;
- for (CanaleConfigurazione canaleConfigurazione : canaleList) {
- if(canaleConfigurazione.getNome().equals(canaliDefault)) {
- found = true;
- break;
- }
- }
-
- if(found ==false) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_CANALE_DEFAULT_SELEZIONATO_NON_ESISTE);
- return false;
- }
- }
- } else {
- boolean oldEnabled = (gestioneCanali != null && StatoFunzionalita.ABILITATO.equals(gestioneCanali.getStato()) ) ? true: false;
-
- StringBuilder inUsoMessage = new StringBuilder();
-
- if(oldEnabled) {
- // se era abilitato e ora sto disabilitando devo controllare che non ci sia nessun canale in uso in API, Erogazioni o Fruizioni
-
- if(canaleList != null) {
- for (CanaleConfigurazione canale : canaleList) {
- if(ConfigurazioneCanaliUtilities.isCanaleInUsoRegistro(canale, this.confCore, this, inUsoMessage, org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE)) {
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_FUNZIONALITA_CANALI_NON_DISATTIVABILE, inUsoMessage.toString()));
- return false;
- }
- }
- }
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- private boolean canaleDatiCheckData(String canaliNome, String canaliDescrizione) throws Exception {
- // nome obbligatorio
- if(StringUtils.isEmpty(canaliNome)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME));
- return false;
- }
-
- if(this.checkSpazi(canaliNome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME)==false) {
- return false;
- }
-
- if(this.checkLength255(canaliNome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME)==false) {
- return false;
- }
-
- if(this.checkLength255(canaliDescrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE)==false) {
- return false;
- }
-
- return true;
- }
-
- public boolean registryCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY);
- return checkDatiCache(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_REGISTRY, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean configurazioneCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONFIG);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONFIG);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONFIG);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONFIG);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONFIG);
- return checkDatiCache(CostantiPdD.JMX_CONFIGURAZIONE_PDD, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiAutorizzazioneCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHZ);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHZ);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHZ);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHZ);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHZ);
- return checkDatiCache(CostantiPdD.JMX_AUTORIZZAZIONE, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiAutenticazioneCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHN);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHN);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHN);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHN);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHN);
- return checkDatiCache(CostantiPdD.JMX_AUTENTICAZIONE, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiGestioneTokenCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_TOKEN);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_TOKEN);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_TOKEN);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_TOKEN);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_TOKEN);
- return checkDatiCache(CostantiPdD.JMX_TOKEN, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiAttributeAuthorityCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_ATTRIBUTE_AUTHORITY);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_ATTRIBUTE_AUTHORITY);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_ATTRIBUTE_AUTHORITY);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_ATTRIBUTE_AUTHORITY);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_ATTRIBUTE_AUTHORITY);
- return checkDatiCache(CostantiPdD.JMX_ATTRIBUTE_AUTHORITY, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiKeystoreCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE);
- boolean esito = checkDatiCache(CostantiPdD.JMX_KEYSTORE_CACHING, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- if(esito==false) {
- return false;
- }
-
- String crllifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE_KEYSTORE);
- if (statocache.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) && crllifecache!=null && !crllifecache.equals("") &&
- !this.checkNumber(crllifecache, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE+ "("+crllifecache+")", false)) {
- return false;
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean controlloTrafficoCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONTROLLO_TRAFFICO);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONTROLLO_TRAFFICO);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONTROLLO_TRAFFICO);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONTROLLO_TRAFFICO);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONTROLLO_TRAFFICO);
- return checkDatiCache(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONTROLLO_TRAFFICO, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiGestoreConsegnaApplicativiCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE);
- return checkDatiCache(CostantiPdD.JMX_LOAD_BALANCER, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean datiResponseCachingCheckDataCache() throws Exception {
- try{
- String statocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_RISPOSTE);
- String dimensionecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_RISPOSTE);
- String algoritmocache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_RISPOSTE);
- String idlecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_RISPOSTE);
- String lifecache = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_RISPOSTE);
- return checkDatiCache(CostantiPdD.JMX_RESPONSE_CACHING, statocache, dimensionecache, algoritmocache, idlecache, lifecache);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di appender dei messaggi diagnostici
- public void prepareDiagnosticaAppenderList(List<OpenspcoopAppender> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER);
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_MESSAGGI_DIAGNOSTICI , null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- OpenspcoopAppender oa = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pOaId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, oa.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_CHANGE, pOaId);
- de.setValue(oa.getTipo());
- de.setIdToRemove(""+oa.getId());
- e.add(de);
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_PROPERTIES_LIST, pOaId);
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long)oa.sizePropertyList());
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati dell'appender dei messaggi diagnostici
- public boolean diagnosticaAppenderCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- if (tipo == null || "".equals(tipo)) {
- this.pd.setMessage("Il campo Tipo deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che l'appender non sia gia' stato registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovatoAppender = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- MessaggiDiagnostici md = newConfigurazione.getMessaggiDiagnostici();
- if (md != null) {
- OpenspcoopAppender oa = null;
- for (int j = 0; j < md.sizeOpenspcoopAppenderList(); j++) {
- oa = md.getOpenspcoopAppender(j);
- if (tipo.equals(oa.getTipo())) {
- trovatoAppender = true;
- break;
- }
- }
- }
- if (trovatoAppender) {
- this.pd.setMessage("Esiste già un Appender con tipo " + tipo);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di property di appender dei messaggi diagnostici
- public void prepareDiagnosticaAppenderPropList(OpenspcoopAppender oa,
- List<Property> lista)
- throws Exception {
- try {
- Parameter pOaId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, ""+oa.getId());
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_PROPERTIES, pOaId);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_APPENDER_MESSAGGI_DIAGNOSTICI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_LIST));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA + " di " + oa.getTipo(),
- null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- Property oap = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pIdProp = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA, oap.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_PROPERTIES_CHANGE, pOaId, pIdProp);
- de.setValue(oap.getNome());
- de.setIdToRemove(""+oap.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(oap.getValore());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle property dell'appender dei messaggi diagnostici
- public boolean diagnosticaAppenderPropCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- int idInt = Integer.parseInt(id);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (valore == null || "".equals(valore)) {
- this.pd.setMessage("Il campo Valore deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che la property non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovataProp = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- MessaggiDiagnostici md = newConfigurazione.getMessaggiDiagnostici();
- OpenspcoopAppender oa = null;
- for (int j = 0; j < md.sizeOpenspcoopAppenderList(); j++) {
- oa = md.getOpenspcoopAppender(j);
- if (idInt == oa.getId().intValue()) {
- break;
- }
- }
-
- if(oa==null) {
- throw new DriverControlStationException("Appender non trovato");
- }
-
- Property oap = null;
- for (int i = 0; i < oa.sizePropertyList(); i++) {
- oap = oa.getProperty(i);
- if (nome.equals(oap.getNome())) {
- trovataProp = true;
- break;
- }
- }
- if (trovataProp) {
- this.pd.setMessage("Esiste già una Proprietà con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di datasource dei messaggi diagnostici
- public void prepareDiagnosticaDatasourceList(List<OpenspcoopSorgenteDati> lista)
- throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE);
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_SORGENTI_DATI_MESSAGGI_DIAGNOSTICI , null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_JNDI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- OpenspcoopSorgenteDati od = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, od.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_CHANGE, pId);
- de.setValue(od.getNome());
- de.setIdToRemove(""+od.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(od.getNomeJndi());
- e.add(de);
- de = new DataElement();
- de.setValue(od.getTipoDatabase());
- e.add(de);
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_PROPERTIES_LIST, pId);
- if (contaListe!=null && contaListe.booleanValue())
- ServletUtils.setDataElementVisualizzaLabel(de, (long) od.sizePropertyList());
- else
- ServletUtils.setDataElementVisualizzaLabel(de);
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati del sorgente dati dei messaggi diagnostici
- public boolean diagnosticaDatasourceCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String nomeJndi = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_JNDI);
- String tipoDatabase = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_DATABASE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (nomeJndi == null || "".equals(nomeJndi)) {
- this.pd.setMessage("Il campo Nome Jndi deve essere specificato.");
- return false;
- }
- if (tipoDatabase == null || "".equals(tipoDatabase)) {
- this.pd.setMessage("Il campo Tipo Database deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che il sorgente dati non sia gia' stato registrato
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovatoDatasource = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- MessaggiDiagnostici md = newConfigurazione.getMessaggiDiagnostici();
- if (md != null) {
- List<OpenspcoopSorgenteDati> lista = md.getOpenspcoopSorgenteDatiList();
- OpenspcoopSorgenteDati od = null;
- for (int j = 0; j < md.sizeOpenspcoopSorgenteDatiList(); j++) {
- od = lista.get(j);
- if (nome.equals(od.getNome())) {
- trovatoDatasource = true;
- break;
- }
- }
- }
- if (trovatoDatasource) {
- this.pd.setMessage("Esiste già un sorgente dati con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista di property di datasource dei messaggi diagnostici
- public void prepareDiagnosticaDatasourcePropList(OpenspcoopSorgenteDati od,
- List<Property> lista)
- throws Exception {
- try {
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID, od.getId() + "");
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_PROPERTIES, pId);
- //this.pd.setIndex(offset);
- //this.pd.setPageSize(limit);
- if (lista == null)
- this.pd.setNumEntries(0);
- else
- this.pd.setNumEntries(lista.size());
- this.pd.setSearchDescription("");
- this.pd.setSearch("off");
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ELENCO_SORGENTI_DATI_MESSAGGI_DIAGNOSTICI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_LIST));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA + " di " + od.getNome(), null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALORE
- };
- this.pd.setLabels(labels);
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- Property odp = lista.get(i);
- List<DataElement> e = new ArrayList<>();
- Parameter pOdpId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID_PROPRIETA, odp.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_PROPERTIES_CHANGE, pId, pOdpId);
- de.setValue(odp.getNome());
- de.setIdToRemove(""+odp.getId());
- e.add(de);
- de = new DataElement();
- de.setValue(odp.getValore());
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Controlla i dati delle property del datasource dei messaggi diagnostici
- public boolean diagnosticaDatasourcePropCheckData(TipoOperazione tipoOp)
- throws Exception {
- try {
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ID);
- int idInt = Integer.parseInt(id);
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALORE);
- if (nome == null || "".equals(nome)) {
- this.pd.setMessage("Il campo Nome deve essere specificato.");
- return false;
- }
- if (valore == null || "".equals(valore)) {
- this.pd.setMessage("Il campo Valore deve essere specificato.");
- return false;
- }
- // Se tipoOp = add, controllo che la property non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean trovataProp = false;
- Configurazione newConfigurazione = this.core.getConfigurazioneGenerale();
- MessaggiDiagnostici md = newConfigurazione.getMessaggiDiagnostici();
- List<OpenspcoopSorgenteDati> lista = md.getOpenspcoopSorgenteDatiList();
- OpenspcoopSorgenteDati od = null;
- for (int j = 0; j < md.sizeOpenspcoopSorgenteDatiList(); j++) {
- od = lista.get(j);
- if (idInt == od.getId().intValue()) {
- break;
- }
- }
-
- if(od==null) {
- throw new DriverControlStationException("Datasource non trovato");
- }
-
- List<Property> lista1 = od.getPropertyList();
- Property odp = null;
- for (int i = 0; i < od.sizePropertyList(); i++) {
- odp = lista1.get(i);
- if (nome.equals(odp.getNome())) {
- trovataProp = true;
- break;
- }
- }
- if (trovataProp) {
- this.pd.setMessage("Esiste già una Proprietà con nome " + nome);
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public List<DataElement> addValoriRottaToDati(TipoOperazione tipoOp, String nome,
- String tipo, String tiporotta, String registrorotta,
- String[] registriList,
- String[] registriListLabel, List<DataElement> dati, String tiposoggrotta, String nomesoggrotta,
- String[] tipiSoggettiLabel, String[] tipiSoggettiLabelPerProtocollo )
- throws DriverRegistroServiziException {
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINATARIO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- // if (InterfaceType.STANDARD.equals(ServletUtils.getUserFromSession(this.session).getInterfaceType())) {
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- // de.setValue(this.soggettiCore.getTipoSoggettoDefault());
- // de.setType(DataElementType.HIDDEN);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- // de.setSize(getSize());
- // dati.add(de);
- // } else {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- // if (tipo == null) {
- // de.setValue("");
- // } else {
- // de.setValue(tipo);
- // }
- de.setSelected(tipo);
- de.setValues(tipiSoggettiLabel);
- //de.setType(DataElementType.TEXT_EDIT);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setPostBack(true);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- // }
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ROTTA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoR = { ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA);
- de.setValues(tipoR);
- de.setSelected(tiporotta);
- // de.setOnChange("CambiaRotta('add')");
- de.setPostBack(true);
- dati.add(de);
- // if (InterfaceType.STANDARD.equals(ServletUtils.getUserFromSession(this.session).getInterfaceType())) {
- // if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY)) {
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- // de.setValue(this.soggettiCore.getTipoSoggettoDefault());
- // de.setType(DataElementType.HIDDEN);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- // de.setSize(getSize());
- // dati.add(de);
- //
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- // de.setValue(nomesoggrotta);
- // de.setType(DataElementType.TEXT_EDIT);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- // de.setSize(getSize());
- // de.setRequired(true);
- // dati.add(de);
- // }
- // } else {
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- //de.setValue(tiposoggrotta);
- de.setSelected(tiposoggrotta);
- de.setValues(tipiSoggettiLabelPerProtocollo);
- //de.setType(DataElementType.TEXT_EDIT);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- de.setValue(nomesoggrotta);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- }
- // }
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- de.setValues(registriList);
- de.setLabels(registriListLabel);
- de.setSelected(registrorotta);
- dati.add(de);
- }
- return dati;
- }
- public List<DataElement> addRoutingToDati(TipoOperazione tipoOp, String tiporotta,
- String tiposoggrotta, String nomesoggrotta, String registrorotta,
- String rottaenabled,
- String[] registriList, String[] registriListLabel, String[] tipiSoggettiLabel,
- List<DataElement> dati) throws DriverRegistroServiziException {
-
- if(dati==null) {
- throw new DriverRegistroServiziException("Dati is null");
- }
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ROUTING_DELLE_BUSTE);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- DataElement de = new DataElement();
- String[] tipoRouting = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ROUTING_DELLE_BUSTE_STATO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ROTTA_ENABLED);
- de.setValues(tipoRouting);
- de.setSelected(rottaenabled);
- // de.setOnChange("CambiaRouting()");
- de.setPostBack(true);
- dati.add(de);
- if (rottaenabled.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ROTTA_DI_DEFAULT);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoR = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA);
- de.setValues(tipoR);
- de.setSelected(tiporotta);
- // de.setOnChange("CambiaRotta('routing')");
- de.setPostBack(true);
- dati.add(de);
- // if (InterfaceType.STANDARD.equals(ServletUtils.getUserFromSession(this.session).getInterfaceType())) {
- // if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY)) {
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- // de.setValue(this.soggettiCore.getTipoSoggettoDefault());
- // de.setType(DataElementType.HIDDEN);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- // de.setSize(getSize());
- // dati.add(de);
- //
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- // de.setValue(nomesoggrotta);
- // de.setType(DataElementType.TEXT_EDIT);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- // de.setRequired(true);
- // de.setSize(getSize());
- // dati.add(de);
- // }
- // } else {
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_GATEWAY)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- //de.setValue(tiposoggrotta);
- //de.setType(DataElementType.TEXT_EDIT);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_SOGGETTO_ROTTA);
- de.setValues(tipiSoggettiLabel);
- de.setSelected(tiposoggrotta);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- de.setValue(nomesoggrotta);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_SOGGETTO_ROTTA);
- de.setSize(getSize());
- de.setRequired(true);
- dati.add(de);
- }
- // }
- if (tiporotta.equals(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_ROTTA_REGISTRO)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRO_ROTTA);
- de.setValues(registriList);
- de.setLabels(registriListLabel);
- de.setSelected(registrorotta);
- dati.add(de);
- }
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ROTTE_STATICHE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ROTTE_ROUTING_LIST);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DESTINAZIONI);
- dati.add(de);
- }
-
- dati = this.addParameterApplicaModifica(dati);
- return dati;
- }
- public List<DataElement> addRegistroToDati(TipoOperazione tipoOP, String nome, String location, String tipo,
- String utente, String password, String confpw,
- List<DataElement> dati) {
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- DataElement de = new DataElement();
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME);
- de.setValue(nome);
- if(TipoOperazione.ADD.equals(tipoOP)){
- de.setType(DataElementType.TEXT_EDIT);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME);
- de.setSize( getSize());
- de.setRequired(true);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOCATION);
- de.setValue(location);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOCATION);
- de.setSize( getSize());
- de.setRequired(true);
- dati.add(de);
- //String[] tipoReg = { "xml", "db", "uddi", "web", "ws" };
- String[] tipoReg = {
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_XML,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_DB,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_WEB,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_WS
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO);
- de.setValues(tipoReg);
- de.setSelected(tipo);
- de.setPostBack(true);
- dati.add(de);
- if (tipo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_UDDI)) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_UTENTE);
- de.setValue(utente);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTENTE);
- de.setSize( getSize());
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PW);
- de.setValue(password);
- de.setType(DataElementType.CRYPT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PW);
- de.setSize( getSize());
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONFERMA_PW);
- de.setValue(confpw);
- de.setType(DataElementType.CRYPT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONFERMA_PW);
- de.setSize( getSize());
- dati.add(de);
- }
- return dati;
- }
-
-
- public List<DataElement> addConfigurazioneToDati(
- boolean allHidden,
- String inoltromin, String stato,
- String controllo, String severita, String severita_log4j,
- String integman, String nomeintegman, String profcoll,
- String connessione, String utilizzo, String validman,
- String gestman, String registrazioneTracce, String dumpPD, String dumpPA,
- String xsd, String tipoValidazione, String confPers, Configurazione configurazione,
- List<DataElement> dati, String applicaMTOM,
- String urlInvocazionePA, String urlInvocazionePD,
- boolean multitenantEnabled, String multitenantSoggettiFruizioni, String multitenantSoggettiErogazioni,
- boolean editModeEnabled,
- boolean corsStato, TipoGestioneCORS corsTipo, boolean corsAllAllowOrigins, boolean corsAllAllowHeaders, boolean corsAllAllowMethods,
- String corsAllowHeaders, String corsAllowOrigins, String corsAllowMethods,
- boolean corsAllowCredential, String corsExposeHeaders, boolean corsMaxAge, int corsMaxAgeSeconds,
- boolean responseCachingEnabled, int responseCachingSeconds, boolean responseCachingMaxResponseSize, long responseCachingMaxResponseSizeBytes,
- boolean responseCachingDigestUrlInvocazione, boolean responseCachingDigestHeaders, boolean responseCachingDigestPayload, String responseCachingDigestHeadersNomiHeaders, StatoFunzionalitaCacheDigestQueryParameter responseCachingDigestQueryParameter, String responseCachingDigestNomiParametriQuery,
- boolean responseCachingCacheControlNoCache, boolean responseCachingCacheControlMaxAge, boolean responseCachingCacheControlNoStore, boolean visualizzaLinkConfigurazioneRegola,
- String servletResponseCachingConfigurazioneRegolaList, List<Parameter> paramsResponseCachingConfigurazioneRegolaList, int numeroResponseCachingConfigurazioneRegola, int numeroRegoleProxyPass,
- boolean canaliEnabled, int numeroCanali, int numeroNodi, String canaliNome, String canaliDescrizione, List<CanaleConfigurazione> canaleList, String canaliDefault,
- int numeroArchiviPlugins, int numeroClassiPlugins) throws Exception {
- DataElement de = new DataElement();
- // Configurazione Inoltro Buste non Riscontrate e Validazione Buste
-
- if (!this.isModalitaCompleta() || allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
- de.setValue(inoltromin);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
- de.setSize( getSize());
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO);
- de.setValue(stato);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO);
- de.setValue(controllo);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
- de.setValue(profcoll);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALIDMAN);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALIDMAN);
- de.setValue(validman);
- dati.add(de);
- } else {
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INOLTRO_BUSTE_NON_RISCONTRATE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
- de.setValue(inoltromin);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
- de.setRequired(true);
- de.setSize(getSize());
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_VALIDAZIONE_BUSTE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoStato = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO);
- de.setValues(tipoStato);
- de.setSelected(stato);
- dati.add(de);
- String[] tipoControllo = {
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_RIGIDO,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_NORMALE
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO);
- de.setValues(tipoControllo);
- de.setSelected(controllo);
- dati.add(de);
- String[] tipoPF = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
- de.setValues(tipoPF);
- de.setSelected(profcoll);
- dati.add(de);
- String[] tipoVM = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_VALIDMAN);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALIDMAN);
- de.setValues(tipoVM);
- de.setSelected(validman);
- dati.add(de);
- }
- // Mesaggi Diagnostici
-
- addMessaggiDiagnosticiToDatiAsHidden(severita, severita_log4j, dati);
- // Tracciamento
-
- addTracciamentoToDatiAsHidden(registrazioneTracce, configurazione, dati);
-
- // RegistrazioneMessaggi
-
- addRegistrazioneMessaggiToDatiAsHidden(dumpPD, dumpPA, configurazione, dati);
-
-
- // Configurazione Validazione Contenuti Applicativi, Risposte (Connessione) e Indirizzo Telematico
-
- if (!this.isModalitaCompleta() || allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
- de.setValue(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONNESSIONE_REPLY);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_UTILIZZO);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTILIZZO);
- de.setValue(CostantiConfigurazione.DISABILITATO.toString());
- de.setSelected(utilizzo);
- dati.add(de);
- } else {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_VALIDAZIONE_CONTENUTI_APPLICATIVI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoXsd = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_XSD);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_XSD);
- de.setValues(tipoXsd);
- // de.setOnChange("CambiaValidazione('" +
- // InterfaceType.STANDARD.equals(user.getInterfaceType()) +
- // "')");
- de.setPostBack(true);
- if (xsd == null) {
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
- } else {
- de.setSelected(xsd);
- }
- dati.add(de);
- if (ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(xsd) ||
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY .equals(xsd)) {
- //String[] tipi_validazione = { "xsd", "wsdl", "openspcoop" };
- String[] tipi_validazione = {
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE_XSD,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE_WSDL
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE);
- de.setValues(tipi_validazione);
- if (tipoValidazione == null) {
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE_XSD);
- } else {
- de.setSelected(tipoValidazione);
- }
- dati.add(de);
-
-
- // Applica MTOM
- de = new DataElement();
- de.setLabel(PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_ACCETTA_MTOM);
-
- if(this.isModalitaAvanzata()){
- de.setType(DataElementType.CHECKBOX);
- if( ServletUtils.isCheckBoxEnabled(applicaMTOM) || CostantiRegistroServizi.ABILITATO.equals(applicaMTOM) ){
- de.setSelected(true);
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(applicaMTOM);
- }
-
- de.setName(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_APPLICA_MTOM);
- dati.add(de);
- }
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RISPOSTE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoConn = {
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONNESSIONE_NEW,
- ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONNESSIONE_REPLY
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
- de.setValues(tipoConn);
- de.setSelected(connessione);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INDIRIZZO_TELEMATICO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- String[] tipoU = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_UTILIZZO);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTILIZZO);
- de.setValues(tipoU);
- de.setSelected(utilizzo);
- dati.add(de);
- }
-
- // Configurazione Gestione Manifest
-
- if (this.isModalitaCompleta() && !allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MANIFEST_ATTACHMENTS);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
- String[] tipoGM = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTMAN);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTMAN);
- if (!this.isModalitaCompleta() || allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setValues(tipoGM);
- de.setSelected(gestman);
- }
- de.setValue(gestman);
- dati.add(de);
-
-
-
- // Configurazione Multitenant
-
- if(!allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MULTITENANT);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- boolean existsMoreThanOneSoggettoOperativoPerProtocollo = false;
- List<org.openspcoop2.core.registry.Soggetto> l = this.soggettiCore.getSoggettiOperativi();
- Map<String, Integer> countSoggettoOperativiByProtocol = new HashMap<>();
- if(l!=null && !l.isEmpty()) {
- for (org.openspcoop2.core.registry.Soggetto soggetto : l) {
- String protocol = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(soggetto.getTipo());
- int count = 0;
- if(countSoggettoOperativiByProtocol.containsKey(protocol)) {
- count = countSoggettoOperativiByProtocol.remove(protocol);
- }
- count ++;
- if(count>1) {
- existsMoreThanOneSoggettoOperativoPerProtocollo = true;
- break;
- }
- countSoggettoOperativiByProtocol.put(protocol, count);
- }
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_STATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_STATO);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- if(!existsMoreThanOneSoggettoOperativoPerProtocollo) {
- de.setType(DataElementType.SELECT);
- de.setPostBack(true);
- de.setValues(ConfigurazioneCostanti.STATI);
- de.setSelected(multitenantEnabled ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- }
- de.setValue(multitenantEnabled ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
- dati.add(de);
-
- if(multitenantEnabled) {
-
- boolean linkSoggettiFiltroDominioImpostato = false; // confonde
- if(!allHidden && linkSoggettiFiltroDominioImpostato) {
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_SOGGETTI);
- de.setType(DataElementType.LINK);
- de.setUrl(SoggettiCostanti.SERVLET_NAME_SOGGETTI_LIST,
- new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_FILTER_DOMINIO_INTERNO,"true"));
- dati.add(de);
- }
-
- if(!allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MULTITENANT_FRUIZIONI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_FRUIZIONI_SOGGETTO_EROGATORE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_FRUIZIONI_SOGGETTO_EROGATORE);
- if(!allHidden && editModeEnabled) {
- de.setType(DataElementType.SELECT);
- String [] values = MultitenantSoggettiFruizioni.toEnumNameArray();
- String [] labels = MultitenantSoggettiFruizioni.toArray();
- de.setValues(values);
- de.setLabels(labels);
- de.setSelected(multitenantSoggettiFruizioni);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(multitenantSoggettiFruizioni);
- dati.add(de);
-
- if(!editModeEnabled) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_FRUIZIONI_SOGGETTO_EROGATORE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_FRUIZIONI_SOGGETTO_EROGATORE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- String multi = MultitenantSoggettiFruizioni.SOLO_SOGGETTI_ESTERNI.getValue();
- try {
- multi = MultitenantSoggettiFruizioni.valueOf(multitenantSoggettiFruizioni).getValue();
- }catch(Exception e) {
- // null
- }
- de.setValue(multi);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
- }
-
- if(!allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MULTITENANT_EROGAZIONI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_EROGAZIONI_SOGGETTI_FRUITORI);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_EROGAZIONI_SOGGETTI_FRUITORI);
- if(!allHidden && editModeEnabled) {
- de.setType(DataElementType.SELECT);
- String [] values = MultitenantSoggettiErogazioni.toEnumNameArray();
- String [] labels = MultitenantSoggettiErogazioni.toArray();
- de.setValues(values);
- de.setLabels(labels);
- de.setSelected(multitenantSoggettiErogazioni);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(multitenantSoggettiErogazioni);
- dati.add(de);
-
- if(!editModeEnabled) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_MULTITENANT_EROGAZIONI_SOGGETTI_FRUITORI);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_EROGAZIONI_SOGGETTI_FRUITORI+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- String multi = MultitenantSoggettiErogazioni.SOLO_SOGGETTI_ESTERNI.getValue();
- try {
- multi = MultitenantSoggettiErogazioni.valueOf(multitenantSoggettiErogazioni).getValue();
- }catch(Exception e) {
- // null
- }
- de.setValue(multi);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
- }
- }
-
-
-
- // Configurazione URL di Invocazione
-
- if(!allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PREFIX_URL_INVOCAZIONE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- de.setValue(urlInvocazionePA);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(false);
- }
- de.setValue(urlInvocazionePD);
- dati.add(de);
-
- if(!allHidden) {
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_LIST);
- boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
- if (contaListeFromSession)
- de.setValue(ConfigurazioneCostanti.LABEL_REGOLE_PROXY_PASS+" (" + numeroRegoleProxyPass + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_REGOLE_PROXY_PASS);
- dati.add(de);
-
- String send = ArchiviCostanti.SERVLET_NAME_PACKAGE_EXPORT+"?"+
- ArchiviCostanti.PARAMETRO_ARCHIVI_EXPORT_TIPO+"="+ArchiveType.CONFIGURAZIONE_URL_INVOCAZIONE.name();
- List<String> protocolli = this.confCore.getProtocolli(this.request, this.session, true);
- String protocollo = protocolli.get(0);
- if(protocollo!=null && !"".equals(protocollo)){
- send = send + "&" + ArchiviCostanti.PARAMETRO_ARCHIVI_PROTOCOLLO+"="+ protocollo;
- }
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- List<ExportMode> exportModes = exporterUtils.getExportModesCompatibleWithAllProtocol(protocolli, ArchiveType.CONFIGURAZIONE_URL_INVOCAZIONE);
- String exportMode = null;
- if(exportModes!=null) {
- if(exportModes.contains(org.openspcoop2.protocol.basic.Costanti.OPENSPCOOP_EXPORT_ARCHIVE_MODE)){
- exportMode = org.openspcoop2.protocol.basic.Costanti.OPENSPCOOP_EXPORT_ARCHIVE_MODE.toString();
- }else{
- exportMode = exportModes.get(0).toString();
- }
- }
- if(exportMode!=null && !"".equals(exportMode)){
- send = send + "&" + ArchiviCostanti.PARAMETRO_ARCHIVI_TIPOLOGIA_ARCHIVIO+"="+ exportMode;
- }
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(send);
- de.setValue(ConfigurazioneCostanti.LABEL_ESPORTA_URL_INVOCAZIONE);
- dati.add(de);
-
- }
-
-
- // Configuriazione CORS
- this.addConfigurazioneCorsToDati(dati, corsStato, corsTipo,
- corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
- corsAllowHeaders, corsAllowOrigins, corsAllowMethods,
- corsAllowCredential, corsExposeHeaders, corsMaxAge, corsMaxAgeSeconds,
- true,
- allHidden);
-
- // Configurazione Response Caching
- this.addResponseCachingToDati(dati, responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize, responseCachingMaxResponseSizeBytes, responseCachingDigestUrlInvocazione, responseCachingDigestHeaders,
- responseCachingDigestPayload, true, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
- responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore,
- visualizzaLinkConfigurazioneRegola, servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList, numeroResponseCachingConfigurazioneRegola,
- allHidden);
-
- // Configurazione Canali
- this.addConfigurazioneCanaliToDati(dati, canaliEnabled, numeroCanali, numeroNodi, canaliNome, canaliDescrizione, true, allHidden, canaleList, canaliDefault);
-
-
- // Configurazione I.M.
- boolean integrationManagerSupported = this.confCore.isIntegrationManagerEnabled();
-
- if (integrationManagerSupported && !this.isModalitaStandard() && !allHidden) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INTEGRATION_MANAGER);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
- int totEl = ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM.length;
- if (confPers.equals(Costanti.CHECK_BOX_ENABLED_TRUE))
- totEl++;
- String[] tipoIM = new String[totEl];
- for (int i = 0; i < ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM.length; i++) {
- tipoIM[i] = ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM[i];
- }
- if (confPers.equals(Costanti.CHECK_BOX_ENABLED_TRUE))
- tipoIM[(totEl-1)] = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM;
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INTEGMAN);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_INTEGMAN);
- if (!integrationManagerSupported || this.isModalitaStandard() || allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setValues(tipoIM);
- de.setSelected(integman);
- de.setPostBack(true);
- }
- de.setValue(integman);
- dati.add(de);
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_NOME_INTEGMAN);
- if (!integrationManagerSupported || this.isModalitaStandard() || allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- if (integman == null || !integman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM))
- de.setType(DataElementType.HIDDEN);
- else
- de.setType(DataElementType.TEXT_EDIT);
- }
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_INTEGMAN);
- de.setValue(nomeintegman);
- dati.add(de);
-
-
-
- // Configurazione Plugins
-
- boolean pluginsAbilitati = this.core.isConfigurazionePluginsEnabled();
-
- if(!allHidden && pluginsAbilitati && !this.isModalitaStandard()) {
-
- boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // link Registro Archivi
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_LIST);
- if (contaListeFromSession)
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_REGISTRO_ARCHIVI +" (" + numeroArchiviPlugins + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_REGISTRO_ARCHIVI);
- dati.add(de);
-
- // Registro Classi
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_CLASSI_LIST);
- if (contaListeFromSession)
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_CLASSI+" (" + numeroClassiPlugins + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_CLASSI);
- dati.add(de);
- }
-
-
- // configurazione handler
- boolean handlerAbilitati = this.core.isConfigurazioneHandlersEnabled();
- if(!allHidden && handlerAbilitati && !this.isModalitaStandard()) {
- this.visualizzaLinkHandlers(dati, true, null, null, null);
- }
-
- // Configurazione del Profilo se il multitenant non è abilitato
-
- if(!allHidden && !multitenantEnabled) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROFILO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- ProtocolFactoryManager pManager = ProtocolFactoryManager.getInstance();
- MapReader<String, IProtocolFactory<?>> mapPFactory = pManager.getProtocolFactories();
- Enumeration<String> protocolName = mapPFactory.keys();
- List<String> protocolliDispondibili = new ArrayList<>();
- while (protocolName.hasMoreElements()) {
- String protocollo = (String) protocolName.nextElement();
- protocolliDispondibili.add(protocollo);
- }
- for (String protocollo : ProtocolUtils.orderProtocolli(protocolliDispondibili)) {
- IProtocolFactory<?> pFactory = mapPFactory.get(protocollo);
-
- InformazioniProtocollo infoProt = pFactory.getInformazioniProtocol();
-
- User user = ServletUtils.getUserFromSession(this.request, this.session);
- String userLogin = user.getLogin();
-
- if(mapPFactory.size()>1) {
- if(!allHidden && !multitenantEnabled) {
- de = new DataElement();
- de.setLabel(infoProt.getLabel());
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_NAME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_NAME+protocollo);
- de.setType(DataElementType.HIDDEN);
- de.setValue(protocollo);
- dati.add(de);
-
- if(!multitenantEnabled) {
- IDSoggetto idSoggetto = this.soggettiCore.getSoggettoOperativoDefault(userLogin, protocollo);
- long idSoggettoLong = this.soggettiCore.getIdSoggetto(idSoggetto.getNome(), idSoggetto.getTipo());
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_SOGGETTO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_SOGGETTO+protocollo);
- de.setValue(this.getLabelNomeSoggetto(protocollo, idSoggetto.getTipo(), idSoggetto.getNome()));
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- dati.add(de);
-
- if(!allHidden) {
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_SOGGETTO_VISUALIZZA_DATI);
- de.setType(DataElementType.LINK);
- de.setUrl(SoggettiCostanti.SERVLET_NAME_SOGGETTI_CHANGE,
- new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_ID,idSoggettoLong+""),
- new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_NOME,idSoggetto.getNome()),
- new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_TIPO,idSoggetto.getTipo()),
- new Parameter(SoggettiCostanti.PARAMETRO_SOGGETTO_MODIFICA_OPERATIVO,"true"));
- dati.add(de);
- }
- }
- }
-
-
- // Registro dei Servizi e Tabella di Routing
-
- if (!allHidden && this.isModalitaCompleta()) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_SERVIZI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ACCESSO_REGISTRO_SERVIZI);
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TABELLA_DI_ROUTING);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ROUTING);
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
-
- }
-
- // Proprietà di sistema
-
- if (!allHidden) {
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROPRIETA_SISTEMA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SYSTEM_PROPERTIES_LIST);
- ServletUtils.setDataElementVisualizzaLabel(de);
- dati.add(de);
-
- }
-
- // Lascio solo in menu
- // if(this.confCore.getJmxPdD_aliases()!=null && this.confCore.getJmxPdD_aliases().size()>0){
- //
- // de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA);
- // de.setType(DataElementType.TITLE);
- // dati.add(de);
- //
- // de = new DataElement();
- // de.setType(DataElementType.LINK);
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD);
- // ServletUtils.setDataElementVisualizzaLabel(de);
- // dati.add(de);
- //
- // }
- return dati;
- }
-
- private void addConfigurazioneCanaliToDati(List<DataElement> dati, boolean canaliEnabled, int numeroCanali,
- int numeroNodi, String canaliNome, String canaliDescrizione, boolean addTitle, boolean allHidden, List<CanaleConfigurazione> canaleList, String canaliDefault) throws Exception {
-
- boolean contaListeFromSession = ServletUtils.getContaListeFromSession(this.session) != null ? ServletUtils.getContaListeFromSession(this.session) : false;
- DataElement de;
-
- if(!allHidden && addTitle) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- boolean funzionalitaDisabilitabile = true;
- if(canaliEnabled) {
- if(canaleList != null) {
- for (CanaleConfigurazione canale : canaleList) {
- if(ConfigurazioneCanaliUtilities.isCanaleInUsoRegistro(canale, this.confCore, this, new StringBuilder(), org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE)) {
- funzionalitaDisabilitabile = false;
- break;
- }
- }
- }
- }
-
- de = new DataElement();
- de.setLabel(addTitle ? ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_STATO : "");
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_STATO);
- if(allHidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else if(!funzionalitaDisabilitabile) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setPostBack(true);
- de.setValues(CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA);
- de.setSelected(canaliEnabled ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
- }
- de.setValue(canaliEnabled ? StatoFunzionalita.ABILITATO.getValue() : StatoFunzionalita.DISABILITATO.getValue());
- dati.add(de);
-
- if(!allHidden) {
- // se si passa da disabilitato ad abilitato, il numero dei canali e' 0, devo visualizzare la form di inserimento del canale di default
- if(canaliEnabled) {
- if(numeroCanali == 0) {
- // subtitle
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALE_DEFAULT);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- // nome canale
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- de.setValue(canaliNome);
- de.setRequired(true);
- dati.add(de);
-
-
- // descrizione canale
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- de.setValue(canaliDescrizione);
- dati.add(de);
- } else {
- // scelta canale default
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT);
- de.setType(DataElementType.SELECT);
-
- List<String> canaliListValues = canaleList!=null ? canaleList.stream().map(CanaleConfigurazione::getNome).collect(Collectors.toList()) : new ArrayList<>();
- de.setValues(canaliListValues);
- de.setLabels(canaliListValues);
- de.setSelected(canaliDefault);
- dati.add(de);
-
- // link canali
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_LIST);
-
- if (contaListeFromSession)
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALI +" (" + numeroCanali + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALI);
- dati.add(de);
-
- // link nodi
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_NODI_LIST);
- if (contaListeFromSession)
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALI_NODI +" (" + numeroNodi + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_CANALI_NODI);
- dati.add(de);
- }
- }
- }
- }
- public void addRegistrazioneMessaggiToDatiAsHidden(String dumpPD, String dumpPA, Configurazione configurazione, List<DataElement> dati) {
- DataElement de = new DataElement();
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- de.setType(DataElementType.HIDDEN);
- de.setValue(dumpPD);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- de.setType(DataElementType.HIDDEN);
- de.setValue(dumpPA);
- dati.add(de);
-
- }
-
- public void addRegistrazioneMessaggiToDati(String dumpApplicativo, String dumpPD, String dumpPA, Configurazione configurazione, List<DataElement> dati, Boolean contaListe) {
- DataElement de;
- // DUMP
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_MESSAGGI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String[] tipoDump = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_APPLICATIVO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO);
- de.setType(DataElementType.SELECT);
- de.setValues(tipoDump);
- de.setSelected(dumpApplicativo);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(dumpApplicativo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)) {
- String oldDumpApplicativo =null;
- if(configurazione.getDump().getStato()!=null)
- oldDumpApplicativo = configurazione.getDump().getStato().toString();
-
- if(dumpApplicativo.equals(oldDumpApplicativo)) {
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_CONFIGURAZIONE,
- new Parameter(CostantiControlStation.PARAMETRO_DUMP_TIPO_CONFIGURAZIONE, TipoPdD.APPLICATIVA.getTipo()));
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DUMP_CONFIGURAZIONE_EROGAZIONI);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_CONFIGURAZIONE,
- new Parameter(CostantiControlStation.PARAMETRO_DUMP_TIPO_CONFIGURAZIONE, TipoPdD.DELEGATA.getTipo()));
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DUMP_CONFIGURAZIONE_FRUIZIONI);
- dati.add(de);
- }
- }
-
- if (this.isModalitaAvanzata()) {
- if (this.confCore.isDumpShowConfigurazioneCustomAppender()) {
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DUMP_APPENDER_LIST);
- if (contaListe!=null && contaListe.booleanValue()) {
- int totAppender = 0;
- if (configurazione.getDump() != null)
- totAppender =
- configurazione.getDump().sizeOpenspcoopAppenderList();
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER, (long)totAppender);
- } else
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
- }
- }
-
- if(this.isModalitaAvanzata()){
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- String[] tipoDumpConnettorePA = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- if(this.isModalitaAvanzata()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoDumpConnettorePA);
- de.setSelected(dumpPA);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PA_NOTE);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(dumpPA);
- }
- dati.add(de);
-
- String[] tipoDumpConnettorePD = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- if(this.isModalitaAvanzata()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoDumpConnettorePD);
- de.setSelected(dumpPD);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PD_NOTE);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(dumpPD);
- }
- dati.add(de);
-
- }
-
- public void addTracciamentoToDatiAsHidden(String registrazioneTracce, Configurazione configurazione, List<DataElement> dati) {
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO);
- de.setType(DataElementType.HIDDEN);
- de.setValue(registrazioneTracce);
- dati.add(de);
- }
- public void addTracciamentoToDati(String registrazioneTracce, Configurazione configurazione, List<DataElement> dati, Boolean contaListe) {
- DataElement de;
-
- boolean showTitleSection =
- (this.isModalitaCompleta())
- ||
- (this.isModalitaAvanzata() && (this.confCore.isTracceShowConfigurazioneCustomAppender() || this.confCore.isTracceShowSorgentiDatiDatabase()));
-
- if(showTitleSection) {
- if(this.isModalitaAvanzata()){
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
- }
-
- String[] tipoBuste = {
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO,
- ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO
- };
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO);
- if(this.isModalitaCompleta()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoBuste);
- de.setSelected(registrazioneTracce);
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(registrazioneTracce);
- }
- dati.add(de);
-
- if (this.isModalitaAvanzata()) {
- if (this.confCore.isTracceShowConfigurazioneCustomAppender()) {
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_APPENDER_LIST);
- if (contaListe!=null && contaListe.booleanValue()) {
- int totAppender = 0;
- if (configurazione.getTracciamento() != null)
- totAppender =
- configurazione.getTracciamento().sizeOpenspcoopAppenderList();
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER, (long)totAppender);
- } else
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
- }
- if (this.confCore.isTracceShowSorgentiDatiDatabase()) {
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_DATASOURCE_LIST);
- if (contaListe!=null && contaListe.booleanValue()) {
- int totDs = 0;
- if (configurazione.getTracciamento() != null)
- totDs =
- configurazione.getTracciamento().sizeOpenspcoopSorgenteDatiList();
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI, (long)totDs);
- } else
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI);
- dati.add(de);
- }
- }
-
- }
- public void addMessaggiDiagnosticiToDatiAsHidden(String severita, String severita_log4j, List<DataElement> dati) {
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
- de.setValue(severita);
- dati.add(de);
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
- de.setType(DataElementType.HIDDEN);
- de.setValue(severita_log4j);
- dati.add(de);
- }
-
- public void addConfigurazioneTracciamentoToDati(List<DataElement> dati) {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_TRANSAZIONI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PA));
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO_CONFIGURAZIONE_EROGAZIONI);
- dati.add(de);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_TRACCIAMENTO_TRANSAZIONI,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE, ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PD));
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TRACCIAMENTO_CONFIGURAZIONE_FRUIZIONI);
- dati.add(de);
-
- }
-
- public void addMessaggiDiagnosticiToDati(String severita, String severita_log4j, Configurazione configurazione,
- List<DataElement> dati, Boolean contaListe) {
-
- this.addSeveritaMessaggiDiagnosticiToDati(severita, severita_log4j, dati);
- if (this.isModalitaAvanzata()) {
- if (this.confCore.isMsgDiagnosticiShowConfigurazioneCustomAppender()) {
- DataElement de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_APPENDER_LIST);
- if (contaListe!=null && contaListe.booleanValue()) {
- int totAppender = 0;
- if (configurazione.getMessaggiDiagnostici() != null)
- totAppender =
- configurazione.getMessaggiDiagnostici().sizeOpenspcoopAppenderList();
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER, (long)totAppender);
- } else
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPENDER);
- dati.add(de);
- }
- if (this.confCore.isMsgDiagnosticiShowSorgentiDatiDatabase()) {
- DataElement de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_DIAGNOSTICA_DATASOURCE_LIST);
- if (contaListe!=null && contaListe.booleanValue()) {
- int totDs = 0;
- if (configurazione.getMessaggiDiagnostici() != null)
- totDs =
- configurazione.getMessaggiDiagnostici().sizeOpenspcoopSorgenteDatiList();
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI, (long)totDs);
- } else
- ServletUtils.setDataElementCustomLabel(de, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SORGENTI_DATI);
- dati.add(de);
- }
- }
- }
-
- public List<DataElement> addConfigurazioneSistemaSelectListNodiCluster(List<DataElement> dati, String [] nodiSelezionati) throws Exception {
-
- DataElement de = new DataElement();
- de.setType(DataElementType.MULTI_SELECT);
- de.setValues(this.confCore.getJmxPdDAliases());
- List<String> labels = new ArrayList<>();
- for (String alias : this.confCore.getJmxPdDAliases()) {
- labels.add(this.confCore.getJmxPdDDescrizione(alias));
- }
- de.setLabels(labels);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODI_CLUSTER);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
- de.setSize(this.getSize());
- de.setPostBack(true);
- if(labels.size()>10) {
- de.setRows(10);
- }
- else {
- de.setRows(labels.size());
- }
- de.setSelezionati(nodiSelezionati);
- dati.add(de);
-
-
- boolean resetAllCaches = false;
- if(this.confCore.isVisualizzaLinkClearAllCachesRemoteCheckCacheStatus()) {
- for (String alias : this.confCore.getJmxPdDAliases()) {
-
- List<String> caches = this.confCore.getJmxPdDCaches(alias);
- if(caches!=null && caches.size()>0){
- for (String cache : caches) {
-
- String stato = null;
- try{
- stato = this.confCore.getInvoker().readJMXAttribute(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- cache,
- this.confCore.getJmxPdDCacheNomeAttributoCacheAbilitata(alias));
- if(stato.equalsIgnoreCase("true")){
- stato = "abilitata";
- }
- else if(stato.equalsIgnoreCase("false")){
- stato = "disabilitata";
- }
- else{
- throw new DriverControlStationException("Stato ["+stato+"] sconosciuto");
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato della cache ["+cache+"](jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- if("abilitata".equals(stato)){
- resetAllCaches = true;
- break;
- }
- }
- }
- if(resetAllCaches) {
- break;
- }
- }
- }
- else {
- resetAllCaches = true;
- }
- if(resetAllCaches){
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_ALL_CACHES+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO_RESET_ALL_CACHE_ALL_NODES);
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_ALL_CACHES);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET_ALL_NODES);
- de.setSize(this.getSize());
- dati.add(de);
-
- StringBuilder sb = new StringBuilder("");
- if(nodiSelezionati!=null && nodiSelezionati.length>0) {
- for (int i = 0; i < nodiSelezionati.length; i++) {
- sb.append("&");
- sb.append(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODI_CLUSTER);
- sb.append("=");
- sb.append(nodiSelezionati[i]);
- }
- }
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_SELECTED_CACHES+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO_RESET_ALL_CACHE_SELECTED_NODES+
- sb.toString());
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_SELECTED_CACHES);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET_SELECTED_NODES);
- de.setSize(this.getSize());
- dati.add(de);
-
- Map<String, List<String>> map = this.confCore.getJmxPdDGruppiAliases();
- if(map!=null && !map.isEmpty()) {
- List<String> gruppi = new ArrayList<>();
- for (String gruppo : map.keySet()) {
- gruppi.add(gruppo);
- }
- Collections.sort(gruppi);
- int indexGr = 0;
- for (String gruppo : gruppi) {
-
- indexGr++;
-
- List<String> aliases = map.get(gruppo);
- StringBuilder sbGruppi = new StringBuilder("");
- if(aliases!=null && aliases.size()>0) {
- for (int i = 0; i < aliases.size(); i++) {
- sbGruppi.append("&");
- sbGruppi.append(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODI_CLUSTER);
- sbGruppi.append("=");
- sbGruppi.append(aliases.get(i));
- }
-
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_SELECTED_CACHES+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO_RESET_ALL_CACHE_SELECTED_NODES+
- sbGruppi.toString());
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_SELECTED_CACHES+"__gr"+indexGr);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET_GROUPES_NODES.replace(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET_GROUPES_NODES_KEYWORD, gruppo));
- de.setSize(this.getSize());
- dati.add(de);
- }
-
- }
- }
- }
-
- return dati;
- }
-
- private void addInformazioneNonDisponibile(List<DataElement> dati, String label){
- DataElement de = newDataElementStyleRuntime();
- de.setLabel(label);
- de.setValue(ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE);
- de.setType(DataElementType.TEXT);
- de.setSize(this.getSize());
- dati.add(de);
- }
-
- private DataElement newDataElementStyleRuntime() {
- DataElement de = new DataElement();
- de.setLabelStyleClass(Costanti.LABEL_MEDIUM_CSS_CLASS);
- return de;
- }
-
- public List<DataElement> addConfigurazioneSistema(List<DataElement> dati, String alias) throws Exception {
-
-
-
- DataElement de = newDataElementStyleRuntime();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_RUNTIME);
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
- de.setLabel(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER);
- de.setType(DataElementType.HIDDEN);
- de.setValue(alias);
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_EXPORT);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_EXPORTER,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER,alias));
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_EXPORT);
- de.setValue(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_EXPORT);
- de.setSize(this.getSize());
- dati.add(de);
-
- boolean resetAllCaches = false;
- List<String> caches = this.confCore.getJmxPdDCaches(alias);
- if(caches!=null && !caches.isEmpty()){
- for (String cache : caches) {
-
- String stato = null;
- try{
- stato = this.confCore.getInvoker().readJMXAttribute(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- cache,
- this.confCore.getJmxPdDCacheNomeAttributoCacheAbilitata(alias));
- if(stato.equalsIgnoreCase("true")){
- stato = "abilitata";
- }
- else if(stato.equalsIgnoreCase("false")){
- stato = "disabilitata";
- }
- else{
- throw new DriverControlStationException("Stato ["+stato+"] sconosciuto");
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato della cache ["+cache+"](jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- if("abilitata".equals(stato)){
- resetAllCaches = true;
- break;
- }
- }
- }
- if(resetAllCaches){
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_ALL_CACHES+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+this.confCore.getJmxPdDCacheNomeMetodoResetCache(alias));
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_RESET_ALL_CACHES);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET);
- de.setSize(this.getSize());
- dati.add(de);
- }
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_GENERALI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String versionePdD = null;
- try{
- versionePdD = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoVersionePdD(alias));
- if(this.isErroreHttp(versionePdD, "versione della PdD")){
- // e' un errore
- versionePdD = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della versione della PdD (jmxResourcePdD): "+e.getMessage(),e);
- versionePdD = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- if(versionePdD!=null){
- versionePdD = StringEscapeUtils.escapeHtml(versionePdD);
- }
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_PDD);
- de.setValue(versionePdD);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_PDD);
- de.setSize(this.getSize());
- dati.add(de);
-
- String versioneBaseDati = null;
- try{
- versioneBaseDati = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoVersioneBaseDati(alias));
- if(this.isErroreHttp(versioneBaseDati, "versione della base dati")){
- // e' un errore
- versioneBaseDati = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della versione della base dati (jmxResourcePdD): "+e.getMessage(),e);
- versioneBaseDati = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- if(versioneBaseDati!=null){
- versioneBaseDati = StringEscapeUtils.escapeHtml(versioneBaseDati);
- }
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_BASE_DATI);
- de.setValue(versioneBaseDati);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_BASE_DATI);
- de.setRows(4);
- de.setCols(60);
- de.setSize(this.getSize());
- dati.add(de);
-
-
- String confDir = null;
- try{
- confDir = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoDirectoryConfigurazione(alias));
- if(this.isErroreHttp(confDir, "directory di configurazione")){
- // e' un errore
- confDir = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della directory di configurazione (jmxResourcePdD): "+e.getMessage(),e);
- confDir = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- if(confDir!=null){
- confDir = StringEscapeUtils.escapeHtml(confDir);
- }
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_DIRECTORY_CONFIGURAZIONE);
- de.setValue(confDir);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_DIRECTORY_CONFIGURAZIONE);
- de.setRows(4);
- de.setCols(60);
- de.setSize(this.getSize());
- dati.add(de);
-
-
- String vendorJava = null;
- try{
- vendorJava = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoVendorJava(alias));
- if(this.isErroreHttp(vendorJava, "vendor di java")){
- // e' un errore
- vendorJava = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul vendor di java (jmxResourcePdD): "+e.getMessage(),e);
- vendorJava = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- if(vendorJava!=null){
- vendorJava = StringEscapeUtils.escapeHtml(vendorJava);
- }
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_VENDOR_JAVA);
- de.setValue(vendorJava);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_VENDOR_JAVA);
- de.setSize(this.getSize());
- dati.add(de);
-
-
- String versioneJava = null;
- try{
- versioneJava = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoVersioneJava(alias));
- if(this.isErroreHttp(versioneJava, "versione di java")){
- // e' un errore
- versioneJava = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della versione di java (jmxResourcePdD): "+e.getMessage(),e);
- versioneJava = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- if(versioneJava!=null){
- versioneJava = StringEscapeUtils.escapeHtml(versioneJava);
- }
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_JAVA);
- de.setValue(versioneJava);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_VERSIONE_JAVA);
- de.setSize(this.getSize());
- dati.add(de);
-
-
-
-
- String messageFactory = null;
- try{
- messageFactory = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoMessageFactory(alias));
- if(this.isErroreHttp(messageFactory, "message factory")){
- // e' un errore
- messageFactory = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della message factory (jmxResourcePdD): "+e.getMessage(),e);
- messageFactory = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- /**if(messageFactory!=null){
- messageFactory = StringEscapeUtils.escapeHtml(messageFactory);
- }*/
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_MESSAGE_FACTORY);
- de.setValue(messageFactory.trim().contains(" ") ? messageFactory.trim().replaceAll(" ", "\n") : messageFactory);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setRows(2);
- de.setCols(60);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_MESSAGE_FACTORY);
- de.setSize(this.getSize());
- dati.add(de);
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_STATO_SERVIZI);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaStatoServiziPdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoStatoServizioPortaDelegata(alias));
- boolean enable = CostantiConfigurazione.ABILITATO.getValue().equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PD);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato del servizio Porta Delegata (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PD);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaStatoServiziPdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoStatoServizioPortaApplicativa(alias));
- boolean enable = CostantiConfigurazione.ABILITATO.getValue().equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PA);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato del servizio Porta Applicativa (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_PA);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaStatoServiziPdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoStatoServizioIntegrationManager(alias));
- boolean enable = CostantiConfigurazione.ABILITATO.getValue().equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_IM);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_IM);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato del servizio Integration Manager (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_STATO_SERVIZIO_IM);
- }
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_DIAGNOSTICA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- try{
- String livelloSeverita = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoSeveritaDiagnostici(alias));
-
- String[] tipoMsg = { LogLevels.LIVELLO_OFF, LogLevels.LIVELLO_FATAL, LogLevels.LIVELLO_ERROR_PROTOCOL, LogLevels.LIVELLO_ERROR_INTEGRATION,
- LogLevels.LIVELLO_INFO_PROTOCOL, LogLevels.LIVELLO_INFO_INTEGRATION,
- LogLevels.LIVELLO_DEBUG_LOW, LogLevels.LIVELLO_DEBUG_MEDIUM, LogLevels.LIVELLO_DEBUG_HIGH,
- LogLevels.LIVELLO_ALL};
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
- de.setValues(tipoMsg);
- de.setSelected(livelloSeverita);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul livello dei diagnostici (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
- }
-
- try{
- String livelloSeverita = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoSeveritaDiagnosticiLog4j(alias));
-
- String[] tipoMsg = { LogLevels.LIVELLO_OFF, LogLevels.LIVELLO_FATAL, LogLevels.LIVELLO_ERROR_PROTOCOL, LogLevels.LIVELLO_ERROR_INTEGRATION,
- LogLevels.LIVELLO_INFO_PROTOCOL, LogLevels.LIVELLO_INFO_INTEGRATION,
- LogLevels.LIVELLO_DEBUG_LOW, LogLevels.LIVELLO_DEBUG_MEDIUM, LogLevels.LIVELLO_DEBUG_HIGH,
- LogLevels.LIVELLO_ALL};
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
- if(this.core.isVisualizzazioneConfigurazioneDiagnosticaLog4J()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(livelloSeverita);
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- de.setValue(livelloSeverita);
- }
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul livello dei diagnostici log4j (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
- }
-
- try{
- String log4j_diagnostica = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoLog4jDiagnostica(alias));
- boolean enable = "true".equals(log4j_diagnostica);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOG4J_DIAGNOSTICA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DIAGNOSTICA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DIAGNOSTICA_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato di log del file govway_diagnostici.log (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DIAGNOSTICA_LABEL);
- }
-
- try{
- String log4j_openspcoop = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoLog4jOpenspcoop(alias));
- boolean enable = "true".equals(log4j_openspcoop);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOG4J_OPENSPCOOP);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_OPENSPCOOP_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_OPENSPCOOP_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato di log del file govway.log (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_OPENSPCOOP_LABEL);
- }
-
- try{
- String log4j_integrationManager = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoLog4jIntegrationManager(alias));
- boolean enable = "true".equals(log4j_integrationManager);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOG4J_INTEGRATION_MANAGER);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_INTEGRATION_MANAGER_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_INTEGRATION_MANAGER_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato di log del file govway_integrationManager.log (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_INTEGRATION_MANAGER_LABEL);
- }
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_TRACCIAMENTO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTracciamento(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- if(this.isModalitaAvanzata()) {
- if(this.isModalitaCompleta()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- }
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(v);
- }
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul tracciamento (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoDumpPA(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PA_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul dump binario sulla Porta Applicativa (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PA_LABEL);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoDumpPD(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PD_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PD_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul dump binario sulla Porta Delegata (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_CONNETTORE_PD_LABEL);
- }
-
- try{
- String log4j_tracciamento = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoLog4jTracciamento(alias));
- boolean enable = "true".equals(log4j_tracciamento);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOG4J_TRACCIAMENTO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_TRACCIAMENTO_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_TRACCIAMENTO_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato di log del file govway_tracciamento.log (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_TRACCIAMENTO_LABEL);
- }
-
- try{
- String log4j_dump = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoLog4jDump(alias));
- boolean enable = "true".equals(log4j_dump);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_NOTE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sullo stato di log del file govway_dump.log (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_LOG4J_DUMP_LABEL);
- }
-
- try{
- String fileTraceGovWayState = this.confCore.getInvoker().invokeJMXMethod(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetFileTrace(alias));
- FileTraceGovWayState stateFileTrace = FileTraceGovWayState.toConfig(fileTraceGovWayState,true);
- boolean fileTraceEnabled = stateFileTrace!=null && stateFileTrace.isEnabled();
- if(fileTraceEnabled) {
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_LABEL);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FILE_TRACE);
- if(fileTraceEnabled) {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_STATO_LABEL);
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_LABEL);
- }
- String v = fileTraceEnabled ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.TEXT);
- de.setValue(v);
- dati.add(de);
-
- if(fileTraceEnabled) {
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FILE_TRACE_CONFIG);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_CONFIGURAZIONE_LABEL);
- de.setType(DataElementType.TEXT);
- de.setValue(stateFileTrace.getPath());
- dati.add(de);
-
- String[] valori = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- String[] label = { ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_CONFIGURAZIONE_NOTE, stateFileTrace.getLastModified() };
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_FILE_TRACE_UPDATE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_LAST_UPDATE_LABEL);
- de.setType(DataElementType.SELECT);
- de.setValues(valori);
- de.setLabels(label);
- de.setSelected(CostantiConfigurazione.DISABILITATO.getValue());
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul FileTrace (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_FILE_TRACE_LABEL);
- }
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_TYPE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionSpecificErrorTypeInternalRequestError(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- String[] labels = { ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST_ABILITATO,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST_DISABILITATO };
- de.setLabels(labels);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_TYPE+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_REQUEST);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionSpecificErrorTypeBadResponse(alias));
- String value2 = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionSpecificErrorTypeInternalResponseError(alias));
- boolean enable = "true".equals(value) && "true".equals(value2);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- String[] labels = { ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE_ABILITATO,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE_DISABILITATO };
- de.setLabels(labels);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_TYPE+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_PROCESS_RESPONSE);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionSpecificErrorTypeInternalError(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- String[] labels = { ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR_ABILITATO,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR_DISABILITATO };
- de.setLabels(labels);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_TYPE+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_TYPE_INTERNAL_ERROR);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionErrorStatusCode(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS_CODE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS_CODE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS_CODE+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS_CODE);
- }
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionErrorUseStatusCodeAsFaultCode(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_USE_STATUS_CODE_AS_SOAP_FAULT);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_USE_STATUS_CODE_AS_SOAP_FAULT);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_STATUS+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_USE_STATUS_CODE_AS_SOAP_FAULT+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_USE_STATUS_CODE_AS_SOAP_FAULT);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_DETAILS);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionSpecificErrorDetails(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_DETAILS);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_DETAILS);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_DETAILS+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_DETAILS+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SPECIFIC_ERROR_DETAILS);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionErrorInstanceId(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE_ID);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE_ID);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE_ID+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_INSTANCE_ID);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- try{
- String value = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTransactionErrorGenerateHttpHeaderGovWayCode(alias));
- boolean enable = "true".equals(value);
-
- String[] tipoMsg = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP_CODE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP_CODE);
- String v = enable ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue();
- de.setType(DataElementType.SELECT);
- de.setValues(tipoMsg);
- de.setSelected(v);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }catch(Exception e){
- String tipo = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP+" ("+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP_CODE+")";
- this.logError("Errore durante la lettura delle informazioni (jmxResourcePdD) ["+tipo+"]: "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_TRANSACTION_ERROR_SOAP_GENERATE_HTTP_CODE);
- }
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_DATABASE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoDatabase = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniDatabase(alias));
- if(this.isErroreHttp(tmp, "informazioni sul database")){
- // e' un errore
- tmp = null;
- }
- infoDatabase = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul database (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoDatabase==null || infoDatabase.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoDatabase.length; i++) {
-
- try{
- String label = infoDatabase[i];
- String value = "";
- if(infoDatabase[i].contains(":")){
- label = infoDatabase[i].split(":")[0];
- value = infoDatabase[i].split(":")[1];
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_DATABASE+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul database (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
- HashMap<String, String> infoConnessioneAltriDB = null;
- HashMap<String, String> statoConnessioniAltriDB = null;
- try{
- int numeroDatasource = 0;
- try{
- String stato = this.confCore.getInvoker().readJMXAttribute(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaDatasourceGW(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoNumeroDatasourceGW(alias));
- if(stato!=null && !"".equals(stato)) {
- if(this.isErroreHttp(stato, "stato delle connessioni verso altri database")){
- // e' un errore
- throw new DriverControlStationException(stato);
- }
- numeroDatasource = Integer.valueOf(stato);
- }
- }catch(Exception e){
- ControlStationCore.logDebug("Numero di datasource attivi non ottenibili: "+e.getMessage());
- }
- if(numeroDatasource>0) {
- String nomiDatasource = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaDatasourceGW(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetDatasourcesGW(alias));
- if(nomiDatasource!=null && !"".equals(nomiDatasource)) {
- if(this.isErroreHttp(nomiDatasource, "stato delle connessioni verso altri database")){
- // e' un errore
- throw new DriverControlStationException(nomiDatasource);
- }
- /* Esempio:
- * 3 datasource allocati:
- (2020-01-23_15:40:22.391) idDatasource:88c4db87-07a5-4fa6-95a5-e6caf4c21a7f jndiName:org.govway.datasource.tracciamento ConnessioniAttive:0
- (2020-01-23_15:40:22.396) idDatasource:bae6582a-659b-4b70-bc9c-aca3570b45af jndiName:org.govway.datasource.statistiche ConnessioniAttive:0
- (2020-01-23_15:40:22.627) idDatasource:4ff843af-94d6-4506-8ecf-aac52bcb3525 jndiName:org.govway.datasource.console ConnessioniAttive:0
- **/
- String [] lines = nomiDatasource.split("\n");
- if(lines!=null && lines.length>0) {
- for (String line : lines) {
- if(line.startsWith("(")) {
- String [] tmp = line.split(" ");
- if(tmp!=null && tmp.length>3) {
- String nomeDS = tmp[2]+" "+tmp[1];
- try{
- // uuid
- //String paramIdentificazioneDataSource = tmp[1].split(":")[1];
- // jndi
- //String paramIdentificazioneDataSource = tmp[2].split(":")[1];
- int indexOf_paramIdentificazioneDataSource = tmp[2].indexOf(":");
- String paramIdentificazioneDataSource = tmp[2].substring(indexOf_paramIdentificazioneDataSource+1, tmp[2].length());
-
- String statoInfo = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaDatasourceGW(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetInformazioniDatabaseDatasourcesGW(alias),
- paramIdentificazioneDataSource);
- if(infoConnessioneAltriDB==null) {
- infoConnessioneAltriDB = new HashMap<>();
- }
- infoConnessioneAltriDB.put(nomeDS,statoInfo);
-
- if(!this.confCore.isClusterAsyncUpdate()) {
- String statoDB = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaDatasourceGW(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetUsedConnectionsDatasourcesGW(alias),
- paramIdentificazioneDataSource);
- if(this.isErroreHttp(statoDB, "stato delle connessioni verso database "+nomeDS)){
- // e' un errore
- throw new DriverControlStationException(statoDB);
- }
- if(statoConnessioniAltriDB==null) {
- statoConnessioniAltriDB = new HashMap<>();
- }
- statoConnessioniAltriDB.put(nomeDS,statoDB);
- }
-
- }catch(Exception e){
- ControlStationCore.logError("Errore durante la lettura delle informazioni verso il database "+nomeDS+" (jmxResourcePdD): "+e.getMessage(),e);
-
- if(infoConnessioneAltriDB==null) {
- infoConnessioneAltriDB = new HashMap<>();
- }
- infoConnessioneAltriDB.put(nomeDS,ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE);
-
- if(!this.confCore.isClusterAsyncUpdate()) {
- if(statoConnessioniAltriDB==null) {
- statoConnessioniAltriDB = new HashMap<>();
- }
- statoConnessioniAltriDB.put(nomeDS,ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE);
- }
- }
- }
- }
- }
- }
- }
- }
- }catch(Exception e){
- ControlStationCore.logError("Errore durante la lettura delle informazioni verso gli altri database (jmxResourcePdD): "+e.getMessage(),e);
-
- if(infoConnessioneAltriDB==null) {
- infoConnessioneAltriDB = new HashMap<>();
- }
- infoConnessioneAltriDB.put("GovWayDatasources",ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE);
-
- if(!this.confCore.isClusterAsyncUpdate()) {
- if(statoConnessioniAltriDB==null) {
- statoConnessioniAltriDB = new HashMap<>();
- }
- statoConnessioniAltriDB.put("GovWayDatasources",ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE);
- }
- }
-
- if(infoConnessioneAltriDB!=null && infoConnessioneAltriDB.size()>0) {
- Iterator<String> it = infoConnessioneAltriDB.keySet().iterator();
- int index = 0;
- while (it.hasNext()) {
- String idAltroDB = (String) it.next();
- String infoConnessioneAltroDB = infoConnessioneAltriDB.get(idAltroDB);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_DATABASE+" "+idAltroDB.split(" ")[0]);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoConnessioneDatabase = infoConnessioneAltroDB.split("\n");
-
- if(infoConnessioneDatabase==null || infoConnessioneDatabase.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoConnessioneDatabase.length; i++) {
-
- try{
- String label = infoConnessioneDatabase[i];
- String value = "";
- if(infoConnessioneDatabase[i].contains(":")){
- label = infoConnessioneDatabase[i].split(":")[0];
- value = infoConnessioneDatabase[i].split(":")[1];
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_DATABASE+"_db"+index+"_"+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul database (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
- index++;
- }
- }
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_SSL);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoSSL = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniSSL(alias));
- if(this.isErroreHttp(tmp, "informazioni SSL")){
- // e' un errore
- tmp = null;
- }
- infoSSL = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni SSL (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoSSL==null || infoSSL.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoSSL.length; i++) {
-
- try{
- String label = infoSSL[i];
- String value = "";
- if(infoSSL[i].contains(":")){
- label = infoSSL[i].split(":")[0];
- value = infoSSL[i].split(":")[1];
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_SSL+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni SSL (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
-
-
- if(this.core.isJmxPdD_configurazioneSistemaShowInformazioniCryptographyKeyLength()){
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_CRYPTOGRAPHY_KEY_LENGTH);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoCryptoKeyLength = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniCryptographyKeyLength(alias));
- if(this.isErroreHttp(tmp, "informazioni CryptographyKeyLength")){
- // e' un errore
- tmp = null;
- }
- infoCryptoKeyLength = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sulla lunghezza delle chiavi di cifratura (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoCryptoKeyLength==null || infoCryptoKeyLength.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoCryptoKeyLength.length; i++) {
-
- try{
- String label = infoCryptoKeyLength[i];
- String value = "";
- if(infoCryptoKeyLength[i].contains(":")){
- label = infoCryptoKeyLength[i].split(":")[0];
- value = infoCryptoKeyLength[i].split(":")[1];
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_CRYPTOGRAPHY_KEY_LENGTH+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sulla lunghezza delle chiavi di cifratura (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_CHARSET);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoCharset = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniCharset(alias));
- if(this.isErroreHttp(tmp, "informazioni Charset")){
- // e' un errore
- tmp = null;
- }
- infoCharset = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sull'internazionalizzazione (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoCharset==null || infoCharset.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoCharset.length; i++) {
-
- try{
- String label = infoCharset[i];
- String value = "";
- if(infoCharset[i].contains(":")){
- label = infoCharset[i].split(":")[0];
- value = infoCharset[i].substring(infoCharset[i].indexOf(":")+1);
- }
-
- de = newDataElementStyleRuntime();
- if(value==null || "".equals(value)){
- value = label;
- label = "Name";
- }
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_CHARSET+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul charset (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_INTERNAZIONALIZZAZIONE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoInternazionalizzazione = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniInternazionalizzazione(alias));
- if(this.isErroreHttp(tmp, "informazioni Internazionalizzazione")){
- // e' un errore
- tmp = null;
- }
- infoInternazionalizzazione = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sull'internazionalizzazione (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoInternazionalizzazione==null || infoInternazionalizzazione.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoInternazionalizzazione.length; i++) {
-
- try{
- String label = infoInternazionalizzazione[i];
- String value = "";
- if(infoInternazionalizzazione[i].contains(":")){
- label = infoInternazionalizzazione[i].split(":")[0];
- value = infoInternazionalizzazione[i].substring(infoInternazionalizzazione[i].indexOf(":")+1);
- }
-
- de = newDataElementStyleRuntime();
- if(value==null || "".equals(value)){
- value = label;
- label = "Name";
- }
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_INTERNAZIONALIZZAZIONE+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sull'internazionalizzazione (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
-
-
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_TIMEZONE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoTimezone = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniTimeZone(alias));
- if(this.isErroreHttp(tmp, "informazioni Internazionalizzazione")){
- // e' un errore
- tmp = null;
- }
- infoTimezone = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul TimeZone (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoTimezone==null || infoTimezone.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoTimezone.length; i++) {
-
- try{
- String label = infoTimezone[i];
- String value = "";
- if(infoTimezone[i].contains(":")){
- label = infoTimezone[i].split(":")[0];
- value = infoTimezone[i].substring(infoTimezone[i].indexOf(":")+1);
- }
-
- de = newDataElementStyleRuntime();
- if(value==null || "".equals(value)){
- value = label;
- label = "Name";
- }
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_TIMEZONE+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul TimeZone (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_JAVA_NET);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoJavaNet = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoInformazioniProprietaJavaNetworking(alias));
- if(this.isErroreHttp(tmp, "informazioni Java Networking")){
- // e' un errore
- tmp = null;
- }
- infoJavaNet = tmp!=null ? tmp.split("\n") : null;
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni di Java Networking (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoJavaNet==null || infoJavaNet.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- for (int i = 0; i < infoJavaNet.length; i++) {
-
- try{
- if(infoJavaNet[i]==null || "".equals(infoJavaNet[i].trim())) {
- continue;
- }
-
- String label = infoJavaNet[i];
- String value = "";
- if(infoJavaNet[i].contains("=")){
- label = infoJavaNet[i].split("=")[0];
- value = infoJavaNet[i].substring(infoJavaNet[i].indexOf("=")+1);
- }
-
- de = newDataElementStyleRuntime();
- if(value==null || "".equals(value)){
- if(label.startsWith("SecurityManager ")) {
- String tmp = label;
- label = "SecurityManager";
- value = tmp.substring("SecurityManager ".length());
- }
- else {
- value = label;
- label = "Name";
- }
- }
- de.setLabel(label);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_JAVA_NET+i);
- de.setSize(this.getSize());
- dati.add(de);
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni di Java Networking (jmxResourcePdD): "+e.getMessage(),e);
- }
- }
- }
-
-
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String [] infoProtocolli = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsa(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoPluginProtocols(alias));
- infoProtocolli = tmp.split("\n");
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sui protocolli (jmxResourcePdD): "+e.getMessage(),e);
- }
- if(infoProtocolli==null || infoProtocolli.length<=0){
- addInformazioneNonDisponibile(dati, "");
- }
- else{
- boolean addProtocollo = false;
- Map<String, String> map = new HashMap<>();
- for (int i = 0; i < infoProtocolli.length; i++) {
-
- try{
- String context = infoProtocolli[i].split(" ")[0];
- String protocol = infoProtocolli[i].split(" ")[1];
- protocol = protocol.split(":")[1];
- protocol = protocol.substring(0, protocol.length()-1);
- if(map.containsKey(protocol)){
- String c = map.remove(protocol);
- map.put(protocol, (c+", "+context));
- }
- else{
- map.put(protocol, context);
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sui protocolli (jmxResourcePdD): "+e.getMessage(),e);
- }
-
- }
- int index = 0;
- for (String protocollo : map.keySet()) {
-
- addProtocollo = true;
-
- de = newDataElementStyleRuntime();
- de.setLabel(protocollo);
- String value = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO_CONTESTO+map.get(protocollo);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO+index);
- de.setSize(this.getSize());
- dati.add(de);
-
- // de = newDataElementStyleLong();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO);
- // de.setValue(protocollo);
- // de.setType(DataElementType.TEXT);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO+index);
- // de.setSize(this.getSize());
- // dati.add(de);
- //
- // de = newDataElementStyleLong();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO_CONTESTO);
- // de.setValue(map.get(protocollo));
- // de.setType(DataElementType.TEXT);
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_INFO_PROTOCOLLO_CONTESTO+index);
- // de.setSize(this.getSize());
- // dati.add(de);
-
- index++;
- }
-
- if(!addProtocollo){
- addInformazioneNonDisponibile(dati, "");
- }
- }
-
- caches = this.confCore.getJmxPdDCaches(alias);
- if(caches!=null && !caches.isEmpty()){
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CACHE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- for (String cache : caches) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(cache);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- String stato = null;
- try{
- stato = this.confCore.getInvoker().readJMXAttribute(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- cache,
- this.confCore.getJmxPdDCacheNomeAttributoCacheAbilitata(alias));
- if(stato.equalsIgnoreCase("true")){
- stato = "abilitata";
- }
- else if(stato.equalsIgnoreCase("false")){
- stato = "disabilitata";
- }
- else{
- throw new DriverControlStationException("Stato ["+stato+"] sconosciuto");
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato della cache ["+cache+"](jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- if("abilitata".equals(stato)){
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+cache+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+this.confCore.getJmxPdDCacheNomeMetodoResetCache(alias));
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_RESET_SINGOLA);
- de.setSize(this.getSize());
- dati.add(de);
-
- if(this.confCore.getJmxPdDCachesPrefill(alias).contains(cache)){
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_PREFILL);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+cache+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+this.confCore.getJmxPdDCacheNomeMetodoPrefillCache(alias));
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_PREFILL);
- de.setValue(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_PREFILL);
- de.setSize(this.getSize());
- dati.add(de);
- }
-
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_STATO);
- de.setValue(stato);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_STATO);
- de.setSize(this.getSize());
- dati.add(de);
-
- if("abilitata".equals(stato)){
-
- String [] params = null;
- try{
- String tmp = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDCacheType(alias),
- cache,
- this.confCore.getJmxPdDCacheNomeMetodoStatoCache(alias));
- params = tmp.split("\n");
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato della cache ["+cache+"](jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- if(params!=null && params.length>0){
-
- List<String> listDe = null;
- Map<String, List<DataElement>> mapDe = null;
- if(CostantiPdD.JMX_GESTORE_RICHIESTE.equals(cache)) {
- listDe = new ArrayList<>();
- mapDe = new HashMap<String, List<DataElement>>();
- }
- String internalCache = null;
-
- for (int i = 0; i < params.length; i++) {
-
- try{
- String label = params[i];
- String labelCorretta = label;
- String value = "";
- if(params[i].contains(":")){
- label = params[i].split(":")[0];
- labelCorretta = label;
- value = params[i].split(":")[1];
-
- if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_ELEMENTI_IN_CACHE.equals(label)) {
- labelCorretta = ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_ELEMENTI_IN_CACHE_LABEL;
- }
- else if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_MEMORIA_OCCUPATA.equals(label)) {
- labelCorretta = ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_MEMORIA_OCCUPATA_LABEL;
- }
- else if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_IDLE_TIME.equals(label)) {
- labelCorretta = ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_IDLE_TIME_LABEL;
- }
- else if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_LIFE_TIME.equals(label)) {
- labelCorretta = ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_LIFE_TIME_LABEL;
- }
-
- }
-
- if(CostantiPdD.JMX_GESTORE_RICHIESTE.equals(cache)) {
- if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_NOME.equals(label)) {
- internalCache = value;
- if(value.startsWith(GestoreRichieste.GESTORE_RICHIESTE_PREFIX_CACHE_NAME)) {
- internalCache = value.substring(GestoreRichieste.GESTORE_RICHIESTE_PREFIX_CACHE_NAME.length());
- }
- listDe.add(internalCache);
- continue;
- }
- else if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_ELEMENTI_IN_CACHE.equals(label)
- ||
- ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI_MEMORIA_OCCUPATA.equals(label)) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(labelCorretta);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_STATO+"_"+i);
- de.setSize(this.getSize());
-
- List<DataElement> l = mapDe.get(internalCache);
- if(l==null) {
- l = new ArrayList<DataElement>();
- mapDe.put(internalCache, l);
- }
-
- l.add(de);
-
- continue;
- }
- }
-
- if(ConfigurazioneCostanti.CONFIGURAZIONE_SISTEMA_CACHE_STATO_ELEMENTI_VISUALIZZATI.contains(label) &&
- (listDe==null || listDe.size()<=1)
- ){
-
- de = newDataElementStyleRuntime();
- de.setLabel(labelCorretta);
- if(value!=null){
- value = StringEscapeUtils.escapeHtml(value);
- }
- de.setValue(value);
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_STATO+"_"+i);
- de.setSize(this.getSize());
- dati.add(de);
-
- }
-
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato della cache ["+cache+"]: "+e.getMessage(),e);
- }
- }
-
- if(listDe!=null && !listDe.isEmpty()) {
- int i = 0;
- for (String internalCacheName : listDe) {
-
- de = newDataElementStyleRuntime();
- de.setLabel("");
- de.setValue("<i>"+internalCacheName+"</i>");
- de.setType(DataElementType.TEXT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CACHE_STATO+"_int_"+i);
- de.setSize(this.getSize());
- dati.add(de);
-
- i++;
-
- List<DataElement> lDe = mapDe.get(internalCacheName);
- if(lDe!=null && !lDe.isEmpty()) {
- for (DataElement dea : lDe) {
- dati.add(dea);
- }
- }
- }
- }
- }
- }
- }
-
- }
-
-
- String stato = null;
-
-
- if(!this.confCore.isClusterAsyncUpdate()) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONI);
- de.setType(DataElementType.TITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONE_DATABASE);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoConnessioniDB(alias));
- if(this.isErroreHttp(stato, "stato delle connessioni al database")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato delle connessioni al database (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_DB);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
-
- // statoConnessioniAltriDB, letto prima durante l'acquisizione delle informazion
- if(statoConnessioniAltriDB!=null && statoConnessioniAltriDB.size()>0) {
- Iterator<String> it = statoConnessioniAltriDB.keySet().iterator();
- int index = 0;
- while (it.hasNext()) {
- String idAltroDB = it.next();
- String statoConnessioniAltroDB = statoConnessioniAltriDB.get(idAltroDB);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONE_DATABASE+" "+idAltroDB.split(" ")[0]);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_STATO);
- if(statoConnessioniAltroDB!=null){
- statoConnessioniAltroDB = StringEscapeUtils.escapeHtml(statoConnessioniAltroDB);
- }
- de.setValue(statoConnessioniAltroDB);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_DB+"_ds"+index++);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
- }
- }
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONE_JMS);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoConnessioniJMS(alias));
- if(this.isErroreHttp(stato, "stato delle connessioni JMS")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato delle connessioni JMS (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_JMS);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
- }
-
-
-
- if(!this.confCore.isClusterAsyncUpdate()) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TRANSAZIONI);
- de.setType(DataElementType.TITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_ID);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoIdTransazioniAttive(alias));
- if(this.isErroreHttp(stato, "identificativi delle transazioni attive")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura degli identificativi delle transazioni attive (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_ID);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_ID_PROTOCOLLO);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoIdProtocolloTransazioniAttive(alias));
- if(this.isErroreHttp(stato, "identificativi di protocollo delle transazioni attive")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura degli identificativi di protocollo delle transazioni attive (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_TRANSAZIONI_ID_PROTOCOLLO);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
- }
-
-
-
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONI_HTTP);
- de.setType(DataElementType.TITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreMessaggiVerificaConnessioniAttive(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_VERIFICA_CONNESSIONI_ATTIVE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_VERIFICA_CONNESSIONI_ATTIVE);
-
- if(!this.confCore.isClusterAsyncUpdate()) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONE_PD);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoConnessioniPD(alias));
- if(this.isErroreHttp(stato, "stato delle connessioni http verso le PD")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato delle connessioni http verso le PD (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_PD);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_CONNESSIONE_PA);
- de.setType(DataElementType.SUBTITLE);
- de.abilitaRefresh();
- dati.add(de);
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaMonitoraggio(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoConnessioniPA(alias));
- if(this.isErroreHttp(stato, "stato delle connessioni http verso le PA")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato delle connessioni http verso le PA (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONNESSIONI_PA);
- de.setSize(this.getSize());
- de.setRows(6);
- de.setCols(80);
- dati.add(de);
-
- }
-
-
-
-
-
-
-
-
- List<String> code = this.confCore.getConsegnaNotificaCode();
-
- if(code.size()<=1) {
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_THREADS);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_NOTIFICHE);
- if(code.size()<=1) {
- de.setType(DataElementType.SUBTITLE);
- }
- else {
- de.setType(DataElementType.TITLE);
- }
- de.abilitaRefresh();
- dati.add(de);
-
- boolean timerAttivo = addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerConsegnaContenutiApplicativi(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_CONSEGNA_CONTENUTI_APPLICATIVI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_CONSEGNA_CONTENUTI_APPLICATIVI);
-
- if(timerAttivo) {
- for (String coda : code) {
-
- String labelCoda = this.confCore.getConsegnaNotificaCodaLabel(coda);
-
- if(code.size()>1) {
- de = newDataElementStyleRuntime();
- de.setLabel(labelCoda);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- stato = null;
- try{
- stato = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConsegnaContenutiApplicativi(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetThreadPoolStatus(alias),
- coda);
- if(this.isErroreHttp(stato, "stato del thread pool per la consegna agli applicativi")){
- // e' un errore
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dello stato del thread pool per la consegna agli applicativi (jmxResourcePdD): "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_THREAD_POOL_STATO);
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_THREADS_CONSEGNA_APPLICATIVI);
- de.setSize(this.getSize());
- de.setRows(2);
- de.setCols(80);
- dati.add(de);
-
- String configurazioneCoda = null;
- try{
- configurazioneCoda = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConsegnaContenutiApplicativi(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetQueueConfig(alias),
- coda);
- if(this.isErroreHttp(configurazioneCoda, "Configurazione del thread pool '"+labelCoda+"' per la consegna agli applicativi")){
- // e' un errore
- configurazioneCoda = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura della configurazione del thread pool '"+labelCoda+"' per la consegna agli applicativi (jmxResourcePdD): "+e.getMessage(),e);
- configurazioneCoda = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_POOL_CONFIG);
- if(configurazioneCoda!=null){
- configurazioneCoda = StringEscapeUtils.escapeHtml(configurazioneCoda);
- }
- de.setValue(configurazioneCoda);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_THREADS_CONSEGNA_APPLICATIVI_CONFIG);
- de.setSize(this.getSize());
- de.setRows(2);
- de.setCols(80);
- dati.add(de);
-
- String connettoriPrioritari = null;
- try{
- connettoriPrioritari = this.confCore.getInvoker().invokeJMXMethod(alias,this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConsegnaContenutiApplicativi(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoGetConnettoriPrioritari(alias),
- coda);
- if(this.isErroreHttp(connettoriPrioritari, "Connettori prioritari del thread pool '"+labelCoda+"' per la consegna agli applicativi")){
- // e' un errore
- connettoriPrioritari = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
- }catch(Exception e){
- this.logError("Errore durante la lettura dei connettori prioritari del thread pool '"+labelCoda+"' per la consegna agli applicativi (jmxResourcePdD): "+e.getMessage(),e);
- connettoriPrioritari = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_POOL_CONNNETTORI_PRIORITARI);
- if(connettoriPrioritari!=null){
- connettoriPrioritari = StringEscapeUtils.escapeHtml(connettoriPrioritari);
- }
- de.setValue(connettoriPrioritari);
- de.setLabelAffiancata(false);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_THREADS_CONSEGNA_APPLICATIVI_CONNNETTORI_PRIORITARI);
- if("".equals(connettoriPrioritari)) {
- de.setType(DataElementType.TEXT);
- de.setValue("Nessun Connettore");
- }
- else {
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setSize(this.getSize());
- de.setRows(2);
- de.setCols(80);
- }
- dati.add(de);
-
- if(!"".equals(connettoriPrioritari)) {
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_THREAD_POOL_ELIMINA_CONNETTORI_PRIORITARI);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_CACHE+"="+coda+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NOME_METODO+"="+this.confCore.getJmxPdDConfigurazioneSistemaNomeMetodoResetConnettoriPrioritari(alias));
- de.setType(DataElementType.LINK);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_THREAD_POOL_ELIMINA_CONNETTORI_PRIORITARI);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_THREAD_POOL_ELIMINA_CONNETTORI_PRIORITARI);
- de.setSize(this.getSize());
- dati.add(de);
- }
- }
- }
-
-
- if(code.size()>1) {
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_THREADS);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TIMERS_STATISTICHE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerStatisticheOrarie(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_ORARIE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_ORARIE);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerStatisticheGiornaliere(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_GIORNALIERE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_GIORNALIERE);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerStatisticheSettimanali(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_SETTIMANALI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_SETTIMANALI);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerStatisticheMensili(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_MENSILI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_STATISTICHE_MENSILI);
-
- if(ProtocolFactoryManager.getInstance().existsProtocolFactory(CostantiLabel.MODIPA_PROTOCOL_NAME)) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TIMERS_PDND);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreChiaviPDND(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_CHIAVI_PDND,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_CHIAVI_PDND);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreCacheChiaviPDND(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_CACHE_CHIAVI_PDND,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_CACHE_CHIAVI_PDND);
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TIMERS_RUNTIME);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreMessaggiPuliziaMessaggiEliminati(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_ELIMINATI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_ELIMINATI);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreMessaggiPuliziaMessaggiScaduti(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_SCADUTI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_SCADUTI);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreRepositoryBuste(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_REPOSITORY_BUSTE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_REPOSITORY_BUSTE);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreMessaggiPuliziaCorrelazioneApplicativa(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_CORRELAZIONE_APPLICATIVA,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_CORRELAZIONE_APPLICATIVA);
-
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreMessaggiPuliziaMessaggiNonGestiti(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_NON_GESTITI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_MESSAGGI_PULIZIA_MESSAGGI_NON_GESTITI);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestorePuliziaMessaggiAnomali(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_PULIZIA_MESSAGGI_ANOMALI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_PULIZIA_MESSAGGI_ANOMALI);
-
- if(this.confCore.isClusterAsyncUpdate()) {
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreOperazioniRemote(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_OPERAZIONI_REMOTE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_OPERAZIONI_REMOTE,
- true);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerSvecchiamentoOperazioniRemote(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_SVECCHIAMENTO_OPERAZIONI_REMOTE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_SVECCHIAMENTO_OPERAZIONI_REMOTE);
-
- }
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TIMERS_MONITORAGGIO);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerMonitoraggioRisorseThread(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_MONITORAGGIO_RISORSE_THREAD,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_MONITORAGGIO_RISORSE_THREAD);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerThresholdThread(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_THRESHOLD_THREAD,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_THRESHOLD_THREAD);
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_SISTEMA_TIMERS_SISTEMA);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerEventi(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_EVENTI,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_EVENTI);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerFileSystemRecovery(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_FILE_SYSTEM_RECOVERY,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_FILE_SYSTEM_RECOVERY);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreBusteOnewayNonRiscontrate(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_BUSTE_ONEWAY_NON_RISCONTRATE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_BUSTE_ONEWAY_NON_RISCONTRATE);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerGestoreBusteAsincroneNonRiscontrate(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_BUSTE_ASINCRONE_NON_RISCONTRATE,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_GESTORE_BUSTE_ASINCRONE_NON_RISCONTRATE);
-
- addTimerState(dati, alias, this.confCore.getJmxPdDConfigurazioneSistemaNomeAttributoTimerRepositoryStatefulThread(alias),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_REPOSITORY_STATEFUL_THREAD,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_SISTEMA_REPOSITORY_STATEFUL_THREAD);
- if(this.confCore.isConfigurazioneAllarmiEnabled()) {
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- AlarmEngineConfig alarmEngineConfig = this.confCore.getAllarmiConfig();
- stato = null;
- try{
- stato = AllarmiUtils.getActiveThreadImages(this.log, alarmEngineConfig);
- }catch(Exception e){
- this.logError("Riscontrato errore durante la lettura dello stato degli allarmi attivi: "+e.getMessage(),e);
- stato = ConfigurazioneCostanti.LABEL_INFORMAZIONE_NON_DISPONIBILE;
- }
-
-
- if(stato !=null && !"".equals(stato)) {
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_STOP);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_STOP);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_STOP);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_MANAGER+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_STOP);
- de.setType(DataElementType.LINK);
- dati.add(de);
-
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_RESTART);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_RESTART);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_RESTART);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_MANAGER+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_RESTART);
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
- else {
-
- boolean existsAllarmi = this.confCore.existsAllarmi(TipoAllarme.ATTIVO);
- if(existsAllarmi) {
- de = newDataElementStyleRuntime();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_START);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_START);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_START);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_SISTEMA_ADD+"?"+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_NODO_CLUSTER+"="+alias+
- "&"+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_MANAGER+"="+ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI_START);
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- }
-
-
- de = newDataElementStyleRuntime();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_ATTIVI_STATO);
- if("".equals(stato)) {
- stato = "Nessun allarme attivo";
- }
- if(stato!=null){
- stato = StringEscapeUtils.escapeHtml(stato);
- }
- de.setValue(stato);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_SISTEMA_ALLARMI_ATTIVI);
- de.setSize(this.getSize());
- de.setRows(5);
- de.setCols(80);
- dati.add(de);
-
- }
-
- return dati;
- }
- private boolean addTimerState(List<DataElement> dati, String alias, String nomeAttributo, String nomeParametro, String labelParametro) {
- return addTimerState(dati, alias, nomeAttributo, nomeParametro, labelParametro, false);
- }
- private boolean addTimerState(List<DataElement> dati, String alias, String nomeAttributo, String nomeParametro, String labelParametro, boolean forceText) {
- try{
- String stato = this.confCore.getInvoker().readJMXAttribute(alias, this.confCore.getJmxPdDConfigurazioneSistemaType(alias),
- this.confCore.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(alias),
- nomeAttributo);
-
- TimerState timerState = TimerState.valueOf(stato);
-
- DataElement de = newDataElementStyleRuntime();
- de.setName(nomeParametro);
- de.setLabel(labelParametro);
- if(TimerState.OFF.equals(timerState)) {
- de.setType(DataElementType.TEXT);
- de.setValue(TimerState.OFF.name());
- }
- else if(forceText) {
- de.setType(DataElementType.TEXT);
- switch (timerState) {
- case ENABLED:
- de.setValue(CostantiConfigurazione.ABILITATO.getValue());
- break;
- case DISABLED:
- de.setValue(CostantiConfigurazione.DISABILITATO.getValue());
- break;
- default:
- de.setValue(TimerState.OFF.name());
- break;
- }
- }
- else {
- String[] labels = { CostantiConfigurazione.ABILITATO.getValue(), CostantiConfigurazione.DISABILITATO.getValue() };
- String[] values = { TimerState.ENABLED.name(), TimerState.DISABLED.name() };
- de.setType(DataElementType.SELECT);
- de.setValues(values);
- de.setLabels(labels);
- de.setSelected(stato);
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
- return !TimerState.OFF.equals(timerState);
-
- }catch(Exception e){
- this.logError("Errore durante la lettura delle informazioni sul '"+nomeAttributo+"' (jmxResourcePdD): "+e.getMessage(),e);
- addInformazioneNonDisponibile(dati, labelParametro);
- return false;
- }
- }
-
- public boolean isErroreHttp(String stato, String risorsa){
- if(stato!=null && stato.startsWith("[httpCode ")){
- this.logError("Errore durante la lettura della risorsa ["+risorsa+"]: "+stato);
- return true;
- }
- return false;
- }
-
-
- public boolean checkConfigurazioneTracciamento(TipoOperazione tipoOperazione, String configurazioneEsiti, String tipoConfigurazione) throws DriverControlStationException {
- if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO.equals(tipoConfigurazione)) {
- String registrazioneTracce = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
- if (!registrazioneTracce.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !registrazioneTracce.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Buste dev'essere abilitato o disabilitato");
- return false;
- }
- }
- else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PD.equals(tipoConfigurazione)
- ||
- ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_TRACCIAMENTO_PA.equals(tipoConfigurazione)) {
- // nop
- }
- else if(ConfigurazioneCostanti.VALORE_PARAMETRO_CONFIGURAZIONE_TIPO_OPERAZIONE_REGISTRAZIONE_MESSAGGI.equals(tipoConfigurazione)) {
- String dumpApplicativo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_APPLICATIVO);
- String dumpPD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
- String dumpPA = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
- if (!dumpApplicativo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !dumpApplicativo.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Dump Applicativo dev'essere abilitato o disabilitato");
- return false;
- }
- if (!dumpPD.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !dumpPD.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Dump Binario Porta Delegata dev'essere abilitato o disabilitato");
- return false;
- }
- if (!dumpPA.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO) &&
- !dumpPA.equals(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO)) {
- this.pd.setMessage("Dump Binario Porta Applicativa dev'essere abilitato o disabilitato");
- return false;
- }
-
- }
- return true;
- }
-
- public void addConfigurazionControlloTrafficoToDati(List<DataElement> dati, TipoOperazione tipoOperazione, org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico, long sizePolicy, long sizeGlobalPolicy, boolean configurazioneTerminata) throws Exception {
-
-
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_FIRST_TIME);
-
- // Limitazione
-
- this.addToDatiConfigurazioneControlloTraffico(dati, tipoOperazione, configurazioneControlloTraffico.getControlloTraffico());
-
-
- // Rate Limiting
-
- this.addToDatiConfigurazioneRateLimiting(dati, tipoOperazione, configurazioneControlloTraffico, first, configurazioneTerminata,sizePolicy,sizeGlobalPolicy);
-
-
- // Tempi di Risposta
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- this.addToDatiTempiRispostaFruizione(dati, tipoOperazione, true, configurazioneControlloTraffico.getTempiRispostaFruizione());
-
- this.addToDatiTempiRispostaErogazione(dati, tipoOperazione, true, configurazioneControlloTraffico.getTempiRispostaErogazione());
-
- // Cache
- this.addToDatiConfigurazioneCache(dati, tipoOperazione, configurazioneControlloTraffico.getCache(), this.isModalitaAvanzata());
-
- // Set First Time == false
- this.addToDatiFirstTimeDisabled(dati,ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_FIRST_TIME);
-
- }
-
- public void addToDatiConfigurazioneControlloTraffico(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazioneControlloTraffico controlloTraffico) throws Exception {
-
- // **** Limitazione Numero di Richieste Complessive Gestite dalla PdD ****
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LIMITAZIONE_NUMERO_RICHIESTE_COMPLESSIVE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // stato
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_STATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_STATO);
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.STATI_CON_WARNING);
- if(controlloTraffico!=null && controlloTraffico.isControlloMaxThreadsEnabled()) {
- if(controlloTraffico.isControlloMaxThreadsWarningOnly()) {
- de.setSelected(CostantiConfigurazione.STATO_CON_WARNING_WARNING_ONLY.getValue());
- }
- else {
- de.setSelected(CostantiConfigurazione.STATO_CON_WARNING_ABILITATO.getValue());
- }
- }
- else {
- de.setSelected(CostantiConfigurazione.STATO_CON_WARNING_DISABILITATO.getValue());
- }
- de.setPostBack(true);
- dati.add(de);
-
-
- // soglia
- Long numeroThreadComplessivi = null;
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA);
- if(controlloTraffico!=null && controlloTraffico.isControlloMaxThreadsEnabled()) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- if(controlloTraffico!=null &&
- controlloTraffico.getControlloMaxThreadsSoglia()!=null){
- numeroThreadComplessivi = controlloTraffico.getControlloMaxThreadsSoglia();
- de.setValue(numeroThreadComplessivi+"");
- }
- dati.add(de);
-
-
- // messaggio di errore
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE_DESCRIZIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE_DESCRIZIONE);
- if(!this.isModalitaStandard() && controlloTraffico.isControlloMaxThreadsEnabled() && (controlloTraffico.isControlloMaxThreadsWarningOnly() == false)) {
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(controlloTraffico.isControlloMaxThreadsTipoErroreIncludiDescrizione());
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(controlloTraffico.isControlloMaxThreadsTipoErroreIncludiDescrizione()+"");
- }
- dati.add(de);
-
- // tipo errore
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE);
- if(controlloTraffico.isControlloMaxThreadsEnabled() && (controlloTraffico.isControlloMaxThreadsWarningOnly() == false)) {
- if(this.isModalitaStandard()) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.TIPI_ERRORE);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_ERRORE);
- if(controlloTraffico.getControlloMaxThreadsTipoErrore()!=null) {
- TipoErrore tipoErroEnum = TipoErrore.toEnumConstant(controlloTraffico.getControlloMaxThreadsTipoErrore());
- if(tipoErroEnum!=null) {
- de.setSelected(tipoErroEnum.getValue());
- }
- }
- }
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- if(controlloTraffico.getControlloMaxThreadsTipoErrore()!=null) {
- TipoErrore tipoErroEnum = TipoErrore.toEnumConstant(controlloTraffico.getControlloMaxThreadsTipoErrore());
- if(tipoErroEnum!=null) {
- de.setValue(tipoErroEnum.getValue());
- }
- }
- dati.add(de);
-
- if(controlloTraffico.isControlloMaxThreadsEnabled()) {
-
- // Link visualizza stato
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RUNTIME);
- de.setType(DataElementType.LINK);
- dati.add(de);
-
- }
-
-
-
- // *** Controllo del Traffico ***
-
- if(controlloTraffico.isControlloMaxThreadsEnabled()) {
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_STATO_CONTROLLO_CONGESTIONE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
-
- // stato
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_STATO_CONTROLLO_CONGESTIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_STATO_CONTROLLO_CONGESTIONE);
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.STATI);
- de.setSelected(controlloTraffico.isControlloCongestioneEnabled() ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
- de.setPostBack(true);
- dati.add(de);
-
-
- // threshold
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_THRESHOLD_CONTROLLO_CONGESTIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_THRESHOLD_CONTROLLO_CONGESTIONE);
- if(controlloTraffico.isControlloCongestioneEnabled()){
- de.setType(DataElementType.SELECT);
- String [] v = new String[100];
- for (int i = 0; i < 100; i++) {
- v[i] = (i+1)+"";
- }
- de.setValues(v);
- if(controlloTraffico.getControlloCongestioneThreshold()!=null){
- de.setSelected(controlloTraffico.getControlloCongestioneThreshold()+"");
- }
- de.setPostBack(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(controlloTraffico.getControlloCongestioneThreshold()!=null){
- de.setValue(controlloTraffico.getControlloCongestioneThreshold()+"");
- }
- dati.add(de);
-
- Integer soglia = controlloTraffico.getControlloCongestioneThreshold();
- Long numeroThreadCongestionamento = null;
- if(numeroThreadComplessivi!=null && soglia!=null){
- double numD = numeroThreadComplessivi.doubleValue();
- double totale = 100d;
- double sogliaD = soglia.doubleValue();
- Double numeroThreadCongestionamentoD = (numD / totale) * sogliaD;
- numeroThreadCongestionamento = numeroThreadCongestionamentoD.longValue();
- }
- if(numeroThreadCongestionamento!=null && controlloTraffico.isControlloCongestioneEnabled()){
- de = new DataElement();
- de.setType(DataElementType.NOTE);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_CONGESTIONE_THRESHOLD_DESCRIZIONE.
- replace(ConfigurazioneCostanti.CONFIGURAZIONE_CONTROLLO_CONGESTIONE_THRESHOLD_DESCRIZIONE_TEMPLATE, numeroThreadCongestionamento+""));
- dati.add(de);
- }
-
- }
- }
-
- public void addToDatiConfigurazioneRateLimiting(List<DataElement> dati, TipoOperazione tipoOperazione, org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale controlloTraffico, boolean first, boolean finished, long sizePolicy, long sizeGlobalPolicy) throws Exception {
-
- // Policy
- // if( first || finished ){
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // messaggio di errore
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_TIPOLOGIA_ERRORE_DESCRIZIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_TIPOLOGIA_ERRORE_DESCRIZIONE);
- if(this.isModalitaStandard()) {
- de.setType(DataElementType.HIDDEN);
- de.setValue(controlloTraffico.getRateLimiting().isTipoErroreIncludiDescrizione()+"");
- }
- else {
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(controlloTraffico.getRateLimiting().isTipoErroreIncludiDescrizione());
- }
- dati.add(de);
-
- // tipo errore
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_TIPOLOGIA_ERRORE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_TIPOLOGIA_ERRORE);
- TipoErrore tipoErroEnum = null;
- if(controlloTraffico.getRateLimiting().getTipoErrore()!=null) {
- tipoErroEnum = TipoErrore.toEnumConstant(controlloTraffico.getRateLimiting().getTipoErrore());
- }
- if(this.isModalitaStandard()) {
- de.setType(DataElementType.HIDDEN);
- if(tipoErroEnum!=null) {
- de.setValue(tipoErroEnum.getValue());
- }
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.TIPI_ERRORE);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_ERRORE);
- if(tipoErroEnum!=null) {
- de.setSelected(tipoErroEnum.getValue());
- }
- }
- dati.add(de);
-
- List<Proprieta> listProprieta = new ArrayList<Proprieta>();
- if(controlloTraffico.getRateLimiting().sizeProprietaList()>0) {
- for (ConfigurazioneRateLimitingProprieta rtProp : controlloTraffico.getRateLimiting().getProprietaList()) {
- Proprieta p = new Proprieta();
- p.setNome(rtProp.getNome());
- p.setValore(rtProp.getValore());
- listProprieta.add(p);
- }
- }
- PolicyConfiguration policyConfig = new PolicyConfiguration(listProprieta, this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(), false);
- String ctModalitaSincronizzazione = policyConfig.getSyncMode();
- String ctImplementazione = policyConfig.getImpl();
- String ctContatori = policyConfig.getCount();
- String ctTipologia = policyConfig.getEngineType();
- String ctHeaderHttp = policyConfig.getHttpMode();
- String ctHeaderHttp_limit = policyConfig.getHttpMode_limit();
- String ctHeaderHttp_remaining = policyConfig.getHttpMode_remaining();
- String ctHeaderHttp_reset = policyConfig.getHttpMode_reset();
- String ctHeaderHttp_retryAfter = policyConfig.getHttpMode_retry_after();
- String ctHeaderHttp_retryAfterBackoff = policyConfig.getHttpMode_retry_after_backoff();
- this.addOpzioniAvanzateRateLimitingToDati(dati,
- false,
- false,
- ctModalitaSincronizzazione, ctImplementazione, ctContatori, ctTipologia,
- ctHeaderHttp, ctHeaderHttp_limit, ctHeaderHttp_remaining, ctHeaderHttp_reset,
- ctHeaderHttp_retryAfter, ctHeaderHttp_retryAfterBackoff);
-
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_LINK);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_LINK);
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONFIGURAZIONE_POLICY_LIST);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_POLICY+" (" +sizePolicy+ ")");
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK);
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_LIST);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK+" (" + sizeGlobalPolicy+ ")");
- dati.add(de);
- // }
-
- }
-
- public void addConfigurazioneControlloTrafficoJmxStateToDati(List<DataElement> dati, TipoOperazione tipoOperazione) throws Exception {
- // jmx
-
- List<String> aliases = this.getCore().getJmxPdDAliases();
- if(aliases==null || aliases.size()<=0){
- throw new DriverControlStationException("Pagina non prevista, la sezione configurazione non permette di accedere a questa pagina, se la configurazione non e' corretta");
- }
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_STATO_RUNTIME);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // Link visualizza stato
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_REFRESH);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_REFRESH);
- de.setUrl(org.openspcoop2.web.ctrlstat.servlet.config.ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RUNTIME);
- de.setType(DataElementType.LINK);
- dati.add(de);
-
-
- for (String alias : aliases) {
-
- String descrizioneAlias = this.getCore().getJmxPdDDescrizione(alias);
-
- de = new DataElement();
- de.setLabel(descrizioneAlias);
- de.setValue(descrizioneAlias);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- String threadsAttivi = null;
- try{
- threadsAttivi = this.getCore().getInvoker().readJMXAttribute(alias, JMXConstants.JMX_TYPE,
- JMXConstants.JMX_NAME, JMXConstants.CC_ATTRIBUTE_ACTIVE_THREADS);
- }catch(Exception e){
- String errorMessage = "Errore durante il recupero dell'attributo ["+JMXConstants.CC_ATTRIBUTE_ACTIVE_THREADS+"] sulla risorsa ["+JMXConstants.JMX_NAME+"]: "+e.getMessage();
- ControlStationCore.getLog().error(errorMessage,e);
- threadsAttivi = errorMessage;
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_THREADS_ATTIVI);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_THREADS_ATTIVI);
- de.setType(DataElementType.TEXT);
- de.setValue(threadsAttivi);
- dati.add(de);
-
- String pddCongestionata = null;
- try{
- pddCongestionata = this.getCore().getInvoker().readJMXAttribute(alias, JMXConstants.JMX_TYPE,
- JMXConstants.JMX_NAME, JMXConstants.CC_ATTRIBUTE_PDD_CONGESTIONATA);
- }catch(Exception e){
- String errorMessage = "Errore durante il recupero dell'attributo ["+JMXConstants.CC_ATTRIBUTE_PDD_CONGESTIONATA+"] sulla risorsa ["+JMXConstants.JMX_NAME+"]: "+e.getMessage();
- ControlStationCore.getLog().error(errorMessage,e);
- pddCongestionata = errorMessage;
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_CONGESTIONE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_VISUALIZZA_STATO_CONGESTIONE);
- de.setType(DataElementType.TEXT);
- de.setValue(pddCongestionata);
- dati.add(de);
-
- this.getPd().disableEditMode();
-
- }
- }
-
- public void addToDatiTempiRispostaFruizione(List<DataElement> dati, TipoOperazione tipoOperazione, boolean editEnabled, TempiRispostaFruizione tempiRispostaFruizione) throws Exception {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FRUIZIONI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_FRUIZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaFruizione.getConnectionTimeout()!=null)
- de.setValue(tempiRispostaFruizione.getConnectionTimeout()+"");
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_FRUIZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaFruizione.getReadTimeout()!=null)
- de.setValue(tempiRispostaFruizione.getReadTimeout()+"");
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_FRUIZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaFruizione.getTempoMedioRisposta()!=null)
- de.setValue(tempiRispostaFruizione.getTempoMedioRisposta()+"");
- dati.add(de);
-
- }
-
-
- public void addToDatiTempiRispostaErogazione(List<DataElement> dati, TipoOperazione tipoOperazione, boolean editEnabled, TempiRispostaErogazione tempiRispostaErogazione) throws Exception {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_EROGAZIONI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_EROGAZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaErogazione.getConnectionTimeout()!=null)
- de.setValue(tempiRispostaErogazione.getConnectionTimeout()+"");
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_EROGAZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaErogazione.getReadTimeout()!=null)
- de.setValue(tempiRispostaErogazione.getReadTimeout()+"");
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MILLISECONDI_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_EROGAZIONE);
- if(editEnabled){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- }
- if(tempiRispostaErogazione.getTempoMedioRisposta()!=null)
- de.setValue(tempiRispostaErogazione.getTempoMedioRisposta()+"");
- dati.add(de);
-
- }
-
-
- public void addToDatiConfigurazioneCache(List<DataElement> dati, TipoOperazione tipoOperazione,
- Cache cache, boolean enabled) throws Exception {
-
-
- if(enabled){
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONFIGURAZIONE_CACHE_DATI_STATISTICI);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_STATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_STATO);
- if(enabled){
- //de.setType(DataElementType.CHECKBOX);
- de.setType(DataElementType.SELECT);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setValues(ConfigurazioneCostanti.STATI);
- de.setSelected(cache.isCache() ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
- de.setValue(cache.isCache() ? CostantiConfigurazione.ABILITATO.getValue() : CostantiConfigurazione.DISABILITATO.getValue());
- de.setPostBack(true);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE);
- if(enabled && cache.isCache()){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(cache.getSize()!=null)
- de.setValue(cache.getSize()+"");
- dati.add(de);
-
-
- String[] tipoAlgoritmo = {
- CacheAlgorithm.LRU.name(),
- CacheAlgorithm.MRU.name()
- };
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_ALGORITMO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_ALGORITMO);
- if(enabled && cache.isCache()){
- de.setType(DataElementType.SELECT);
- de.setValues(tipoAlgoritmo);
- if(cache.getAlgorithm()!=null){
- de.setSelected(cache.getAlgorithm().name());
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(cache.getAlgorithm()!=null){
- de.setValue(cache.getAlgorithm().name());
- }
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_LIFE_TIME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_LIFE_TIME);
- if(enabled && cache.isCache()){
- de.setType(DataElementType.TEXT_EDIT);
- //de.setRequired(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(cache.getLifeTime()!=null)
- de.setValue(cache.getLifeTime()+"");
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_IDLE_TIME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_IDLE_TIME);
- if(enabled && cache.isCache()){
- de.setType(DataElementType.TEXT_EDIT);
- de.setNote(ConfigurazioneCostanti.LABEL_CACHE_SECONDS_NOTE);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(cache.getIdleTime()!=null)
- de.setValue(cache.getIdleTime()+"");
- dati.add(de);
-
-
- }
-
- public String readConfigurazioneControlloTrafficoFromHttpParameters(ConfigurazioneControlloTraffico controlloTraffico, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // **** Limitazione Numero di Richieste Complessive Gestite dalla PdD ****
-
- // enabled
- String statoMaxThreads = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_STATO);
- if(statoMaxThreads!=null && !"".equals(statoMaxThreads)){
- controlloTraffico.setControlloMaxThreadsEnabled(CostantiConfigurazione.STATO_CON_WARNING_ABILITATO.getValue().equals(statoMaxThreads) ||
- CostantiConfigurazione.STATO_CON_WARNING_WARNING_ONLY.getValue().equals(statoMaxThreads));
- controlloTraffico.setControlloMaxThreadsWarningOnly(CostantiConfigurazione.STATO_CON_WARNING_WARNING_ONLY.getValue().equals(statoMaxThreads));
- }
-
- // soglia
- String numRichieste = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA);
- if(numRichieste!=null && !"".equals(numRichieste)){
- try{
- long l = Long.parseLong(numRichieste);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- controlloTraffico.setControlloMaxThreadsSoglia(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+numRichieste+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false)
- controlloTraffico.setControlloMaxThreadsSoglia(null); // il check segnalera' l'errore
- }
-
- // tipo errore
- String tipoErroreMaxThreads = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE);
- if(tipoErroreMaxThreads!=null && !"".equals(tipoErroreMaxThreads)){
- try{
- TipoErrore tipo = TipoErrore.toEnumConstant(tipoErroreMaxThreads, true);
- controlloTraffico.setControlloMaxThreadsTipoErrore(tipo.getValue());
- }catch(Exception e){
- String messaggio = "Il valore ("+tipoErroreMaxThreads+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE+"' deve assumere uno dei seguenti valori: "+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_FAULT +","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_429 +","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_503+","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_500;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(controlloTraffico.getControlloMaxThreadsTipoErrore()==null){
- // default
- controlloTraffico.setControlloMaxThreadsTipoErrore(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE);
- }
- }
- }
-
- // includi descrizione
- String tipoErroreIncludiDescrizioneMaxThreads = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE_DESCRIZIONE);
- if(tipoErroreMaxThreads!=null && !"".equals(tipoErroreMaxThreads)){
- controlloTraffico.setControlloMaxThreadsTipoErroreIncludiDescrizione(ServletUtils.isCheckBoxEnabled(tipoErroreIncludiDescrizioneMaxThreads));
- }
-
-
- // *** Controllo della Congestione ***
-
- // enabled
- String statoControlloCongestione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_STATO_CONTROLLO_CONGESTIONE);
- if(statoControlloCongestione!=null && !"".equals(statoControlloCongestione)){
- controlloTraffico.setControlloCongestioneEnabled(CostantiConfigurazione.ABILITATO.getValue().equals(statoControlloCongestione));
- }
-
- // threshold
- String threshold = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_THRESHOLD_CONTROLLO_CONGESTIONE);
- if(threshold!=null && !"".equals(threshold)){
- try{
- int t = Integer.parseInt(threshold);
- if(t<=0 || t>100){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- controlloTraffico.setControlloCongestioneThreshold(t);
- }catch(Exception e){
- String messaggio = "Il valore ("+threshold+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_THRESHOLD_CONTROLLO_CONGESTIONE+"' deve essere un numero compreso nell'intervallo [1,100]";
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(controlloTraffico.isControlloCongestioneEnabled()){
- if(controlloTraffico.getControlloCongestioneThreshold()==null){
- // default
- controlloTraffico.setControlloCongestioneThreshold(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_PARAMETRO_CONTROLLO_CONGESTIONE_THRESHOLD);
- }
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
-
- public String readConfigurazioneRateLimitingFromHttpParameters(ConfigurazioneRateLimiting rateLimiting, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // tipo errore
- String tipoErroreMaxThreads = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_TIPOLOGIA_ERRORE);
- if(tipoErroreMaxThreads!=null && !"".equals(tipoErroreMaxThreads)){
- try{
- TipoErrore tipo = TipoErrore.toEnumConstant(tipoErroreMaxThreads, true);
- rateLimiting.setTipoErrore(tipo.getValue());
- }catch(Exception e){
- String messaggio = "Il valore ("+tipoErroreMaxThreads+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE+"' deve assumere uno dei seguenti valori: "+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_FAULT +","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_429 +","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_503+","+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_ERRORE_HTTP_500;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(rateLimiting.getTipoErrore()==null){
- // default
- rateLimiting.setTipoErrore(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_TIPOLOGIA_ERRORE);
- }
- }
- }
-
- // includi descrizione
- String tipoErroreIncludiDescrizioneMaxThreads = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_TIPOLOGIA_ERRORE_DESCRIZIONE);
- if(tipoErroreMaxThreads!=null && !"".equals(tipoErroreMaxThreads)){
- rateLimiting.setTipoErroreIncludiDescrizione(ServletUtils.isCheckBoxEnabled(tipoErroreIncludiDescrizioneMaxThreads));
- }
-
-
- // parametri
- String ctModalitaSincronizzazione = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_SINCRONIZZAZIONE);
- String ctImplementazione = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_IMPLEMENTAZIONE);
- String ctContatori = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_CONTATORI);
- String ctTipologia = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_TIPOLOGIA);
- String ctHeaderHttp = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP);
- String ctHeaderHttp_limit = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_LIMIT);
- String ctHeaderHttp_remaining = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_REMAINING);
- String ctHeaderHttp_reset = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RESET);
- String ctHeaderHttp_retryAfter = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER);
- String ctHeaderHttp_retryAfterBackoff = this.getParameter(org.openspcoop2.core.controllo_traffico.constants.Costanti.MODALITA_GENERAZIONE_HEADER_HTTP_RETRY_AFTER_BACKOFF_SECONDS);
-
- if(ctModalitaSincronizzazione!=null && !"".equals(ctModalitaSincronizzazione)) {
- List<Proprieta> oldList= new ArrayList<Proprieta>();
- if(rateLimiting.getProprietaList()!=null && !rateLimiting.getProprietaList().isEmpty()) {
- for (ConfigurazioneRateLimitingProprieta rt : rateLimiting.getProprietaList()) {
- Proprieta proprieta = new Proprieta();
- proprieta.setNome(rt.getNome());
- proprieta.setValore(rt.getValore());
- }
- }
- PolicyConfiguration oldPolicyConfig = new PolicyConfiguration(oldList, this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(), false);
- boolean changeImpl = false;
- if(oldPolicyConfig.getEngineType()!=null) {
- changeImpl=!oldPolicyConfig.getEngineType().equals(ctTipologia);
- }
- else if(ctContatori!=null) {
- changeImpl=true;
- }
-
- PolicyConfiguration policyConfig = new PolicyConfiguration();
- if(changeImpl) {
- policyConfig.setGestorePolicyConfigDate(DateManager.getTimeMillis());
- }
- else {
- policyConfig.setGestorePolicyConfigDate(oldPolicyConfig.getGestorePolicyConfigDate());
- }
- policyConfig.setSyncMode(ctModalitaSincronizzazione);
- policyConfig.setImpl(ctImplementazione);
- policyConfig.setCount(ctContatori);
- policyConfig.setEngineType(ctTipologia);
- policyConfig.setHttpMode(ctHeaderHttp);
- policyConfig.setHttpMode_limit(ctHeaderHttp_limit);
- policyConfig.setHttpMode_remaining(ctHeaderHttp_remaining);
- policyConfig.setHttpMode_reset(ctHeaderHttp_reset);
- policyConfig.setHttpMode_retry_after(ctHeaderHttp_retryAfter);
- policyConfig.setHttpMode_retry_after_backoff(ctHeaderHttp_retryAfterBackoff);
- List<Proprieta> list= new ArrayList<Proprieta>();
- policyConfig.saveIn(list);
- if(rateLimiting.getProprietaList()!=null) {
- rateLimiting.getProprietaList().clear();
- }
- if(list!=null && !list.isEmpty()){
- for (Proprieta proprieta : list) {
- ConfigurazioneRateLimitingProprieta rtProp = new ConfigurazioneRateLimitingProprieta();
- rtProp.setNome(proprieta.getNome());
- rtProp.setValore(proprieta.getValore());
- rateLimiting.addProprieta(rtProp);
- }
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public String readTempiRispostaFruizioneFromHttpParameters(TempiRispostaFruizione tempiRispostaFruizione, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // connection-timeout
- String connectionTimeout = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_FRUIZIONE);
- if(connectionTimeout!=null && !"".equals(connectionTimeout)){
- try{
- int l = Integer.parseInt(connectionTimeout);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaFruizione.setConnectionTimeout(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+connectionTimeout+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaFruizione.setConnectionTimeout(null); // il check segnalera' l'errore
- }
- }
-
- // read-timeout
- String readTimeout = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_FRUIZIONE);
- if(readTimeout!=null && !"".equals(readTimeout)){
- try{
- int l = Integer.parseInt(readTimeout);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaFruizione.setReadTimeout(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+readTimeout+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaFruizione.setReadTimeout(null); // il check segnalera' l'errore
- }
- }
-
- // tempo medio risposta
- String tempoMedioRisposta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_FRUIZIONE);
- if(tempoMedioRisposta!=null && !"".equals(tempoMedioRisposta)){
- try{
- int l = Integer.parseInt(tempoMedioRisposta);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaFruizione.setTempoMedioRisposta(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+tempoMedioRisposta+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaFruizione.setTempoMedioRisposta(null); // il check segnalera' l'errore
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public String readTempiRispostaErogazioneFromHttpParameters(TempiRispostaErogazione tempiRispostaErogazione, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // connection-timeout
- String connectionTimeout = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_EROGAZIONE);
- if(connectionTimeout!=null && !"".equals(connectionTimeout)){
- try{
- int l = Integer.parseInt(connectionTimeout);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaErogazione.setConnectionTimeout(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+connectionTimeout+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaErogazione.setConnectionTimeout(null); // il check segnalera' l'errore
- }
- }
-
- // read-timeout
- String readTimeout = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_EROGAZIONE);
- if(readTimeout!=null && !"".equals(readTimeout)){
- try{
- int l = Integer.parseInt(readTimeout);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaErogazione.setReadTimeout(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+readTimeout+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaErogazione.setReadTimeout(null); // il check segnalera' l'errore
- }
- }
-
- // tempo medio risposta
- String tempoMedioRisposta = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_EROGAZIONE);
- if(tempoMedioRisposta!=null && !"".equals(tempoMedioRisposta)){
- try{
- int l = Integer.parseInt(tempoMedioRisposta);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- tempiRispostaErogazione.setTempoMedioRisposta(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+tempoMedioRisposta+") indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first==false){
- tempiRispostaErogazione.setTempoMedioRisposta(null); // il check segnalera' l'errore
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
-
- public String readConfigurazioneCacheFromHttpParameters(Cache cache, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // cache enable
- String cacheStato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_STATO);
- //cache.setCache(ServletUtils.isCheckBoxEnabled(cacheStato));
- if(cacheStato!=null && !"".equals(cacheStato)){
- cache.setCache(CostantiConfigurazione.ABILITATO.getValue().equals(cacheStato));
- }
-
- // cache dimensione
- String cacheDimensione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE);
- if(cacheDimensione!=null && !"".equals(cacheDimensione)){
- try{
- long l = Long.parseLong(cacheDimensione);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- cache.setSize(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+cacheDimensione+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(cache.getSize()==null){
- // default
- cache.setSize(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE);
- }
- }
- else{
- cache.setSize(null); // il check segnalera' l'errore
- }
- }
-
- // cache item life
- String cacheItemLife = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_LIFE_TIME);
- if(cacheItemLife!=null && !"".equals(cacheItemLife)){
- try{
- long l = Long.parseLong(cacheItemLife);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- cache.setLifeTime(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+cacheItemLife+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_LIFE_TIME+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(cache.getLifeTime()==null){
- // default
- //cache.setLifeTime(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_LIFE_TIME);
- }
- }else{
- cache.setLifeTime(null); // il check segnalera' l'errore
- }
- }
-
- // cache item idle
- String cacheItemIdle = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_IDLE_TIME);
- if(cacheItemIdle!=null && !"".equals(cacheItemIdle)){
- try{
- long l = Long.parseLong(cacheItemIdle);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- cache.setIdleTime(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+cacheItemIdle+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_IDLE_TIME+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(cache.getIdleTime()==null){
- // default is null
- //cache.setCacheIdleTime(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONTROLLO_CONGESTIONE_CACHE_IDLE_TIME);
- }
- }
- else{
- cache.setIdleTime(null);
- }
- }
-
- // cache algorithm
- String cacheAlgorithm = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_ALGORITMO);
- if(cacheAlgorithm!=null && !"".equals(cacheAlgorithm)){
- try{
- if(!CacheAlgorithm.LRU.name().equals(cacheAlgorithm) &&
- !CacheAlgorithm.MRU.name().equals(cacheAlgorithm)){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- cache.setAlgorithm(CacheAlgorithm.toEnumConstant(cacheAlgorithm));
- }catch(Exception e){
- String messaggio = "Il valore ("+cacheAlgorithm+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_ALGORITMO+"' deve assumere uno dei seguenti valori: "+
- CacheAlgorithm.LRU.name() +","+CacheAlgorithm.MRU.name();
- ControlStationCore.getLog().error(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(first){
- if(cache.getAlgorithm()==null){
- // default
- cache.setAlgorithm(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_ALGORITMO);
- }
- }
- }
-
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public void addParsingError(StringBuilder sbParsingError, String parsingError) {
- if(sbParsingError.length() == 0)
- sbParsingError.append(parsingError);
- else
- sbParsingError.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE).append(parsingError);
- }
-
-
- public boolean checkDatiConfigurazioneControlloTraffico(TipoOperazione tipoOperazione, StringBuilder sbParsingError, org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico) throws Exception {
- // errori di parsing letti durante la read della richiesta
- if(sbParsingError.length() >0){
- this.pd.setMessage(sbParsingError.toString());
- return false;
- }
-
- if(configurazioneControlloTraffico.getControlloTraffico().getControlloMaxThreadsSoglia()==null){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // rate limiting
- List<Proprieta> listProprieta = new ArrayList<Proprieta>();
- if(configurazioneControlloTraffico.getRateLimiting().sizeProprietaList()>0) {
- for (ConfigurazioneRateLimitingProprieta rtProp : configurazioneControlloTraffico.getRateLimiting().getProprietaList()) {
- Proprieta p = new Proprieta();
- p.setNome(rtProp.getNome());
- p.setValore(rtProp.getValore());
- listProprieta.add(p);
- }
- }
- PolicyConfiguration policyConfig = new PolicyConfiguration(listProprieta, this.core.getControlloTrafficoPolicyRateLimitingTipiGestori(), false);
- String ctModalitaSincronizzazione = policyConfig.getSyncMode();
- String ctImplementazione = policyConfig.getImpl();
- String ctContatori = policyConfig.getCount();
- String ctTipologia = policyConfig.getEngineType();
- String ctHeaderHttp = policyConfig.getHttpMode();
- String ctHeaderHttp_limit = policyConfig.getHttpMode_limit();
- String ctHeaderHttp_remaining = policyConfig.getHttpMode_remaining();
- String ctHeaderHttp_reset = policyConfig.getHttpMode_reset();
- String ctHeaderHttp_retryAfter = policyConfig.getHttpMode_retry_after();
- String ctHeaderHttp_retryAfterBackoff = policyConfig.getHttpMode_retry_after_backoff();
-
- boolean validitaParametri = validaOpzioniAvanzateRateLimiting(null, null,
- ctModalitaSincronizzazione, ctImplementazione, ctContatori, ctTipologia,
- ctHeaderHttp, ctHeaderHttp_limit, ctHeaderHttp_remaining, ctHeaderHttp_reset,
- ctHeaderHttp_retryAfter, ctHeaderHttp_retryAfterBackoff);
- if(!validitaParametri) {
- return false;
- }
-
- // tempi risposta fruizione
-
- if(configurazioneControlloTraffico.getTempiRispostaFruizione().getConnectionTimeout()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(configurazioneControlloTraffico.getTempiRispostaFruizione().getReadTimeout()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(configurazioneControlloTraffico.getTempiRispostaFruizione().getTempoMedioRisposta()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_FRUIZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // tempi risposta erogazione
-
- if(configurazioneControlloTraffico.getTempiRispostaErogazione().getConnectionTimeout()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONNECTION_TIMEOUT_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(configurazioneControlloTraffico.getTempiRispostaErogazione().getReadTimeout()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_READ_TIMEOUT_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(configurazioneControlloTraffico.getTempiRispostaErogazione().getTempoMedioRisposta()==null){
- String messaggio = "Deve essere indicato nella sezione '"+
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TEMPI_RISPOSTA_EROGAZIONE
- +"' un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_TEMPO_MEDIO_RISPOSTA_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // cache
-
- if(configurazioneControlloTraffico.getCache().isCache()){
-
- if(configurazioneControlloTraffico.getCache().getSize()==null){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // if(configurazioneControlloTraffico.getCache().getLifeTime()==null){
- // String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CACHE_DIMENSIONE+"'";
- // this.pd.setMessage(messaggio);
- // return false;
- // }
-
- }
- return true;
- }
-
- public void prepareConfigurazionePolicyList(ConsoleSearch ricerca, List<ConfigurazionePolicy> lista, int idLista) throws Exception{
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONFIGURAZIONE_POLICY);
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- //
- // this.pd.setSearchDescription("");
- // this.pd.setSearch("off");
-
- String filterTipoPolicy = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_POLICY);
- this.addFilterTipoPolicy(filterTipoPolicy,false);
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_POLICY, null));
- ServletUtils.setPageDataTitle(this.pd, lstParam);
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, "Policy", search);
- }
-
- // setto le label delle colonne
- String[] labels = {
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPO,
- CostantiControlStation.LABEL_IN_USO_COLONNA_HEADER // inuso
- };
- this.pd.setLabels(labels);
-
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- List<DataElement> e = new ArrayList<>();
- ConfigurazionePolicy policy = lista.get(i);
-
- String nDesr = policy.getDescrizione();
-
- Parameter pPolicyId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID, policy.getId() + "");
- DataElement de = new DataElement();
- de.setSize(100);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONFIGURAZIONE_POLICY_CHANGE, pPolicyId);
- de.setValue(policy.getIdPolicy());
- de.setIdToRemove(""+policy.getId());
- de.setToolTip(policy.getIdPolicy()+"\n"+nDesr);
- e.add(de);
-
- de = new DataElement();
- if(policy.isBuiltIn()) {
- de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPO_BUILT_IN);
- }
- else {
- de.setValue(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPO_UTENTE);
- }
- e.add(de);
-
- this.addInUsoButtonVisualizzazioneClassica(e, policy.getIdPolicy(), policy.getId()+"", InUsoType.RATE_LIMITING_POLICY);
-
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport()) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONFIG_POLICY, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONTROLLO_TRAFFICO_CONFIG_POLICY_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_CONTROLLO_TRAFFICO_CONFIG_POLICY_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public List<Parameter> getTitleListAttivazionePolicy(RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding, String nomeOggetto) throws Exception{
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
-
- String labelPerPorta = null;
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
- Integer parentPD = ServletUtils.getIntegerAttributeFromSession(PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT, this.session, this.request);
- if(parentPD == null) parentPD = PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_NONE;
-
- IDPortaDelegata idPortaDelegata = new IDPortaDelegata();
- idPortaDelegata.setNome(nomePorta);
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPortaDelegata);
- String idporta = myPD.getNome();
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- lstParamPorta = porteDelegateHelper.getTitoloPD(parentPD,idSoggetto +"", idAsps+"", idFruizione+"");
-
- if(parentPD!=null && (parentPD.intValue() == PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_CONFIGURAZIONE)) {
- labelPerPorta = this.porteDelegateCore.getLabelRegolaMappingFruizionePortaDelegata(
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_DI,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING,
- myPD);
- }
- else {
- labelPerPorta = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_DI+idporta;
- }
-
- }
- else {
- Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
-
- IDPortaApplicativa idPortaApplicativa = new IDPortaApplicativa();
- idPortaApplicativa.setNome(nomePorta);
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPortaApplicativa);
- String idporta = myPA.getNome();
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- lstParamPorta = porteApplicativeHelper.getTitoloPA(parentPA, idSoggetto+"", idAsps+"");
-
- if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
- labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_DI,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING,
- myPA);
- }
- else {
- labelPerPorta = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_DI+idporta;
- }
-
- }
-
- if(nomeOggetto==null) {
- lstParamPorta.add(new Parameter(labelPerPorta,null));
- }
- else {
- List<Parameter> list = new ArrayList<>();
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_RUOLO_PORTA, ruoloPorta.getValue()));
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_NOME_PORTA, nomePorta));
- if(serviceBinding!=null) {
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_SERVICE_BINDING,serviceBinding.name()));
- }
- lstParamPorta.add(new Parameter(labelPerPorta,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_LIST,
- list
- ));
- lstParamPorta.add(new Parameter(nomeOggetto,null));
- }
- }
-
- return lstParamPorta;
- }
-
- public void impostaComandiMenuContestualeAttivazionePolicy(RuoloPolicy ruoloPorta, String nomePorta) throws Exception{
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- IDPortaDelegata idPortaDelegata = new IDPortaDelegata();
- idPortaDelegata.setNome(nomePorta);
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPortaDelegata);
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- porteDelegateHelper.impostaComandiMenuContestualePD(idSoggetto +"", idAsps+"", idFruizione+"");
- }
- else {
- IDPortaApplicativa idPortaApplicativa = new IDPortaApplicativa();
- idPortaApplicativa.setNome(nomePorta);
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPortaApplicativa);
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- porteApplicativeHelper.impostaComandiMenuContestualePA(idSoggetto+"", idAsps+"");
- }
- }
- }
-
- public List<TipoRisorsaPolicyAttiva> gestisciCriteriFiltroRisorsaPolicy(ConsoleSearch ricerca, RuoloPolicy ruoloPorta, String nomePorta) throws Exception {
-
- int idLista = Liste.CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY;
-
- // Gestione risorsa
- List<TipoRisorsaPolicyAttiva> listaTipoRisorsa = this.confCore.attivazionePolicyTipoRisorsaList(ricerca, ruoloPorta, nomePorta);
- String filterTipoRisorsaPolicy = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_RISORSA_POLICY);
- if(filterTipoRisorsaPolicy!=null && !"".equals(filterTipoRisorsaPolicy)) {
- TipoRisorsaPolicyAttiva filterTipoRisorsaPolicyAsObject = TipoRisorsaPolicyAttiva.toEnumConstant(filterTipoRisorsaPolicy, false);
- if(filterTipoRisorsaPolicyAsObject==null) {
- filterTipoRisorsaPolicy = null;
- }
- else {
- if(!listaTipoRisorsa.contains(filterTipoRisorsaPolicyAsObject)) {
- filterTipoRisorsaPolicy = null; // in seguito ad una eliminazione
- }
- }
- }
- // gestione default
- if(filterTipoRisorsaPolicy==null || "".equals(filterTipoRisorsaPolicy)) {
-
- TipoRisorsaPolicyAttiva defaultValue = CostantiControlStation.DEFAULT_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO_VALUE;
- if(listaTipoRisorsa!=null && !listaTipoRisorsa.isEmpty() && !listaTipoRisorsa.contains(defaultValue)) {
- // cerco le metriche più gettonate, altrimeni uso la prima che esiste
- if(listaTipoRisorsa.contains(TipoRisorsaPolicyAttiva.NUMERO_RICHIESTE)) {
- defaultValue = TipoRisorsaPolicyAttiva.NUMERO_RICHIESTE;
- }
- else if(listaTipoRisorsa.contains(TipoRisorsaPolicyAttiva.NUMERO_RICHIESTE_SIMULTANEE)) {
- defaultValue = TipoRisorsaPolicyAttiva.NUMERO_RICHIESTE_SIMULTANEE;
- }
- else if(listaTipoRisorsa.contains(TipoRisorsaPolicyAttiva.DIMENSIONE_MASSIMA_MESSAGGIO)) {
- defaultValue = TipoRisorsaPolicyAttiva.DIMENSIONE_MASSIMA_MESSAGGIO;
- }
- else if(listaTipoRisorsa.contains(TipoRisorsaPolicyAttiva.OCCUPAZIONE_BANDA)) {
- defaultValue = TipoRisorsaPolicyAttiva.OCCUPAZIONE_BANDA;
- }
- else {
- defaultValue = listaTipoRisorsa.get(0);
- }
- }
-
- ricerca.addFilter(idLista, Filtri.FILTRO_TIPO_RISORSA_POLICY, defaultValue.getValue());
- }
-
- return listaTipoRisorsa;
- }
-
- public void prepareAttivazionePolicyList(ConsoleSearch ricerca, List<AttivazionePolicy> lista, List<TipoRisorsaPolicyAttiva> listaTipoRisorsa,
- int idLista,RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding) throws Exception{
- try {
- List<Parameter> lstParamSession = new ArrayList<>();
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_RUOLO_PORTA, ruoloPorta.getValue());
- lstParamSession.add(parRuoloPorta);
- }
- Parameter parNomePorta = null;
- if(nomePorta!=null) {
- parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_NOME_PORTA, nomePorta);
- lstParamSession.add(parNomePorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_SERVICE_BINDING, serviceBinding.name());
- lstParamSession.add(parServiceBinding);
- }
-
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY, lstParamSession);
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- lstParamPorta = getTitleListAttivazionePolicy(ruoloPorta, nomePorta, serviceBinding, null);
- }
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- String filterTipoRisorsaPolicy = null;
- if(listaTipoRisorsa!=null && !listaTipoRisorsa.isEmpty()) {
- filterTipoRisorsaPolicy = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_RISORSA_POLICY);
- this.addFilterTipoRisorsaPolicy(listaTipoRisorsa,filterTipoRisorsaPolicy, false);
- }
- else {
- this.removeFilterTipoRisorsaPolicy();
- }
-
- // this.pd.setSearchDescription("");
- // this.pd.setSearch("off");
- // controllo eventuali risultati ricerca
- if (!search.equals("") || (filterTipoRisorsaPolicy!=null && !"".equals(filterTipoRisorsaPolicy))) {
- ServletUtils.enabledPageDataSearch(this.pd, "Policy", search);
- }
-
- boolean showMetricaColumn = false;
-
- // setto la barra del titolo
- List<Parameter> lstParam = null;
- if(lstParamPorta!=null) {
- lstParam = lstParamPorta;
- }
- else {
- lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- if(ruoloPorta!=null) {
- this.impostaComandiMenuContestualeAttivazionePolicy(ruoloPorta, nomePorta);
- }
-
- String labelSogliaColonna = null;
- TipoRisorsaPolicyAttiva tipoRisorsa = null;
- if(filterTipoRisorsaPolicy!=null && !"".equals(filterTipoRisorsaPolicy)){
- tipoRisorsa = TipoRisorsaPolicyAttiva.toEnumConstant(filterTipoRisorsaPolicy, true);
- switch (tipoRisorsa) {
- case NUMERO_RICHIESTE:
- case NUMERO_RICHIESTE_SIMULTANEE:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- case NUMERO_RICHIESTE_FALLITE:
- case NUMERO_FAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- //labelSogliaColonna =ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_ESTESA;
- labelSogliaColonna =ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA_NUMERO;
- break;
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- //labelSogliaColonna =ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_KB_LABEL;
- labelSogliaColonna =ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA_DIMENSIONE_MESSAGGIO;
- break;
- case OCCUPAZIONE_BANDA:
- //labelSogliaColonna =ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_KB_LABEL;
- labelSogliaColonna =ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA_BANDA;
- break;
- case TEMPO_MEDIO_RISPOSTA:
- //labelSogliaColonna =ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_MS_LABEL;
- labelSogliaColonna =ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA_TEMPI_MS;
- break;
- case TEMPO_COMPLESSIVO_RISPOSTA:
- //labelSogliaColonna =ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_MS_LABEL;
- labelSogliaColonna =ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA_TEMPI_SECONDI;
- break;
- }
- }
-
-
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- if(lista != null && lista.size() > 1) {
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POSIZIONE);
- }
- lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME);
- if(labelSogliaColonna!=null) {
- lstLabels.add(labelSogliaColonna);
- }
- if(showMetricaColumn) {
- if((filterTipoRisorsaPolicy==null || "".equals(filterTipoRisorsaPolicy))) {
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_RISORSA);
- }
- }
- if(!TipoRisorsaPolicyAttiva.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUNTIME);
- }
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- //lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILTRO);
- //lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RAGGRUPPAMENTO_COLUMN);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
-
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
-
- int numeroElementi = lista.size();
-
- Integer sizeColumn = null;
-
- for (int i = 0; i < lista.size(); i++) {
- AttivazionePolicy policy = lista.get(i);
- List<DataElement> e = new ArrayList<>();
-
- // Fix retrocompatibilita dove il nome non era obbligatorio.
- policy.setAlias(PolicyUtilities.getNomeActivePolicy(policy.getAlias(), policy.getIdActivePolicy()));
-
- String descrizionePolicy = "";
- try{
- descrizionePolicy = this.confCore.getInfoPolicy(policy.getIdPolicy()).getDescrizione();
- }catch(Exception ex){
- ControlStationCore.getLog().error(ex.getMessage(),ex);
- }
- String nDescr = "";
- if(StringUtils.isNotEmpty(policy.getAlias())) {
- nDescr = policy.getAlias();
- }
- nDescr = nDescr + "\n"+"Identificativo Runtime: "+ policy.getIdActivePolicy();
- nDescr = nDescr + "\n"+"Policy: "+ policy.getIdPolicy();
- nDescr = nDescr+"\n"+descrizionePolicy;
-
-
- Parameter pPolicyId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID, policy.getId() + "");
- Parameter pPolicyRisorsa = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA, filterTipoRisorsaPolicy);
- // Posizione
- if(lista.size() > 1) {
- DataElement de = new DataElement();
- de.setWidthPx(48);
- de.setType(DataElementType.IMAGE);
- DataElementImage imageUp = new DataElementImage();
- Parameter pDirezioneSu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
- Parameter pDirezioneGiu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
-
- if(i > 0) {
- imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
- imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
- List<Parameter> listP = new ArrayList<>();
- listP.add(pPolicyId);
- listP.add(pPolicyRisorsa);
- if(ruoloPorta!=null) {
- listP.add(parRuoloPorta);
- listP.add(parNomePorta);
- listP.add(parServiceBinding);
- }
- listP.add(pDirezioneSu);
- imageUp.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_LIST, listP.toArray(new Parameter[1]));
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
- }
- de.addImage(imageUp);
-
- if(i < numeroElementi -1) {
- DataElementImage imageDown = new DataElementImage();
- imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
- imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
- List<Parameter> listP = new ArrayList<>();
- listP.add(pPolicyId);
- listP.add(pPolicyRisorsa);
- if(ruoloPorta!=null) {
- listP.add(parRuoloPorta);
- listP.add(parNomePorta);
- listP.add(parServiceBinding);
- }
- listP.add(pDirezioneGiu);
- imageDown.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_LIST, listP.toArray(new Parameter[1]));
- de.addImage(imageDown);
- }
- de.setValue(policy.getPosizione()+"");
- e.add(de);
- }
-
- // Stato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(policy.isEnabled()){
- if(policy.isWarningOnly()){
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY);
- de.setSelected(CheckboxStatusType.CONFIG_WARNING);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId, parRuoloPorta, parNomePorta, parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId);
- }
- e.add(de);
-
-
- // nome
- de = new DataElement();
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId, parRuoloPorta, parNomePorta, parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId);
- }
-
- if(StringUtils.isNotEmpty(policy.getAlias()))
- de.setValue(policy.getAlias());
- else
- de.setValue(policy.getIdActivePolicy());
-
- de.setIdToRemove(""+policy.getId());
- de.setToolTip(nDescr);
- e.add(de);
-
- ConfigurazionePolicy configPolicy = null;
-
-
- // Soglia
- if(labelSogliaColonna!=null) {
- de = new DataElement();
-
- Integer maxLength = null;
- if(TipoRisorsaPolicyAttiva.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- String vReq = null;
- String vRes = null;
- if(policy.isRidefinisci()) {
- vReq = policy.getValore2()+"";
- vRes = policy.getValore()+"";
- }
- else {
- if(configPolicy==null) {
- configPolicy = this.confCore.getConfigurazionePolicy(policy.getIdPolicy());
- }
- vReq = configPolicy.getValore2()+"";
- vRes = configPolicy.getValore()+"";
- }
- if(vReq.length()>vRes.length()) {
- maxLength = vReq.length();
- }
- else {
- maxLength = vRes.length();
- }
- String rigaRichiesta = "richiesta: "+vReq;
- String rigaRisposta = "risposta: "+vRes;
- de.setValue(rigaRichiesta+"<BR/>"+rigaRisposta);
- }
- else {
- if(policy.isRidefinisci()) {
- de.setValue(policy.getValore()+"");
- }
- else {
- if(configPolicy==null) {
- configPolicy = this.confCore.getConfigurazionePolicy(policy.getIdPolicy());
- }
- de.setValue(configPolicy.getValore()+"");
- }
- }
-
-
- int checkLength = de.getValue().length();
- int guiPrefix = 0;
- if(maxLength!=null) {
- checkLength = maxLength;
- guiPrefix=50;
- }
-
- if(sizeColumn==null) {
- de.setWidthPx(guiPrefix+70);
- sizeColumn = guiPrefix+70;
- }
- if(checkLength>(12)) {
- if(sizeColumn<(guiPrefix+110)) {
- de.setWidthPx(guiPrefix+110);
- sizeColumn = guiPrefix+110;
- }
- }
- else if(checkLength>(9)) {
- if(sizeColumn<(guiPrefix+90)) {
- de.setWidthPx(guiPrefix+90);
- sizeColumn = guiPrefix+90;
- }
- }
-
- de.allineaTdAlCentro();
- e.add(de);
- }
-
-
- // Tipo Risorsa
-
- if(showMetricaColumn) {
- if((filterTipoRisorsaPolicy==null || "".equals(filterTipoRisorsaPolicy))) {
-
- if(configPolicy==null) {
- configPolicy = this.confCore.getConfigurazionePolicy(policy.getIdPolicy());
- }
- TipoRisorsaPolicyAttiva tipoRisorsaPolicyAttiva = TipoRisorsaPolicyAttiva.getTipo(configPolicy.getRisorsa(),configPolicy.isSimultanee());
- String labelRisorsaPolicyAttiva = this.getLabelTipoRisorsaPolicyAttiva(tipoRisorsaPolicyAttiva);
- de = new DataElement();
- de.setValue(labelRisorsaPolicyAttiva);
- e.add(de);
-
- }
- }
-
-
- if(!TipoRisorsaPolicyAttiva.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- de = new DataElement();
- if(policy.isEnabled()){
- de.setValue("Visualizza");
- }
- else{
- de.setValue("-");
- }
- de.allineaTdAlCentro();
- de.setWidthPx(60);
-
- Parameter pJmx = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+"");
- if(policy.isEnabled()){
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId,pJmx, parRuoloPorta, parNomePorta, parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId,pJmx);
- }
- }
- e.add(de);
- }
-
-
-
- // Continue
-
- de = new DataElement();
- de.setWidthPx(24);
- de.setType(DataElementType.IMAGE);
-
- DataElementImage imageUp = new DataElementImage();
- if(policy.isContinuaValutazione()) {
- imageUp.setImage(CostantiControlStation.ICONA_CONTINUE);
- imageUp.setToolTip(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE_PROSEGUI_TOOLTIP);
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_BREAK);
- imageUp.setToolTip(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE_INTERROMPI_TOOLTIP);
- }
- if(ruoloPorta!=null) {
- imageUp.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId, parRuoloPorta, parNomePorta, parServiceBinding);
- }
- else {
- imageUp.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId);
- }
- de.addImage(imageUp);
-
- de.allineaTdAlCentro();
-
- de.setValue(policy.getPosizione()+"");
- e.add(de);
-
-
- // de = new DataElement();
- // String filtro = this.toStringCompactFilter(policy.getFiltro(),ruoloPorta,nomePorta);
- // if(filtro.length()>60){
- // de.setValue(filtro.substring(0,57)+"...");
- // }else{
- // de.setValue(filtro);
- // }
- // de.setToolTip(filtro);
- // if(ruoloPorta!=null) {
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId, parRuoloPorta, parNomePorta, parServiceBinding);
- // }
- // else {
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId);
- // }
- // e.add(de);
- //
- // de = new DataElement();
- // String groupBy = this.toStringCompactGroupBy(policy.getGroupBy(),ruoloPorta,nomePorta);
- // if(groupBy.length()>60){
- // de.setValue(groupBy.substring(0,57)+"...");
- // }else{
- // de.setValue(groupBy);
- // }
- // de.setToolTip(groupBy);
- // if(ruoloPorta!=null) {
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId, parRuoloPorta, parNomePorta, parServiceBinding);
- // }
- // else {
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE, pPolicyId);
- // }
- // e.add(de);
-
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport() && (nomePorta==null || StringUtils.isEmpty(nomePorta))) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_CONTROLLO_TRAFFICO_ACTIVE_POLICY, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONTROLLO_TRAFFICO_ACTIVE_POLICY_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_CONTROLLO_TRAFFICO_ACTIVE_POLICY_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public String toStringCompactFilter(AttivazionePolicyFiltro filtro, RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- StringBuilder bf = new StringBuilder("");
- if(filtro.isEnabled()){
- if(configurazione) {
- if( (filtro.getRuoloPorta()!=null && !RuoloPolicy.ENTRAMBI.equals(filtro.getRuoloPorta())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- if(RuoloPolicy.DELEGATA.equals(filtro.getRuoloPorta())){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD).append(": ");
- bf.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUOLO_PORTA_DELEGATA);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(filtro.getRuoloPorta())){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD).append(": ");
- bf.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUOLO_PORTA_APPLICATIVA);
- }
- }
- }
- if(configurazione) {
- if( !(filtro.getProtocollo()==null || "".equals(filtro.getProtocollo())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_COMPACT+": ");
- bf.append(this.getLabelProtocollo(filtro.getProtocollo()));
- }
- }
-
- if(configurazione) {
- if( !(filtro.getNomePorta()==null || "".equals(filtro.getNomePorta())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PORTA).append(": ");
- bf.append(filtro.getNomePorta());
- }
- }
-
- if(configurazione) {
- if(filtro.getRuoloErogatore()!=null) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE).append(": ");
- bf.append(filtro.getRuoloErogatore());
- }
- else if( !( (filtro.getTipoErogatore()==null || "".equals(filtro.getTipoErogatore()))
- ||
- (filtro.getNomeErogatore()==null || "".equals(filtro.getNomeErogatore())) ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE_COMPACT).append(": ");
- IDSoggetto idSoggetto = new IDSoggetto(filtro.getTipoErogatore(), filtro.getNomeErogatore());
- bf.append(this.getLabelNomeSoggetto(idSoggetto));
- }
- }
- if(configurazione) {
- if( !(filtro.getTag()==null || "".equals(filtro.getTag())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG).append(": ");
- bf.append(filtro.getTag());
- }
- }
-
- if(configurazione) {
- if( !( (filtro.getTipoServizio()==null || "".equals(filtro.getTipoServizio()))
- ||
- (filtro.getNomeServizio()==null || "".equals(filtro.getNomeServizio()))
- ||
- (filtro.getVersioneServizio()==null)
- ||
- (filtro.getTipoErogatore()==null || "".equals(filtro.getTipoErogatore()))
- ||
- (filtro.getNomeErogatore()==null || "".equals(filtro.getNomeErogatore()))
- ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO).append(": ");
- IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(filtro.getTipoServizio(), filtro.getNomeServizio(),
- filtro.getTipoErogatore(), filtro.getNomeErogatore(),
- filtro.getVersioneServizio());
- bf.append(this.getLabelIdServizio(idServizio));
- }
- }
-
- if( !(filtro.getAzione()==null || "".equals(filtro.getAzione())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(this.getLabelAzione(serviceBinding)).append(": ");
- bf.append(filtro.getAzione());
- }
-
- if(configurazione) {
- if( !(filtro.getServizioApplicativoErogatore()==null || "".equals(filtro.getServizioApplicativoErogatore())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE).append(": ");
- bf.append(filtro.getServizioApplicativoErogatore());
- }
- }
-
- if(configurazione || applicativa) {
- if(filtro.getRuoloFruitore()!=null) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE).append(": ");
- bf.append(filtro.getRuoloFruitore());
- }
- else if( !( (filtro.getTipoFruitore()==null || "".equals(filtro.getTipoFruitore()))
- ||
- (filtro.getNomeFruitore()==null || "".equals(filtro.getNomeFruitore())) ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE_COMPACT).append(": ");
- IDSoggetto idSoggetto = new IDSoggetto(filtro.getTipoFruitore(), filtro.getNomeFruitore());
- bf.append(this.getLabelNomeSoggetto(idSoggetto));
- }
- if(configurazione) {
- if( !(filtro.getServizioApplicativoFruitore()==null || "".equals(filtro.getServizioApplicativoFruitore())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE_COMPACT).append(": ");
- bf.append(filtro.getServizioApplicativoFruitore());
- }
- }
- }
- else if(delegata) {
- if(filtro.getRuoloFruitore()!=null) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE).append(": ");
- bf.append(filtro.getRuoloFruitore());
- }
- else if( !(filtro.getServizioApplicativoFruitore()==null || "".equals(filtro.getServizioApplicativoFruitore())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE_COMPACT).append(": ");
- bf.append(filtro.getServizioApplicativoFruitore());
- }
- }
-
- if(filtro.getTokenClaims()!=null){
- Properties properties = PropertiesUtilities.convertTextToProperties(filtro.getTokenClaims());
- if(properties!=null && properties.size()>0) {
- for (Object o : properties.keySet()) {
- if(o!=null && o instanceof String) {
- String key = (String) o;
- String value = properties.getProperty(key);
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TOKEN_CLAIMS_PREFIX).append(key).append(": ");
- bf.append(value);
- }
- }
- }
- }
-
- if(filtro.isInformazioneApplicativaEnabled()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED_COMPACT).append(": ");
- bf.append(filtro.getInformazioneApplicativaTipo());
- }
- }
- else{
- bf.append(CostantiControlStation.LABEL_STATO_DISABILITATO);
- }
- if(bf.length()<=0 && (delegata || applicativa)) {
- bf.append(CostantiControlStation.LABEL_STATO_DISABILITATO);
- }
-
- return bf.toString();
- }
-
- public String toStringCompactGroupBy(AttivazionePolicyRaggruppamento groupBy, RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding) {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- StringBuilder bf = new StringBuilder("");
- if(groupBy.isEnabled()){
- if(configurazione) {
- if(groupBy.isRuoloPorta()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RUOLO_PDD_LABEL);
- }
- }
-
- if(configurazione) {
- if(groupBy.isProtocollo()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_COMPACT);
- }
- }
-
- if(configurazione) {
- if(groupBy.isErogatore()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_EROGATORE_COMPACT);
- }
- }
-
- if(configurazione) {
- if(groupBy.isServizio()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SERVIZIO);
- }
- }
-
- if(groupBy.isAzione()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(this.getLabelAzione(serviceBinding));
- }
-
- if(configurazione) {
- if(groupBy.isServizioApplicativoErogatore()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_EROGATORE);
- }
- }
-
- if(configurazione) {
- if(groupBy.isFruitore()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_FRUITORE_COMPACT);
- }
- }
-
- if(configurazione) {
- if(groupBy.isServizioApplicativoFruitore()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_FRUITORE_COMPACT);
- }
- }
-
- if(!configurazione) {
- if(groupBy.isServizioApplicativoFruitore() || groupBy.isFruitore() || groupBy.isIdentificativoAutenticato()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RICHIEDENTE);
- }
- }
-
- if(groupBy.getToken()!=null){
- String [] tmp = groupBy.getToken().split(",");
- if(tmp!=null && tmp.length>0) {
- for (int i = 0; i < tmp.length; i++) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(tmp[i]);
- }
- }
- }
-
- if(groupBy.isInformazioneApplicativaEnabled()){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append("Chiave:");
- bf.append(groupBy.getInformazioneApplicativaTipo());
- }
- }
- else{
- bf.append(CostantiControlStation.LABEL_STATO_DISABILITATO);
- }
- return bf.toString();
- }
-
- public String readDatiGeneraliPolicyFromHttpParameters(ConfigurazionePolicy policy, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // id
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID);
- if(id!=null && !"".equals(id)){
- try{
- long l = Long.parseLong(id);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setId(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+id+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
-
- // risorsa
- String valoreDataElementRisorsa = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA);
- if(valoreDataElementRisorsa!=null && !"".equals(valoreDataElementRisorsa)){
- try{
- TipoRisorsa tipoRisorsa = this.getTipoRisorsa(valoreDataElementRisorsa, this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_ESITI));
- policy.setRisorsa(tipoRisorsa.getValue());
- policy.setSimultanee(this.isTipoRisorsaNumeroRichiesteSimultanee(valoreDataElementRisorsa));
- }catch(Exception e){
- String messaggio = "Il valore ("+valoreDataElementRisorsa+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA+"' non è tra i tipi di risorsa gestiti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public String readValoriSogliaPolicyFromHttpParameters(ConfigurazionePolicy policy, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
-
- // // richiesteSimultanee
- // String simultanee = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_RICHIESTE_SIMULTANEE);
- // if(first==false){
- // if(TipoRisorsa.NUMERO_RICHIESTE.getValue().equals(policy.getRisorsa())){
- // policy.setSimultanee(ServletUtils.isCheckBoxEnabled(simultanee));
- // }
- // else{
- // policy.setSimultanee(false);
- // }
- // }
-
-
- // valore della policy
- TipoRisorsa tipoRisorsa = null;
- try{
- tipoRisorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa(), true);
- }catch(Exception e){
- String messaggio = "Il valore ("+policy.getRisorsa()+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA+"' non è tra le risorse gestite";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
-
- if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa)){
- String tipoBanda = null;
- try{
- tipoBanda = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA);
- if(tipoBanda!=null && !"".equals(tipoBanda)){
- policy.setValoreTipoBanda(TipoBanda.toEnumConstant(tipoBanda, true));
- }
- else{
- if(policy.getValoreTipoBanda()==null){
- policy.setValoreTipoBanda(ConfigurazioneCostanti.TIPO_BANDA_DEFAULT);
- }
- }
- }catch(Exception e){
- String label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA;
- String messaggio = "Il valore ("+tipoBanda+") indicato in '"+label+"' non rientra tra i tipi conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- policy.setValoreTipoBanda(null);
- }
-
- if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa) || TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(tipoRisorsa)){
- String tipoLatenza = null;
- try{
- tipoLatenza = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_LATENZA);
- if(tipoLatenza!=null && !"".equals(tipoLatenza)){
- policy.setValoreTipoLatenza(TipoLatenza.toEnumConstant(tipoLatenza, true));
- }
- else{
- if(policy.getValoreTipoLatenza()==null){
- policy.setValoreTipoLatenza(ConfigurazioneCostanti.TIPO_LATENZA_DEFAULT);
- }
- }
- }catch(Exception e){
- String label = null;
- if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_TIPO_LATENZA;
- }
- else{
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_TIPO_LATENZA;
- }
- String messaggio = "Il valore ("+tipoLatenza+") indicato in '"+label+"' non rientra tra i tipi conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- policy.setValoreTipoLatenza(null);
- }
-
-
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE);
- if(valore!=null && !"".equals(valore)){
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
- try{
- int i = Integer.parseInt(valore);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore((long)i);
- }catch(Exception e){
- String label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL;
- String messaggio = "Il valore ("+valore+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else {
- try{
- long l = Long.parseLong(valore);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore(l);
- }catch(Exception e){
- String label = null;
- if(TipoRisorsa.NUMERO_RICHIESTE.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE;
- }
- else if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL;
- }
- else if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL;
- }
- else{
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL;
- }
- String messaggio = "Il valore ("+valore+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- else{
- if(!first){
- policy.setValore(null);
- }
- else {
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa) && policy.getValore()==null){
- policy.setValore((long)ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA);
- }
- }
- }
-
-
- if(policy.isSimultanee()==false && !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
-
- // Modalità di Controllo
- if(TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(policy.getRisorsa())){
- // è permesso solo il realtime
- policy.setModalitaControllo(TipoControlloPeriodo.REALTIME);
- }
- else{
- String modalitaControllo = null;
- try{
- modalitaControllo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO);
- if(modalitaControllo!=null && !"".equals(modalitaControllo)){
- policy.setModalitaControllo(TipoControlloPeriodo.toEnumConstant(modalitaControllo, true));
- }
-
- }catch(Exception e){
- String messaggio = "Il valore ("+modalitaControllo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO+"' non rientra tra le modalità conosciute";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
- // Intervallo Osservazione
- if(policy.getModalitaControllo()!=null){
-
- String tipoControlloPeriodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO);
- if(tipoControlloPeriodo!=null && !"".equals(tipoControlloPeriodo)){
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- try{
- policy.setTipoIntervalloOsservazioneRealtime(TipoPeriodoRealtime.toEnumConstant(tipoControlloPeriodo, true));
- }catch(Exception e){
- try{
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- if(TipoPeriodoStatistico.toEnumConstant(tipoControlloPeriodo, true)!=null){
- policy.setTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- }
- }catch(Exception eInterno){
- // NOTA: Viene registrato volutamente l'errore più esterno
- String messaggio = "Il valore ("+tipoControlloPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO+"' non rientra tra gli intervalli conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- else{
- try{
- policy.setTipoIntervalloOsservazioneStatistico(TipoPeriodoStatistico.toEnumConstant(tipoControlloPeriodo, true));
- }catch(Exception e){
- try{
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- if(TipoPeriodoRealtime.toEnumConstant(tipoControlloPeriodo, true)!=null){
- policy.setTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- }
- }catch(Exception eInterno){
- // NOTA: Viene registrato volutamente l'errore più esterno
- String messaggio = "Il valore ("+tipoControlloPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO+"' non rientra tra gli intervalli conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- }
-
- String periodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_PERIODO);
- if(periodo!=null && !"".equals(periodo)){
- try{
- int i = Integer.parseInt(periodo);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setIntervalloOsservazione(i);
- }catch(Exception e){
- String labelPeriodo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneRealtime());
- }else{
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneStatistico());
- }
- String messaggio = "Il valore ("+periodo+") indicato in '"+labelPeriodo+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(!first){
- policy.setIntervalloOsservazione(null);
- }
- }
-
- String finestraPeriodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO);
- if(finestraPeriodo!=null && !"".equals(finestraPeriodo)){
- boolean found = false;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME[i].equals(finestraPeriodo)){
- found = true;
- break;
- }
- }
- }
- else{
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO[i].equals(finestraPeriodo)){
- found = true;
- break;
- }
- }
- }
- if(found){
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- try{
- policy.setFinestraOsservazione(TipoFinestra.toEnumConstant(finestraPeriodo, true));
- }catch(Exception e){
- String messaggio = "Il valore ("+finestraPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO+"' non rientra tra le finestre conosciute";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- policy.setFinestraOsservazione(null);
- }
- }
-
-
- // Controllo se è stato cambiato il tipo di risorsa. In tal caso forzo il change del tipo di finestra
- String postBackElementName = this.getPostBackElementName();
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA.equals(postBackElementName) ||
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO.equals(postBackElementName)){
- if(policy.getFinestraOsservazione()!=null){
- policy.setFinestraOsservazione(null);
- }
- }
- }
- else{
- // reset
- policy.setModalitaControllo(ConfigurazioneCostanti.TIPO_CONTROLLO_PERIODO_DEFAULT);
- policy.setTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- policy.setTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- policy.setIntervalloOsservazione(null);
- policy.setFinestraOsservazione(null);
- }
-
- }
- else if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
-
- // Viene usata questa informazione per la dimensione della richiesta
- String valore2 = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_2);
- if(valore2!=null && !"".equals(valore2)){
- try{
- int i = Integer.parseInt(valore2);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore2((long)i);
- }catch(Exception e){
- String label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL;
- String messaggio = "Il valore ("+valore2+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(!first){
- policy.setValore2(null);
- }
- else {
- if(policy.getValore2()==null) {
- policy.setValore2(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA);
- }
- }
- }
-
- // reset
- policy.setModalitaControllo(ConfigurazioneCostanti.TIPO_CONTROLLO_PERIODO_DEFAULT);
- policy.setTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- policy.setTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- policy.setIntervalloOsservazione(null);
- policy.setFinestraOsservazione(null);
- }
- else{
- // reset
- policy.setModalitaControllo(ConfigurazioneCostanti.TIPO_CONTROLLO_PERIODO_DEFAULT);
- policy.setTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- policy.setTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- policy.setIntervalloOsservazione(null);
- policy.setFinestraOsservazione(null);
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public String readApplicabilitaPolicyFromHttpParameters(ConfigurazionePolicy policy, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
-
- TipoRisorsa tipoRisorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa());
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
- policy.setTipoApplicabilita(TipoApplicabilita.SEMPRE);
- return null;
- }
-
- // condizionale
- String condizionale = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_TIPO);
- if(first==false){
- if (ServletUtils.isCheckBoxEnabled(condizionale) ){
- policy.setTipoApplicabilita(TipoApplicabilita.CONDIZIONALE);
- }
- else{
- policy.setTipoApplicabilita(TipoApplicabilita.SEMPRE);
- }
- }
- else{
- if(policy.getTipoApplicabilita()==null)
- policy.setTipoApplicabilita(TipoApplicabilita.SEMPRE);
- }
-
-
- // con congestione in corso
- String congestioneInCorso = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE);
- if(first==false){
- policy.setApplicabilitaConCongestione(ServletUtils.isCheckBoxEnabled(congestioneInCorso));
- }
-
-
- // con degrado prestazionale
- String degradoPrestazionale = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE);
- if(first==false){
- policy.setApplicabilitaDegradoPrestazionale(ServletUtils.isCheckBoxEnabled(degradoPrestazionale));
- }
-
-
- // con stato allarme
- String statoAllarme = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME);
- if(first==false){
- policy.setApplicabilitaStatoAllarme(ServletUtils.isCheckBoxEnabled(statoAllarme));
- }
-
-
- // Degrado Prestazionale
- String messaggioErroreDegradoPrestazione = readApplicabilitaDegradoPrestazionalePolicyFromHttpParameters(policy, first);
- if(messaggioErroreDegradoPrestazione != null)
- this.addParsingError(sbParsingError, messaggioErroreDegradoPrestazione);
-
- // StatoAllarmi
- String messaggioErroreReadApplicabilita = readApplicabilitaStatoAllarmePolicyFromHttpParameters(policy, first);
- if(messaggioErroreReadApplicabilita != null)
- this.addParsingError(sbParsingError, messaggioErroreReadApplicabilita);
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- private String readApplicabilitaDegradoPrestazionalePolicyFromHttpParameters(ConfigurazionePolicy policy, boolean first) throws Exception {
- StringBuilder sbParsingError = new StringBuilder();
- // ** Degrado Prestazionale **
- if(policy.isApplicabilitaDegradoPrestazionale()){
-
- // Modalità di Controllo
- String modalitaControllo = null;
- try{
- modalitaControllo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO);
- if(modalitaControllo!=null && !"".equals(modalitaControllo)){
- policy.setDegradoAvgTimeModalitaControllo(TipoControlloPeriodo.toEnumConstant(modalitaControllo, true));
- }
- else{
- if(policy.getDegradoAvgTimeModalitaControllo()==null){
- policy.setDegradoAvgTimeModalitaControllo(ConfigurazioneCostanti.TIPO_CONTROLLO_PERIODO_DEFAULT);
- }
- }
- }catch(Exception e){
- String messaggio = "Il valore ("+modalitaControllo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO+"' non rientra tra le modalità conosciute";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
-
- // Tipo Latenza
- String tipoLatenza = null;
- try{
- tipoLatenza = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA);
- if(tipoLatenza!=null && !"".equals(tipoLatenza)){
- policy.setDegradoAvgTimeTipoLatenza(TipoLatenza.toEnumConstant(tipoLatenza, true));
- }
- else{
- if(policy.getDegradoAvgTimeTipoLatenza()==null){
- policy.setDegradoAvgTimeTipoLatenza(ConfigurazioneCostanti.TIPO_LATENZA_DEFAULT);
- }
- }
- }catch(Exception e){
- String messaggio = "Il valore ("+tipoLatenza+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA+"' non rientra tra i tipi conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- // Intervallo Osservazione
- String tipoControlloPeriodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO);
- if(tipoControlloPeriodo!=null && !"".equals(tipoControlloPeriodo)){
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- try{
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(TipoPeriodoRealtime.toEnumConstant(tipoControlloPeriodo, true));
- }catch(Exception e){
- try{
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- if(TipoPeriodoStatistico.toEnumConstant(tipoControlloPeriodo, true)!=null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- }
- }catch(Exception eInterno){
- // NOTA: Viene registrato volutamente l'errore più esterno
- String messaggio = "Il valore ("+tipoControlloPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO+"' non rientra tra gli intervalli conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- else{
- try{
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(TipoPeriodoStatistico.toEnumConstant(tipoControlloPeriodo, true));
- }catch(Exception e){
- try{
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- if(TipoPeriodoRealtime.toEnumConstant(tipoControlloPeriodo, true)!=null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- }
- }catch(Exception eInterno){
- // NOTA: Viene registrato volutamente l'errore più esterno
- String messaggio = "Il valore ("+tipoControlloPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO+"' non rientra tra gli intervalli conosciuti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- }
- else{
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime()==null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- }
- }
- else{
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico()==null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- }
- }
- }
-
- String periodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_PERIODO);
- if(periodo!=null && !"".equals(periodo)){
- try{
- int i = Integer.parseInt(periodo);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setDegradoAvgTimeIntervalloOsservazione(i);
- }catch(Exception e){
- String labelIntervallo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime());
- }
- else{
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico());
- }
- String messaggio = "Il valore ("+periodo+") indicato in '"+labelIntervallo+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(!first){
- policy.setDegradoAvgTimeIntervalloOsservazione(null);
- }
- }
-
- String finestraPeriodo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO);
- if(finestraPeriodo!=null && !"".equals(finestraPeriodo)){
- boolean found = false;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME[i].equals(finestraPeriodo)){
- found = true;
- break;
- }
- }
- }
- else{
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO[i].equals(finestraPeriodo)){
- found = true;
- break;
- }
- }
- }
- if(found){
- // Controllo se l'errore fosse dovuto al fatto che è stato cambiato la modalitù di controllo ed il valore presenta era per l'altra modalita
- try{
- policy.setDegradoAvgTimeFinestraOsservazione(TipoFinestra.toEnumConstant(finestraPeriodo, true));
- }catch(Exception e){
- String messaggio = "Il valore ("+finestraPeriodo+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO+"' non rientra tra le finestre conosciute";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- policy.setDegradoAvgTimeFinestraOsservazione(null);
- }
- }
-
- // Controllo se è stato cambiato il tipo di risorsa. In tal caso forzo il change del tipo di finestra
- String postBackElementName = this.getPostBackElementName();
- //if(ConfigurazioneCostanti.PARAMETRO_CONTROLLO_CONGESTIONE_POLICY_RISORSA.equals(postBackElementName) ||
- // La risorsa non impatta sul tipo di finestra di osservazione. Al massimo se viene scelta una risorsa dove non è previsto il controllo sul degrado sparisce tutto il degrado
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO.equals(postBackElementName)){
- if(policy.getDegradoAvgTimeFinestraOsservazione()!=null){
- policy.setDegradoAvgTimeFinestraOsservazione(null);
- }
- }
-
- }
- else{
-
- policy.setDegradoAvgTimeModalitaControllo(null);
- policy.setDegradoAvgTimeTipoLatenza(null);
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(null);
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(null);
- policy.setDegradoAvgTimeIntervalloOsservazione(null);
- policy.setDegradoAvgTimeFinestraOsservazione(null);
-
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- private String readApplicabilitaStatoAllarmePolicyFromHttpParameters(ConfigurazionePolicy policy, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
- // ** Degrado Prestazionale **
- if(policy.isApplicabilitaStatoAllarme()){
-
- // Nome
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME);
- if(nome!=null && !"".equals(nome) && !"-".equals(nome)){
- policy.setAllarmeNome(nome);
- }
-
- // Not Stato
- String statoNotAllarme = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOT_STATO);
- if(first==false){
- policy.setAllarmeNotStato(ServletUtils.isCheckBoxEnabled(statoNotAllarme));
- }
-
- // StatoAllarme
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO);
- if(stato!=null && !"".equals(stato)){
- try{
- int i = Integer.parseInt(stato);
- if(i<0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setAllarmeStato(i);
- }catch(Exception e){
- String messaggio = "Lo stato ("+stato+") selezionato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO+
- "' non risulta tra quelli gestiti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(policy.getAllarmeStato()==null){
- policy.setAllarmeStato(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_DEFAULT);
- }
- }
-
- }
- else{
-
- policy.setAllarmeNome(null);
- policy.setAllarmeNotStato(false);
- policy.setAllarmeStato(null);
-
- }
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public String getNomeSuggerito(ConfigurazionePolicy policy){
-
- StringBuilder bfSuggerimentoNome = new StringBuilder();
- bfSuggerimentoNome.append(policy.getRisorsa());
-
- TipoRisorsa risorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa());
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(risorsa)) {
- return bfSuggerimentoNome.toString();
- }
-
- if(policy.isSimultanee()){
- bfSuggerimentoNome.append("-").append("RichiesteSimultanee");
- }
- else{
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- bfSuggerimentoNome.append("-ControlloRealtime").
- append((policy.getTipoIntervalloOsservazioneRealtime().getValue().charAt(0)+"").toUpperCase()).
- append(policy.getTipoIntervalloOsservazioneRealtime().getValue().substring(1));
- }
- else{
- bfSuggerimentoNome.append("-ControlloStatistico").
- append((policy.getTipoIntervalloOsservazioneStatistico().getValue().charAt(0)+"").toUpperCase()).
- append(policy.getTipoIntervalloOsservazioneStatistico().getValue().substring(1));
- }
- }
- if(TipoApplicabilita.CONDIZIONALE.equals(policy.getTipoApplicabilita())){
- StringBuilder bfInterno = new StringBuilder();
- bfInterno.append("-Condizionale");
- if(policy.isApplicabilitaConCongestione()){
- bfInterno.append("-CongestioneTraffico");
- }
- if(policy.isApplicabilitaDegradoPrestazionale()){
- bfInterno.append("-DegradoPrestazionale");
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- bfInterno.append("Realtime").
- append((policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime().getValue().charAt(0)+"").toUpperCase()).
- append(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime().getValue().substring(1));
- }
- else{
- bfInterno.append("Statistico").
- append((policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico().getValue().charAt(0)+"").toUpperCase()).
- append(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico().getValue().substring(1));
- }
- }
- if(policy.isApplicabilitaStatoAllarme()){
- bfInterno.append("-StatoAllarme");
- }
- bfSuggerimentoNome.append(bfInterno.toString());
- }
- return bfSuggerimentoNome.toString();
-
- }
-
- public String getDescrizioneSuggerita(ConfigurazionePolicy policy) {
-
- StringBuilder bfSuggerimentoDescrizione = new StringBuilder();
-
- TipoRisorsa risorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa());
-
- StringBuilder bfIntervallo = new StringBuilder();
- if(!policy.isSimultanee() && !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(risorsa)){
- bfIntervallo.append(" durante l'intervallo di tempo specificato in ");
- if(policy.getIntervalloOsservazione()!=null)
- bfIntervallo.append(policy.getIntervalloOsservazione()).append(" ");
-
- TipoFinestra finestra = policy.getFinestraOsservazione();
- if(finestra==null){
- finestra = this.getTipoFinestraDefault(policy.getModalitaControllo(), policy.getRisorsa(), false);
- }
- String finestraDescrizione = "";
- if(finestra!=null){
- finestraDescrizione = ", finestra "+finestra.getValue();
- }
-
- String tipoRisorsa = "";
- if(risorsa!=null && TipoRisorsa.OCCUPAZIONE_BANDA.equals(risorsa)){
- TipoBanda banda = policy.getValoreTipoBanda();
- if(banda==null){
- banda = ConfigurazioneCostanti.TIPO_BANDA_DEFAULT;
- }
- if(banda!=null){
- tipoRisorsa = ", tipo banda "+banda.getValue();
- }
- }
- else if(risorsa!=null && (TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(risorsa) || TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(risorsa)) ){
- TipoLatenza latenza = policy.getValoreTipoLatenza();
- if(latenza==null){
- latenza = ConfigurazioneCostanti.TIPO_LATENZA_DEFAULT;
- }
- if(latenza!=null){
- tipoRisorsa = ", tipo latenza "+latenza.getValue();
- }
- }
-
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- switch (policy.getTipoIntervalloOsservazioneRealtime()) {
- case SECONDI:
- bfIntervallo.append("secondi");
- break;
- case MINUTI:
- bfIntervallo.append("minuti");
- break;
- case ORARIO:
- bfIntervallo.append("ore");
- break;
- case GIORNALIERO:
- bfIntervallo.append("giorni");
- break;
- }
- bfIntervallo.append(" (campionamento real-time").
- append(finestraDescrizione).
- append(tipoRisorsa).
- append(").");
- }
- else{
- switch (policy.getTipoIntervalloOsservazioneStatistico()) {
- case ORARIO:
- bfIntervallo.append("ore");
- break;
- case GIORNALIERO:
- bfIntervallo.append("giorni");
- break;
- case SETTIMANALE:
- bfIntervallo.append("settimane");
- break;
- case MENSILE:
- bfIntervallo.append("mesi");
- break;
- }
- bfIntervallo.append(" (campionamento statistico").
- append(finestraDescrizione).
- append(tipoRisorsa).
- append(").");
- }
- }
-
- if(risorsa!=null){
- switch (risorsa) {
- case NUMERO_RICHIESTE:
- bfSuggerimentoDescrizione.append("La policy limita il numero totale massimo di richieste ");
- if(policy.isSimultanee()){
- bfSuggerimentoDescrizione.append("simultanee ");
- }
- bfSuggerimentoDescrizione.append("consentite");
- if(policy.isSimultanee()){
- bfSuggerimentoDescrizione.append(".");
- }
- break;
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- bfSuggerimentoDescrizione.append("La policy limita la dimensione massima, in KB, consentita per una richiesta e/o per una risposta");
- break;
- case OCCUPAZIONE_BANDA:
- bfSuggerimentoDescrizione.append("La policy limita il numero totale massimo di KB consentiti");
- break;
- case TEMPO_MEDIO_RISPOSTA:
- bfSuggerimentoDescrizione.append("La policy blocca ogni successiva richiesta se viene rilevato un tempo medio di risposta elevato");
- break;
- case TEMPO_COMPLESSIVO_RISPOSTA:
- bfSuggerimentoDescrizione.append("La policy limita il numero totale massimo di secondi consentiti");
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- bfSuggerimentoDescrizione.append("La policy conteggia il numero di richieste completate con successo; raggiunto il limite, ogni successiva richiesta viene bloccata");
- break;
- case NUMERO_RICHIESTE_FALLITE:
- bfSuggerimentoDescrizione.append("La policy conteggia il numero di richieste fallite; raggiunto il limite, ogni successiva richiesta viene bloccata");
- break;
- case NUMERO_FAULT_APPLICATIVI:
- bfSuggerimentoDescrizione.append("La policy conteggia il numero di richieste che veicolano un fault applicativo; raggiunto il limite, ogni successiva richiesta viene bloccata");
- break;
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- bfSuggerimentoDescrizione.append("La policy conteggia il numero di richieste fallite o che veicolano un fault applicativo; raggiunto il limite, ogni successiva richiesta viene bloccata");
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- bfSuggerimentoDescrizione.append("La policy conteggia il numero di richieste completate con successo o che veicolano un fault applicativo; raggiunto il limite, ogni successiva richiesta viene bloccata");
- break;
- }
- }
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(risorsa)) {
- return bfSuggerimentoDescrizione.toString();
- }
-
-
- bfSuggerimentoDescrizione.append(bfIntervallo.toString());
-
-
- if(policy.isApplicabilitaConCongestione() || policy.isApplicabilitaDegradoPrestazionale() || policy.isApplicabilitaStatoAllarme()){
- bfSuggerimentoDescrizione.append("\nLa policy viene applicata solamente se ");
- StringBuilder bfApplicabilita = new StringBuilder();
- if(policy.isApplicabilitaConCongestione()){
- bfApplicabilita.append("il Gateway risulta Congestionato dalle richieste");
- }
- if(policy.isApplicabilitaDegradoPrestazionale()){
- if(bfApplicabilita.length()>0){
- bfApplicabilita.append(" ed ");
- }
-
- TipoFinestra finestra = policy.getDegradoAvgTimeFinestraOsservazione();
- if(finestra==null){
- finestra = this.getTipoFinestraDefault(policy.getDegradoAvgTimeModalitaControllo(), policy.getRisorsa(), true);
- }
- String finestraDescrizione = "";
- if(finestra!=null){
- finestraDescrizione = ", finestra "+finestra.getValue();
- }
-
- String tipoRisorsa = "";
- TipoLatenza latenza = policy.getDegradoAvgTimeTipoLatenza();
- if(latenza==null){
- latenza = ConfigurazioneCostanti.TIPO_LATENZA_DEFAULT;
- }
- if(latenza!=null){
- tipoRisorsa = ", tipo latenza "+latenza.getValue();
- }
-
- String intervalloDescrizione = "";
- if(policy.getDegradoAvgTimeModalitaControllo()!=null){
- intervalloDescrizione = ", intervallo di tempo specificato in ";
- if(policy.getDegradoAvgTimeIntervalloOsservazione()!=null){
- intervalloDescrizione+=policy.getDegradoAvgTimeIntervalloOsservazione();
- intervalloDescrizione+=" ";
- }
-
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- switch (policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime()) {
- case SECONDI:
- intervalloDescrizione+="secondi";
- break;
- case MINUTI:
- intervalloDescrizione+="minuti";
- break;
- case ORARIO:
- intervalloDescrizione+="ore";
- break;
- case GIORNALIERO:
- intervalloDescrizione+="giorni";
- break;
- }
- }
- else{
- switch (policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico()) {
- case ORARIO:
- intervalloDescrizione+="ore";
- break;
- case GIORNALIERO:
- intervalloDescrizione+="giorni";
- break;
- case SETTIMANALE:
- intervalloDescrizione+="settimane";
- break;
- case MENSILE:
- intervalloDescrizione+="mesi";
- break;
- }
- }
- }
-
- String tipoCampionamento = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- tipoCampionamento = "(campionamento realtime"+intervalloDescrizione+finestraDescrizione+tipoRisorsa+")";
- }
- else{
- tipoCampionamento = "(campionamento statistico"+intervalloDescrizione+finestraDescrizione+tipoRisorsa+")";
- }
- bfApplicabilita.append("il tempo medio di risposta del servizio "+tipoCampionamento+" risulta superiore ai livelli di soglia impostati");
- }
- if(policy.isApplicabilitaStatoAllarme()){
- if(bfApplicabilita.length()>0){
- bfApplicabilita.append(" e ");
- }
- bfApplicabilita.append("l'allarme selezionato soddisfa lo stato indicato");
- }
- bfApplicabilita.append(".");
- bfSuggerimentoDescrizione.append(bfApplicabilita.toString());
- }
- return bfSuggerimentoDescrizione.toString();
-
- }
-
- public TipoFinestra getTipoFinestraDefault(TipoControlloPeriodo modalitaControllo,String risorsa, boolean degrado){
- if(modalitaControllo!=null){
- if(TipoControlloPeriodo.REALTIME.equals(modalitaControllo)){
- if(degrado){
- return TipoFinestra.PRECEDENTE;
- }
- else if(risorsa!=null){
- TipoRisorsa tipo = TipoRisorsa.toEnumConstant(risorsa);
- if(tipo!=null){
- switch (tipo) {
- case NUMERO_RICHIESTE:
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- case OCCUPAZIONE_BANDA:
- case TEMPO_COMPLESSIVO_RISPOSTA:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- case NUMERO_RICHIESTE_FALLITE:
- case NUMERO_FAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- return TipoFinestra.CORRENTE;
- case TEMPO_MEDIO_RISPOSTA:
- return TipoFinestra.PRECEDENTE;
- }
- }
- }
- }
- else{
- if(degrado){
- return TipoFinestra.SCORREVOLE;
- }
- else if(risorsa!=null){
- TipoRisorsa tipo = TipoRisorsa.toEnumConstant(risorsa);
- if(tipo!=null){
- switch (tipo) {
- case NUMERO_RICHIESTE:
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- case OCCUPAZIONE_BANDA:
- case TEMPO_COMPLESSIVO_RISPOSTA:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- case NUMERO_RICHIESTE_FALLITE:
- case NUMERO_FAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- return TipoFinestra.CORRENTE;
- case TEMPO_MEDIO_RISPOSTA:
- return TipoFinestra.SCORREVOLE;
- }
- }
- }
- }
- }
- return null;
- }
-
- public void addConfigurazionePolicyToDati(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, boolean editMode, long numeroPolicyIstanziate,
- String oldNomeSuggeritoPolicy, String oldDDescrizioneSuggeritaPolicy, String oldPolicyId) throws Exception {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- if(policy.getId()!=null && policy.getId()>0){
- // id
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID);
- de.setValue(policy.getId()+"");
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(oldNomeSuggeritoPolicy !=null){
- // oldNomeSuggerito
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_OLD_NOME_SUGGERITO);
- de.setValue(oldNomeSuggeritoPolicy);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(oldDDescrizioneSuggeritaPolicy !=null){
- // oldNomeSuggerito
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_OLD_DESCRIZIONE_SUGGERITA);
- de.setValue(oldDDescrizioneSuggeritaPolicy);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(oldPolicyId !=null){
- // oldId
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_OLD_ID);
- de.setValue(oldPolicyId);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- /* Servono per le bradcump */
-
- // name
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME);
- de.setValue(policy.getIdPolicy());
- if(editMode) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- //de.setSize(consoleHelper.getSize());
- de.setSize(70);
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_DESCRIZIONE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_DESCRIZIONE);
- de.setValue(StringEscapeUtils.escapeHtml(policy.getDescrizione()));
- if(editMode) {
- de.setType(DataElementType.TEXT_AREA);
- de.setLabelAffiancata(true);
- de.setRequired(true);
- }
- else {
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- }
- de.setRows(6);
- de.setCols(55);
- //de.setCols(80);
- dati.add(de);
-
- // risorsa
- addDataElementRisorsa(dati,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA, getDataElementValueRisorsa(policy.getRisorsa(), policy.isSimultanee()),
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_ESITI, getDataElementValueRisorsaEsiti(policy.getRisorsa()),
- editMode);
-
- // Descrizione sul numero di policy attive
- if(!editMode && numeroPolicyIstanziate>0) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ISTANZIATA);
- String name = ( numeroPolicyIstanziate+" istanza");
- if(numeroPolicyIstanziate>1) {
- name = ( numeroPolicyIstanziate+" istanze");
- }
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ISTANZIATA_VALUE.
- replace(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ISTANZIATA_TEMPLATE,name));
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- public void addConfigurazionePolicyValoriSoglia(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, boolean editMode, boolean editOnlyValueMode) throws Exception {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_VALORI_SOGLIA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
-
- // // simultanee
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_RICHIESTE_SIMULTANEE);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_RICHIESTE_SIMULTANEE);
- // if(TipoRisorsa.NUMERO_RICHIESTE.getValue().equals(policy.getRisorsa())){
- // if(editMode) {
- // de.setType(DataElementType.CHECKBOX);
- // }
- // else {
- // de.setType(DataElementType.HIDDEN);
- // }
- // }
- // else{
- // de.setType(DataElementType.HIDDEN);
- // policy.setSimultanee(false);
- // }
- // de.setSelected(policy.isSimultanee());
- // de.setValue(policy.isSimultanee()+"");
- // de.setPostBack_viaPOST(true);
- // dati.add(de);
- //
- // if(TipoRisorsa.NUMERO_RICHIESTE.getValue().equals(policy.getRisorsa()) && !editMode){
- // // Il valore del parametor originale viene passato come hidden
- // // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_RICHIESTE_SIMULTANEE+
- // ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_RICHIESTE_SIMULTANEE);
- // if(policy.isSimultanee()) {
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- // }
- // else {
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- // }
- // de.setType(DataElementType.TEXT);
- // dati.add(de);
- // }
-
-
-
- if(policy.isSimultanee()==false && !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(policy.getRisorsa())){
-
- // Modalità di Controllo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO);
- if(TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(policy.getRisorsa())){
- de.setType(DataElementType.TEXT);
- policy.setModalitaControllo(TipoControlloPeriodo.REALTIME); // obbligatorio il realtime
- de.setValue(policy.getModalitaControllo().getValue());
- }else{
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.TIPI_CONTROLLO);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_CONTROLLO);
- if(policy.getModalitaControllo()!=null){
- de.setSelected(policy.getModalitaControllo().getValue());
- de.setValue(policy.getModalitaControllo().getValue());
- }
- }
- de.setPostBack_viaPOST(true);
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode) {
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_CONTROLLO);
- if(TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(policy.getRisorsa())){
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MODALITA_CONTROLLO_REALTIME);
- }
- else {
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MODALITA_CONTROLLO_REALTIME);
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MODALITA_CONTROLLO_STATISTICA);
- }
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
- }
-
- // valore della policy
- addToDatiPolicyValue(dati, policy, editMode, editOnlyValueMode);
-
-
- if(policy.isSimultanee()==false && !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(policy.getRisorsa())){
-
-
- // Intervallo Osservazione
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_INTERVALLO_OSSERVAZIONE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO);
- if(editMode) {
- de.setType(DataElementType.SELECT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- de.setValues(ConfigurazioneCostanti.TIPI_INTERVALLO_OSSERVAZIONE_REALTIME);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_INTERVALLO_OSSERVAZIONE_REALTIME);
- if(policy.getTipoIntervalloOsservazioneRealtime()!=null){
- de.setSelected(policy.getTipoIntervalloOsservazioneRealtime().getValue());
- de.setValue(policy.getTipoIntervalloOsservazioneRealtime().getValue());
- }
- }
- else{
- de.setValues(ConfigurazioneCostanti.TIPI_INTERVALLO_OSSERVAZIONE_STATISTICO);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_INTERVALLO_OSSERVAZIONE_STATISTICO);
- if(policy.getTipoIntervalloOsservazioneStatistico()!=null){
- de.setSelected(policy.getTipoIntervalloOsservazioneStatistico().getValue());
- de.setValue(policy.getTipoIntervalloOsservazioneStatistico().getValue());
- }
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(!editMode) {
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_TIPO_PERIODO);
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- switch (policy.getTipoIntervalloOsservazioneRealtime()) {
- case GIORNALIERO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_GIORNALIERO);
- break;
- case ORARIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_ORARIO);
- break;
- case MINUTI:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_MINUTI);
- break;
- case SECONDI:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_SECONDI);
- break;
- }
- }
- else {
- switch (policy.getTipoIntervalloOsservazioneStatistico()) {
- case MENSILE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_MENSILE);
- break;
- case SETTIMANALE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_SETTIMANALE);
- break;
- case GIORNALIERO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_GIORNALIERO);
- break;
- case ORARIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_ORARIO);
- break;
- }
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
-
- // Intervallo Osservazione (Soglia)
-
- String labelPeriodo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneRealtime());
- }else{
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneStatistico());
- }
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_PERIODO);
- de.setLabel(labelPeriodo);
- if(editMode) {
- de.setType(DataElementType.TEXT_EDIT);
- }else {
- de.setType(DataElementType.TEXT);
- }
- if(policy.getIntervalloOsservazione()!=null)
- de.setValue(policy.getIntervalloOsservazione()+"");
- if(editMode) {
- de.setRequired(true);
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
-
-
-
- // Intervallo Osservazione (Finestra)
-
- DataElement deNoEditMode = null;
- if(editMode==false) {
- deNoEditMode = new DataElement();
- deNoEditMode.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- deNoEditMode.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO);
- deNoEditMode.setType(DataElementType.TEXT);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_FINESTRA_PERIODO);
- if(editMode) {
- de.setType(DataElementType.SELECT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- setValueFinestra(de, deNoEditMode, policy.getModalitaControllo(), policy.getFinestraOsservazione(), policy.getRisorsa(), false);
- if(!editMode) {
- de.setRequired(false);
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(editMode==false) {
- dati.add(deNoEditMode);
- }
- }
- }
-
- private void setValueFinestra(DataElement de,DataElement deNoEditMode, TipoControlloPeriodo modalitaControllo, TipoFinestra finestra, String risorsa, boolean degrado){
- boolean found = false;
- if(TipoControlloPeriodo.REALTIME.equals(modalitaControllo)){
- de.setValues(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_FINESTRA_OSSERVAZIONE_REALTIME);
- if(finestra!=null){
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_REALTIME[i].equals(finestra.getValue())){
- found = true;
- break;
- }
- }
- }
- }
- else{
- de.setValues(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_FINESTRA_OSSERVAZIONE_STATISTICO);
- if(finestra!=null){
- for (int i = 0; i < ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO.length; i++) {
- if(ConfigurazioneCostanti.TIPI_FINESTRA_OSSERVAZIONE_STATISTICO[i].equals(finestra.getValue())){
- found = true;
- break;
- }
- }
- }
- }
- if(found){
- de.setSelected(finestra.getValue());
- de.setValue(finestra.getValue());
- if(deNoEditMode!=null) {
- switch (finestra) {
- case CORRENTE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_CORRENTE);
- break;
- case PRECEDENTE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_PRECEDENTE);
- break;
- case SCORREVOLE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_SCORREVOLE);
- break;
- }
- }
- }
- else{
- TipoFinestra tipoFinestraDefault = this.getTipoFinestraDefault(modalitaControllo, risorsa, degrado);
- if(tipoFinestraDefault!=null){
- de.setSelected(tipoFinestraDefault.getValue());
- de.setValue(tipoFinestraDefault.getValue());
- if(deNoEditMode!=null) {
- switch (tipoFinestraDefault) {
- case CORRENTE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_CORRENTE);
- break;
- case PRECEDENTE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_PRECEDENTE);
- break;
- case SCORREVOLE:
- deNoEditMode.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FINESTRA_OSSERVAZIONE_SCORREVOLE);
- break;
- }
- }
- }
- else{
- de.setSelectedAsNull();
- de.setValue(null);
- }
- }
- }
-
- private void addToDatiPolicyValue(List<DataElement> dati, ConfigurazionePolicy policy, boolean editMode, boolean editOnlyValueMode) throws Exception{
-
- TipoRisorsa tipoRisorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa(), true);
-
- if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa) ){
-
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA);
- if(editMode) {
- de.setType(DataElementType.SELECT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValues(ConfigurazioneCostanti.TIPI_BANDA);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_BANDA);
- if(policy.getValoreTipoBanda()!=null){
- de.setSelected(policy.getValoreTipoBanda().getValue());
- de.setValue(policy.getValoreTipoBanda().getValue());
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(!editMode) {
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_BANDA);
- switch (policy.getValoreTipoBanda()) {
- case COMPLESSIVA:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_BANDA_COMPLESSIVA);
- break;
- case INTERNA:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_BANDA_INTERNA);
- break;
- case ESTERNA:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_BANDA_ESTERNA);
- break;
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
- }
-
- if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa) || TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(tipoRisorsa)){
-
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_LATENZA);
- if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_TIPO_LATENZA);
- }
- else{
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_TIPO_LATENZA);
- }
- if(editMode) {
- de.setType(DataElementType.SELECT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValues(ConfigurazioneCostanti.TIPI_LATENZA);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_LATENZA);
- if(policy.getValoreTipoLatenza()!=null){
- de.setSelected(policy.getValoreTipoLatenza().getValue());
- de.setValue(policy.getValoreTipoLatenza().getValue());
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(!editMode) {
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TIPO_LATENZA+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_TIPO_LATENZA);
- }
- else{
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_TIPO_LATENZA);
- }
- switch (policy.getValoreTipoLatenza()) {
- case TOTALE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_TOTALE);
- break;
- // Porta non usato
- // case PORTA:
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_PORTA);
- // break;
- case SERVIZIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_SERVIZIO);
- break;
- case PORTA:
- break;
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
- }
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa) ){
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_2);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL);
- if(editMode || editOnlyValueMode) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- if(policy.getValore2()!=null){
- de.setValue(policy.getValore2()+"");
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
- }
-
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE);
- switch (tipoRisorsa) {
- case NUMERO_RICHIESTE:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- break;
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_NOTE);
- break;
- case OCCUPAZIONE_BANDA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_NOTE);
- break;
- case TEMPO_MEDIO_RISPOSTA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_NOTE);
- break;
- case TEMPO_COMPLESSIVO_RISPOSTA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_NOTE);
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_NOTE);
- break;
- case NUMERO_RICHIESTE_FALLITE:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_FALLITE_NOTE);
- break;
- case NUMERO_FAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_FAULT_APPLICATIVI_NOTE);
- break;
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_FALLITE_O_FAULT_APPLICATIVI_NOTE);
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_O_FAULT_APPLICATIVI_NOTE);
- break;
- }
- if(editMode || editOnlyValueMode) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- if(policy.getValore()!=null){
- de.setValue(policy.getValore()+"");
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
-
- if(!editMode) {
-
- if(editOnlyValueMode) {
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_MODIFICATO_CON_ISTANZE_ATTIVE_MODIFICA_EFFETTIVA);
- de.setType(DataElementType.HIDDEN);
- de.setValue(Costanti.CHECK_BOX_ENABLED);
- dati.add(de);
-
- }
- else {
-
- // Link modifica
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_MODIFICATO_CON_ISTANZE_ATTIVE_RICHIESTA_MODIFICA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_MODIFICATO_CON_ISTANZE_ATTIVE_RICHIESTA_MODIFICA);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_MODIFICATO_CON_ISTANZE_ATTIVE_RICHIESTA_MODIFICA);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_CONFIGURAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_MODIFICATO_CON_ISTANZE_ATTIVE_RICHIESTA_MODIFICA,Costanti.CHECK_BOX_ENABLED));
- de.setType(DataElementType.LINK);
- dati.add(de);
-
- }
- }
- }
-
- public void addConfigurazionePolicyApplicabilitaToDati(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, ConfigurazioneControlloTraffico controlloTraffico, boolean editMode) throws Exception {
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(policy.getRisorsa())){
- return;
- }
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_APPLICABILITA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
-
- // condizionale
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_TIPO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_TIPO);
- boolean condizionata = TipoApplicabilita.CONDIZIONALE.equals(policy.getTipoApplicabilita());
- if(editMode) {
- de.setType(DataElementType.CHECKBOX);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setSelected(condizionata);
- de.setValue(condizionata+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(!editMode){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_TIPO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_TIPO);
- if(condizionata) {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
- // con congestione in corso
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE);
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_LABEL);
- //de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- if(condizionata){
- if(editMode) {
- de.setType(DataElementType.CHECKBOX);
-
- DataElementInfo dInfoDescrizioneCongestione = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_LABEL);
- dInfoDescrizioneCongestione.setHeaderBody(replaceToHtmlSeparator(this.getApplicabilitaConCongestione(controlloTraffico)));
- de.setInfo(dInfoDescrizioneCongestione);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setApplicabilitaConCongestione(false);
- }
- de.setSelected(policy.isApplicabilitaConCongestione());
- de.setValue(policy.isApplicabilitaConCongestione()+"");
- dati.add(de);
-
- if(!editMode && condizionata){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- if(policy.isApplicabilitaConCongestione()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- // con degrado prestazionale
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE);
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_LABEL);
- //de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- if(condizionata &&
- !TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(policy.getRisorsa()) &&
- !TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(policy.getRisorsa())
- ){
- if(editMode) {
- de.setType(DataElementType.CHECKBOX);
- DataElementInfo dInfoDescrizioneDegrado = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_LABEL);
- dInfoDescrizioneDegrado.setHeaderBody(replaceToHtmlSeparator(this.getApplicabilitaDegradoPrestazionale()));
- de.setInfo(dInfoDescrizioneDegrado);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setApplicabilitaDegradoPrestazionale(false);
- }
- de.setSelected(policy.isApplicabilitaDegradoPrestazionale());
- de.setValue(policy.isApplicabilitaDegradoPrestazionale()+"");
- dati.add(de);
-
- if(!editMode && condizionata &&
- !TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(policy.getRisorsa()) &&
- !TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(policy.getRisorsa()) ) {
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- if(policy.isApplicabilitaDegradoPrestazionale()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- // con stato allarme
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME);
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_LABEL);
- //de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE);
- de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE);
- if(condizionata && this.confCore.isConfigurazioneAllarmiEnabled()){
- if(editMode) {
- de.setType(DataElementType.CHECKBOX);
-
- DataElementInfo dInfoDescrizioneAllarmi = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_LABEL);
- dInfoDescrizioneAllarmi.setHeaderBody(replaceToHtmlSeparator(this.getApplicabilitaAllarmi()));
- de.setInfo(dInfoDescrizioneAllarmi);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setApplicabilitaStatoAllarme(false);
- }
- de.setSelected(policy.isApplicabilitaStatoAllarme());
- de.setValue(policy.isApplicabilitaStatoAllarme()+"");
- dati.add(de);
-
- if(!editMode && condizionata && this.confCore.isConfigurazioneAllarmiEnabled()){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- if(policy.isApplicabilitaStatoAllarme()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE);
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- // ConCongestione
- //addToApplicabilitaConCongestione(dati, tipoOperazione, policy, controlloTraffico, editMode);
-
- // Degrado Prestazionale
- addToApplicabilitaDegradoPrestazionale(dati, tipoOperazione, policy , editMode);
-
- // StatoAllarme
- addToApplicabilitaStatoAllarme(dati, tipoOperazione, policy , editMode);
- }
-
- // Metodo soppiantato dall'info
- @SuppressWarnings("unused")
- private void addToApplicabilitaConCongestione(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, ConfigurazioneControlloTraffico controlloTraffico, boolean editMode) throws Exception {
-
- if(policy.isApplicabilitaConCongestione()){
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONGESTIONE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // Note
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setRows(4);
- de.setCols(55);
- de.setValue(this.getApplicabilitaConCongestione(controlloTraffico));
- dati.add(de);
- }
-
- }
-
- private String getApplicabilitaConCongestione(ConfigurazioneControlloTraffico controlloTraffico) {
-
- String result = null;
-
- if(controlloTraffico.isControlloCongestioneEnabled()){
-
- Integer soglia = controlloTraffico.getControlloCongestioneThreshold();
- Long numeroThreadCongestionamento = null;
- Long numeroThreadComplessivi = controlloTraffico.getControlloMaxThreadsSoglia();
-
- double numD = numeroThreadComplessivi.doubleValue();
- double totale = 100d;
- double sogliaD = soglia.doubleValue();
- Double numeroThreadCongestionamentoD = (numD / totale) * sogliaD;
- numeroThreadCongestionamento = numeroThreadCongestionamentoD.longValue();
-
- result = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE_CONGESTION_ACTIVE_AS_TEXT.
- replace(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE_NUMERO, numeroThreadCongestionamento+"");
- }
- else{
-
- result = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE_CONGESTION_NOT_ACTIVE_AS_TEXT;
-
- }
-
- return result;
- }
-
- @SuppressWarnings("incomplete-switch")
- private void addToApplicabilitaDegradoPrestazionale(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, boolean editMode) throws Exception {
-
- if(policy.isApplicabilitaDegradoPrestazionale()){
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DEGRADO_PRESTAZIONALE);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // Spostato nell'info
- // // Note
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- // de.setValue(this.getApplicabilitaDegradoPrestazionale());
- // de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- // de.setRows(6);
- // de.setCols(55);
- // dati.add(de);
- }
-
- // Modalità di Controllo
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO);
- if(policy.isApplicabilitaDegradoPrestazionale()){
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.TIPI_CONTROLLO);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_CONTROLLO);
- if(policy.getDegradoAvgTimeModalitaControllo()==null){
- policy.setDegradoAvgTimeModalitaControllo(ConfigurazioneCostanti.TIPO_CONTROLLO_PERIODO_DEFAULT);
- }
- de.setSelected(policy.getDegradoAvgTimeModalitaControllo().getValue());
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setDegradoAvgTimeModalitaControllo(null);
- }
- if(policy.getDegradoAvgTimeModalitaControllo()!=null){
- de.setValue(policy.getDegradoAvgTimeModalitaControllo().getValue());
- }
- else{
- de.setValue(null);
- }
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaDegradoPrestazionale()){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_CONTROLLO);
- switch (policy.getDegradoAvgTimeModalitaControllo()) {
- case REALTIME:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MODALITA_CONTROLLO_REALTIME);
- break;
- case STATISTIC:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_MODALITA_CONTROLLO_STATISTICA);
- break;
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
- // Tipo Latenza
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA);
- if(policy.isApplicabilitaDegradoPrestazionale()){
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.TIPI_LATENZA);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_LATENZA);
- if(policy.getDegradoAvgTimeTipoLatenza()==null){
- policy.setDegradoAvgTimeTipoLatenza(ConfigurazioneCostanti.TIPO_LATENZA_DEFAULT);
- }
- de.setSelected(policy.getDegradoAvgTimeTipoLatenza().getValue());
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setDegradoAvgTimeTipoLatenza(null);
- }
- if(policy.getDegradoAvgTimeTipoLatenza()!=null){
- de.setValue(policy.getDegradoAvgTimeTipoLatenza().getValue());
- }
- else{
- de.setValue(null);
- }
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaDegradoPrestazionale()){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_LATENZA);
- switch (policy.getDegradoAvgTimeTipoLatenza()) {
- case TOTALE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_TOTALE);
- break;
- // Non supportato
- // case PORTA:
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_PORTA);
- // break;
- case SERVIZIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_LATENZA_SERVIZIO);
- break;
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
- // Intervallo Osservazione
-
- if(policy.isApplicabilitaDegradoPrestazionale()){
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_INTERVALLO_OSSERVAZIONE);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO);
- if(policy.isApplicabilitaDegradoPrestazionale()){
- de.setType(DataElementType.SELECT);
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- de.setValues(ConfigurazioneCostanti.TIPI_INTERVALLO_OSSERVAZIONE_REALTIME);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_INTERVALLO_OSSERVAZIONE_REALTIME);
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime()==null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(ConfigurazioneCostanti.TIPO_PERIODO_REALTIME_DEFAULT);
- }
- de.setSelected(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime().getValue());
- }
- else{
- de.setValues(ConfigurazioneCostanti.TIPI_INTERVALLO_OSSERVAZIONE_STATISTICO);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPI_INTERVALLO_OSSERVAZIONE_STATISTICO);
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico()==null){
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(ConfigurazioneCostanti.TIPO_PERIODO_STATISTICO_DEFAULT);
- }
- de.setSelected(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico().getValue());
- }
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneRealtime(null);
- policy.setDegradoAvgTimeTipoIntervalloOsservazioneStatistico(null);
- }
- if(policy.getDegradoAvgTimeModalitaControllo()!=null){
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime()!=null){
- de.setValue(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime().getValue());
- }
- else{
- de.setValue(null);
- }
- }
- else{
- if(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico()!=null){
- de.setValue(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico().getValue());
- }
- else{
- de.setValue(null);
- }
- }
- }
- else{
- de.setValue(null);
- }
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaDegradoPrestazionale()){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_TIPO_PERIODO);
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- switch (policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime()) {
- case GIORNALIERO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_GIORNALIERO);
- break;
- case ORARIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_ORARIO);
- break;
- case MINUTI:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_MINUTI);
- break;
- case SECONDI:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_SECONDI);
- break;
- }
- }
- else {
- switch (policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico()) {
- case MENSILE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_MENSILE);
- break;
- case SETTIMANALE:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_SETTIMANALE);
- break;
- case GIORNALIERO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_GIORNALIERO);
- break;
- case ORARIO:
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_TIPO_PERIODO_ORARIO);
- break;
- }
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
- // Intervallo Osservazione (Soglia)
- String labelIntervallo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime());
- }
- else{
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico());
- }
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_PERIODO);
- de.setLabel(labelIntervallo);
- if(policy.isApplicabilitaDegradoPrestazionale()){
- if(editMode) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- }else {
- de.setType(DataElementType.TEXT);
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setDegradoAvgTimeIntervalloOsservazione(null);
- }
- if(policy.getDegradoAvgTimeIntervalloOsservazione()!=null){
- de.setValue(policy.getDegradoAvgTimeIntervalloOsservazione()+"");
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
-
-
-
- // Intervallo Osservazione (Finestra)
-
- DataElement deNoEditMode = null;
- if(editMode==false) {
- deNoEditMode = new DataElement();
- deNoEditMode.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- deNoEditMode.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO);
- deNoEditMode.setType(DataElementType.TEXT);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_FINESTRA_PERIODO);
- if(editMode) {
- de.setType(DataElementType.SELECT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- setValueFinestra(de, deNoEditMode, policy.getDegradoAvgTimeModalitaControllo(), policy.getDegradoAvgTimeFinestraOsservazione(), policy.getRisorsa(), true);
- if(!editMode) {
- de.setRequired(false);
- }
- if(policy.isApplicabilitaDegradoPrestazionale()==false){
- de.setType(DataElementType.HIDDEN);
- }
- else{
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
- if(editMode==false && policy.isApplicabilitaDegradoPrestazionale()) {
- dati.add(deNoEditMode);
- }
-
-
- }
-
- private String getApplicabilitaDegradoPrestazionale() {
-
- String result = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE_AS_TEXT;
- return result;
-
- }
-
- private void addToApplicabilitaStatoAllarme(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazionePolicy policy, boolean editMode) throws Exception {
-
- if(policy.isApplicabilitaStatoAllarme()){
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ALLARME);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // // Note
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE);
- // de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE_AS_TEXT);
- // de.setType(DataElementType.TEXT);
- //// de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- //// de.setRows(6);
- //// de.setCols(80);
- // dati.add(de);
- }
-
- List<String> allarmi_id = null;
- List<String> allarmi_alias = null;
- if(policy.isApplicabilitaStatoAllarme()){
- try{
- // Permetto di creare policy legate solamente a allarmi globali
- List<Allarme> listAllarmiGlobali = this.confCore.allarmiSenzaPluginList(new ConsoleSearch(true), null, null);
- if(listAllarmiGlobali!=null && !listAllarmiGlobali.isEmpty()) {
- allarmi_id = new ArrayList<>();
- allarmi_alias = new ArrayList<>();
- for (Allarme allarme : listAllarmiGlobali) {
- allarmi_id.add(allarme.getNome());
- allarmi_alias.add(allarme.getAlias());
- }
- }
- }catch(Exception eError){
- this.logError(eError.getMessage(),eError);
- }
- }
- if(allarmi_id==null){
- allarmi_id = new ArrayList<>();
- }
-
- if(policy.isApplicabilitaStatoAllarme() && allarmi_id.size()<=0){
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_NON_ESISTENTI);
- de.setType(DataElementType.NOTE);
- dati.add(de);
- }
-
- // Nome
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME);
- if(policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- String [] values = null;
- String [] labels = null;
- int index = 0;
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
- values = new String[allarmi_id.size()];
- labels = new String[allarmi_alias.size()];
- }
- else{
- values = new String[allarmi_id.size() + 1];
- labels = new String[allarmi_alias.size() + 1];
- values[0] = "-";
- labels[0] = "-";
- index = 1;
- }
- for (int i = 0; i < allarmi_id.size(); i++) {
- values[index] = allarmi_id.get(i);
- labels[index++] = allarmi_alias.get(i);
- }
- de.setType(DataElementType.SELECT);
- de.setValues(values);
- de.setLabels(labels);
- if(policy.getAllarmeNome()!=null){
- de.setSelected(policy.getAllarmeNome());
- }
- else{
- de.setSelected("-");
- }
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setAllarmeNome(null);
- }
- de.setValue(policy.getAllarmeNome());
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME);
- de.setValue(policy.getAllarmeNome());
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
- // NotStato
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOT_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOT_STATO);
- if(policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- if(editMode) {
- de.setType(DataElementType.CHECKBOX);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setAllarmeNotStato(false);
- }
- de.setSelected(policy.isAllarmeNotStato());
- de.setValue(policy.isAllarmeNotStato()+"");
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOT_STATO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOT_STATO);
- if(policy.isAllarmeNotStato()) {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
-
- // Stato
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO);
- if(policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.CONFIGURAZIONE_STATI_ALLARMI);
- de.setLabels(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATI_ALLARMI);
- if(policy.getAllarmeStato()==null){
- policy.setAllarmeStato(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_DEFAULT);
- }
- de.setSelected(policy.getAllarmeStato()+"");
- }
- else{
- de.setType(DataElementType.HIDDEN);
- policy.setAllarmeStato(null);
- }
- if(policy.getAllarmeStato()!=null){
- de.setSelected(policy.getAllarmeStato()+"");
- }
- else{
- de.setValue(null);
- }
- if(!editMode) {
- de.setType(DataElementType.HIDDEN);
- }
- dati.add(de);
-
- if(!editMode && policy.isApplicabilitaStatoAllarme() && allarmi_id.size()>0){
- // Il valore del parametor originale viene passato come hidden
- // L'elemento seguente serve solo come presentation, infatti il nome del parametro termina con un suffisso noEdit
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO+
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NO_EDIT_SUFFIX);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_STATO);
- if(policy.getAllarmeStato()!=null) {
- if(policy.getAllarmeStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_OK) {
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- }
- else if(policy.getAllarmeStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_WARNING) {
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- }
- else {
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- }
- }
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- private String getApplicabilitaAllarmi() {
-
- String result = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOTE_AS_TEXT;
- return result;
-
- }
-
- public String getLabel(TipoPeriodoRealtime tipo){
- if(tipo==null){
- return "Valore";
- }
- switch (tipo) {
- case SECONDI:
- return "Secondi";
- case MINUTI:
- return "Minuti";
- case ORARIO:
- return "Ore";
- case GIORNALIERO:
- return "Giorni";
- default:
- return "Valore";
- }
- }
- public String getLabel(TipoPeriodoStatistico tipo){
- if(tipo==null){
- return "Valore";
- }
- switch (tipo) {
- case ORARIO:
- return "Ore";
- case GIORNALIERO:
- return "Giorni";
- case SETTIMANALE:
- return "Settimane";
- case MENSILE:
- return "Mesi";
- default:
- return "Valore";
- }
- }
-
- public boolean configurazionePolicyCheckData(StringBuilder sbParsingError, TipoOperazione tipoOperazione, org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico, ConfigurazionePolicy policyToCheck,
- String oldNomeSuggeritoPolicy, String oldDescrizioneSuggeritaPolicy, String oldPolicyId, List<AttivazionePolicy> listPolicyAttiveConStatoDisabilitato,
- boolean updateValueInSeguitoModificaSogliaPolicy) throws Exception{
-
- // errori di parsing letti durante la read della richiesta
- if(sbParsingError.length() >0){
- this.pd.setMessage(sbParsingError.toString());
- return false;
- }
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
-
- long count = 0;
- String id = null;
- if(oldPolicyId!=null){
- id = oldPolicyId;
- }
- else{
- id = policyToCheck.getIdPolicy();
- }
- count = this.confCore.countInUseAttivazioni(id);
- if(count>0){
- String messaggio = "Non è possibile modificare la policy '"+id+"' essendo utilizzata in "+count+" istanze di "+ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING;
- boolean modificaVolutaUtente = listPolicyAttiveConStatoDisabilitato != null && !listPolicyAttiveConStatoDisabilitato.isEmpty();
- long countPolicyNonDisabilitate = this.confCore.countInUseAttivazioni(id, true);
- if(countPolicyNonDisabilitate>0 && !modificaVolutaUtente ) {
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
- }
-
- ConfigurazionePolicy p = null;
- try{
- p = this.confCore.getConfigurazionePolicy(policyToCheck.getIdPolicy());
- }catch(DriverControlStationNotFound e) {
- // ignore
- }catch(Exception e){
- throw e;
- }
-
- if(p!=null){
-
- if(TipoOperazione.ADD.equals(tipoOperazione) || (p.getId()!=null && policyToCheck.getId()!=null && p.getId().longValue()!=policyToCheck.getId().longValue())){
- String messaggio = "Esiste già una policy con nome '"+policyToCheck.getIdPolicy()+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
- return this.checkConfigurazionePolicy(configurazioneControlloTraffico,policyToCheck);
- }
-
-
- public boolean checkConfigurazionePolicy(org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale c,ConfigurazionePolicy policy) throws Exception{
-
- // Dati Generali
- if(policy.getIdPolicy()==null || "".equals(policy.getIdPolicy())){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // Nome
- if (!RegularExpressionEngine.isMatch(policy.getIdPolicy(),"^[\\-\\._A-Za-z0-9]*$")) {
- String messaggio = "Il nome indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME+
- "' puo' contenere solamente caratteri [A-Za-z], numeri [0-9] e i simboli '-','.' e '_'";
- this.pd.setMessage(messaggio);
- return false;
- }
- if(this.checkLength255(policy.getIdPolicy(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_NOME)==false) {
- return false;
- }
-
- // Descrizione
- if(policy.getDescrizione()==null || "".equals(policy.getDescrizione())){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_DESCRIZIONE+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // Valori di Soglia
- TipoRisorsa tipoRisorsa = null;
- try{
- tipoRisorsa = TipoRisorsa.toEnumConstant(policy.getRisorsa(), true);
- }catch(Exception e){
- this.pd.setMessage(e.getMessage());
- return false;
- }
- String name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE;
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL;
- }
- else if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL;
- }
- else if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL;
- }
- else if(TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL;
- }
- if(policy.getValore()==null) { //|| "".equals(policy.getValore())){
- String messaggio = "Deve essere indicato un valore in '"+name+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- long l = policy.getValore();
- try{
- if(l<0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- }catch(Exception e){
- String messaggio = "Il valore ("+policy.getValore()+") indicato in '"+name+"' deve essere un numero intero maggiore o uguale a 0";
- this.pd.setMessage(messaggio);
- return false;
- }
- if(TipoRisorsa.NUMERO_RICHIESTE.equals(tipoRisorsa) && policy.isSimultanee()){
- if(c.getControlloTraffico().isControlloMaxThreadsEnabled()) {
- if(l > c.getControlloTraffico().getControlloMaxThreadsSoglia()){
- String messaggio = "Deve essere indicato un valore in '"+name+
- "' minore di quanto indicato nella configurazione generale alla voce '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
- }
-
- if(policy.isSimultanee()==false && !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
- if(policy.getIntervalloOsservazione()==null){
- String labelPeriodo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getModalitaControllo())){
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneRealtime());
- }else{
- labelPeriodo = this.getLabel(policy.getTipoIntervalloOsservazioneStatistico());
- }
- String messaggio = "Deve essere indicato un valore in '"+labelPeriodo+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
-
- String labelDimensione = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL;
-
- if(policy.getValore2()==null) { //|| "".equals(policy.getValore())){
- String messaggio = "Deve essere indicato un valore in '"+labelDimensione+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- try{
- long i = policy.getValore2();
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- }catch(Exception e){
- String messaggio = "Il valore ("+policy.getValore2()+") indicato in '"+labelDimensione+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
-
- // Applicabilita
-
- if(TipoApplicabilita.CONDIZIONALE.equals(policy.getTipoApplicabilita())){
-
- if(!policy.isApplicabilitaConCongestione() &&
- !policy.isApplicabilitaDegradoPrestazionale() &&
- !policy.isApplicabilitaStatoAllarme()){
- String messaggio = "Deve essere selezionato almeno un criterio di applicabilità della Policy";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- }
-
- if(policy.isApplicabilitaDegradoPrestazionale()){
-
- if(policy.getDegradoAvgTimeIntervalloOsservazione()==null){
- String labelIntervallo = null;
- if(TipoControlloPeriodo.REALTIME.equals(policy.getDegradoAvgTimeModalitaControllo())){
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneRealtime());
- }
- else{
- labelIntervallo = this.getLabel(policy.getDegradoAvgTimeTipoIntervalloOsservazioneStatistico());
- }
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_DEGRADO_PRESTAZIONALE
- +" - "+labelIntervallo+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- }
-
- if(policy.isApplicabilitaStatoAllarme()){
- List<String> allarmi = null;
- try{
- List<Allarme> listAllarmiGlobali = this.confCore.allarmiSenzaPluginList(new ConsoleSearch(true), null, null);
- if(listAllarmiGlobali!=null && !listAllarmiGlobali.isEmpty()) {
- allarmi = new ArrayList<>();
- for (Allarme allarme : listAllarmiGlobali) {
- allarmi.add(allarme.getNome());
- }
- }
- }catch(Exception eError){
- this.logError(eError.getMessage(),eError);
- }
- if(allarmi==null || allarmi.size()<=0){
- String messaggio = "Non risultano attivi allarmi; disabilitare l'opzione '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_LABEL+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- else{
- if(policy.getAllarmeNome()==null || "".equals(policy.getAllarmeNome()) || "-".equals(policy.getAllarmeNome())) {
- String messaggio = "Selezionare uno degli allarmi indicati in '"+ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ALLARME
- +" - "+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_STATO_ALLARME_NOME+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
- }
- return true;
- }
-
-
- public String readDatiAttivazionePolicyFromHttpParameters(AttivazionePolicy policy, boolean first, TipoOperazione tipoOperazione, InfoPolicy infoPolicy) throws Exception{
-
- StringBuilder sbParsingError = new StringBuilder();
- // id
- String id = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID);
- if(id!=null && !"".equals(id)){
- try{
- long l = Long.parseLong(id);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setId(l);
- }catch(Exception e){
- String messaggio = "Il valore ("+id+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
- // alias
- String alias = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ALIAS);
- if(alias!=null && !"".equals(alias)){
- policy.setAlias(alias);
- }
- else {
- if(!first) {
- policy.setAlias(null);
- }
- }
-
- // stato
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ENABLED);
- if(stato!=null && !"".equals(stato)){
- policy.setEnabled(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO.equalsIgnoreCase(stato) || ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY.equalsIgnoreCase(stato));
- policy.setWarningOnly(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY.equalsIgnoreCase(stato));
- }
- else{
- if(TipoOperazione.ADD.equals(tipoOperazione)){
- policy.setEnabled(true); // default
- policy.setWarningOnly(false); // default
- }
- }
-
- // continue
- String continueS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- if(continueS!=null && !"".equals(continueS)){
- policy.setContinuaValutazione(Boolean.valueOf(continueS));
- }
- else {
- if(TipoOperazione.ADD.equals(tipoOperazione)){
- policy.setContinuaValutazione(false); // default
- }
- }
-
-
- // ridefinisci
- String ridefinisci = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_RIDEFINISCI);
- if(first==false){
- policy.setRidefinisci(ServletUtils.isCheckBoxEnabled(ridefinisci));
- }
-
-
- if(infoPolicy!=null){
-
- TipoRisorsa tipoRisorsa = infoPolicy.getTipoRisorsa();
-
- // valore
- String valore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VALORE);
- if(valore!=null && !"".equals(valore)){
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- try{
- Integer i = Integer.parseInt(valore);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore((long)i);
- }catch(Exception e){
- String label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL;
- String messaggio = "Il valore ("+valore+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else {
- try{
- long l = Long.parseLong(valore);
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore(l);
- }catch(Exception e){
- String label = null;
- if(TipoRisorsa.NUMERO_RICHIESTE.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE;
- }
- else if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL;
- }
- else if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL;
- }
- else{
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL;
- }
- String messaggio = "Il valore ("+valore+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Long.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- }
- else{
- if(!first){
- policy.setValore(null);
- }
- }
-
- // valore2
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- String valore2 = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VALORE_2);
- if(valore2!=null && !"".equals(valore2)){
- try{
- Integer i = Integer.parseInt(valore2);
- if(i<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- policy.setValore2((long)i);
- }catch(Exception e){
- String label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL;
- String messaggio = "Il valore ("+valore+") indicato in '"+label+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
- else{
- if(!first){
- policy.setValore2(null);
- }
- }
- }
-
- }
- else{
- policy.setValore(null);
- policy.setValore2(null);
- }
-
-
- // filtro
- String errorMsgDatiAttivazione = readDatiAttivazioneFiltroFromHttpParameters(policy, first, infoPolicy);
- if (errorMsgDatiAttivazione != null) {
- this.addParsingError(sbParsingError, errorMsgDatiAttivazione);
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
- public String readDatiAttivazioneFiltroFromHttpParameters(AttivazionePolicy policy,boolean first, InfoPolicy infoPolicy) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
-
- // Filtro - stato
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED);
- if(stato!=null && !"".equals(stato)){
- policy.getFiltro().setEnabled(ServletUtils.isCheckBoxEnabled(stato));
- }
-
- // Filtro
- if(policy.getFiltro().isEnabled()){
-
- // ruolo della PdD
- String ruoloPdD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD);
- if(ruoloPdD!=null && !"".equals(ruoloPdD)){
- try{
- policy.getFiltro().setRuoloPorta(RuoloPolicy.toEnumConstant(ruoloPdD, true));
- }catch(Exception e){
- String messaggio = "Il valore ("+ruoloPdD+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD+"' non è tra i ruoli gestiti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
- // protocollo
- String protocollo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- if(protocollo!=null && !"".equals(protocollo) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(protocollo)){
- policy.getFiltro().setProtocollo(protocollo);
- }
- else{
- if(!first){
- policy.getFiltro().setProtocollo(null);
- }
- }
-
- // ruolo erogatore
- String ruoloErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE);
- if(ruoloErogatore!=null && !"".equals(ruoloErogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(ruoloErogatore) ){
- policy.getFiltro().setRuoloErogatore(ruoloErogatore);
- }
- else{
- if(!first){
- policy.getFiltro().setRuoloErogatore(null);
- }
- }
-
- // erogatore
- String erogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE);
- boolean erogatoreSelected = false;
- if(erogatore!=null && !"".equals(erogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(erogatore) && erogatore.contains("/") ){
- String [] tmp = erogatore.split("/");
- policy.getFiltro().setTipoErogatore(tmp[0]);
- policy.getFiltro().setNomeErogatore(tmp[1]);
- erogatoreSelected = true;
- }
- else{
- if(!first){
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- }
- }
-
- // servizio applicativo erogatore
- String servizioApplicativoErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE);
- if(servizioApplicativoErogatore!=null && !"".equals(servizioApplicativoErogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizioApplicativoErogatore) ){
- policy.getFiltro().setServizioApplicativoErogatore(servizioApplicativoErogatore);
- }
- else{
- if(!first){
- policy.getFiltro().setServizioApplicativoErogatore(null);
- }
- }
-
- // tag
- String tag = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG);
- if(tag!=null && !"".equals(tag) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(tag)){
- policy.getFiltro().setTag(tag);
- }
- else{
- if(!first){
- policy.getFiltro().setTag(null);
- }
- }
-
- // servizio
- String servizio = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO);
- if(servizio!=null && !"".equals(servizio) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizio) && servizio.contains("/") ){
- String [] tmp = servizio.split("/");
- policy.getFiltro().setTipoServizio(tmp[0]);
- policy.getFiltro().setNomeServizio(tmp[1]);
- policy.getFiltro().setVersioneServizio(Integer.parseInt(tmp[2]));
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- policy.getFiltro().setTipoErogatore(tmp[3]);
- policy.getFiltro().setNomeErogatore(tmp[4]);
- }
- }
- else{
- if(!first){
- policy.getFiltro().setTipoServizio(null);
- policy.getFiltro().setNomeServizio(null);
- policy.getFiltro().setVersioneServizio(null);
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()&& !erogatoreSelected) {
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- }
- }
- }
-
- // azione
- String [] azione = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE);
- if(azione!=null && azione.length>0) {
- StringBuilder bf = new StringBuilder();
- for (String az : azione) {
- if(bf.length()>0) {
- bf.append(",");
- }
- bf.append(az);
- }
- policy.getFiltro().setAzione(bf.toString());
- }
- else{
- if(!first){
- policy.getFiltro().setAzione(null);
- }
- }
-
- // ruolo fruitore
- String ruoloFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE);
- if(ruoloFruitore!=null && !"".equals(ruoloFruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(ruoloFruitore) ){
- policy.getFiltro().setRuoloFruitore(ruoloFruitore);
- }
- else{
- if(!first){
- policy.getFiltro().setRuoloFruitore(null);
- }
- }
-
- // fruitore
- String fruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE);
- if(fruitore!=null && !"".equals(fruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(fruitore) && fruitore.contains("/") ){
- String [] tmp = fruitore.split("/");
- policy.getFiltro().setTipoFruitore(tmp[0]);
- policy.getFiltro().setNomeFruitore(tmp[1]);
- }
- else{
- if(!first){
- policy.getFiltro().setTipoFruitore(null);
- policy.getFiltro().setNomeFruitore(null);
- }
- }
-
- // servizio applicativo fruitore
- String servizioApplicativoFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE);
- if(servizioApplicativoFruitore!=null && !"".equals(servizioApplicativoFruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizioApplicativoFruitore) ){
- policy.getFiltro().setServizioApplicativoFruitore(servizioApplicativoFruitore);
- }
- else{
- if(!first){
- policy.getFiltro().setServizioApplicativoFruitore(null);
- }
- }
-
- // claims
- String tokenClaims = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TOKEN_CLAIMS);
- if(tokenClaims!=null && !"".equals(tokenClaims) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(tokenClaims) ){
- policy.getFiltro().setTokenClaims(tokenClaims);
- }
- else{
- if(!first){
- policy.getFiltro().setTokenClaims(null);
- }
- }
-
- // per Chiave
- String perChiave = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED);
- if(first==false){
- policy.getFiltro().setInformazioneApplicativaEnabled(ServletUtils.isCheckBoxEnabled(perChiave));
- }
-
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
-
- // Per Chiave - Tipo
- String perChiaveTipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO);
- if(perChiaveTipo!=null && !"".equals(perChiaveTipo) ){
- policy.getFiltro().setInformazioneApplicativaTipo(perChiaveTipo);
- }
- else{
- if(!first){
- policy.getFiltro().setInformazioneApplicativaTipo(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO_DEFAULT); // default
- }
- }
-
- // Per Chiave - Nome
- String perChiaveNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_NOME);
- if(perChiaveNome!=null && !"".equals(perChiaveNome) ){
- policy.getFiltro().setInformazioneApplicativaNome(perChiaveNome);
- }
- else{
- if(!first){
- policy.getFiltro().setInformazioneApplicativaNome(null);
- }
- }
-
- // Per Chiave - Valore
- String perChiaveValore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE);
- if(perChiaveValore!=null && !"".equals(perChiaveValore) ){
- policy.getFiltro().setInformazioneApplicativaValore(StringEscapeUtils.unescapeHtml(perChiaveValore)); // il valore viene "escaped" perchè può conteenere ""
- }
- else{
- if(!first){
- policy.getFiltro().setInformazioneApplicativaValore(null);
- }
- }
-
- }
- else{
- policy.getFiltro().setInformazioneApplicativaTipo(null);
- policy.getFiltro().setInformazioneApplicativaNome(null);
- policy.getFiltro().setInformazioneApplicativaValore(null);
- }
- }
- else{
- policy.getFiltro().setRuoloPorta(RuoloPolicy.ENTRAMBI);
- policy.getFiltro().setTipoFruitore(null);
- policy.getFiltro().setNomeFruitore(null);
- policy.getFiltro().setServizioApplicativoFruitore(null);
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- policy.getFiltro().setServizioApplicativoErogatore(null);
- policy.getFiltro().setTipoServizio(null);
- policy.getFiltro().setNomeServizio(null);
- policy.getFiltro().setAzione(null);
- policy.getFiltro().setTokenClaims(null);
- policy.getFiltro().setInformazioneApplicativaEnabled(false);
- policy.getFiltro().setInformazioneApplicativaTipo(null);
- policy.getFiltro().setInformazioneApplicativaNome(null);
- policy.getFiltro().setInformazioneApplicativaValore(null);
- }
-
- // GroupBy - stato
- String statoGroupBy = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_ENABLED);
- if(statoGroupBy!=null && !"".equals(statoGroupBy)){
- policy.getGroupBy().setEnabled(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO.equals(statoGroupBy) ||
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(statoGroupBy));
- }
-
- // GroupBy
- if(policy.getGroupBy().isEnabled()){
-
- // ruolo della PdD
- String ruoloPdD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RUOLO_PDD);
- if(first==false){
- policy.getGroupBy().setRuoloPorta(ServletUtils.isCheckBoxEnabled(ruoloPdD));
- }
-
- // protocollo
- String protocollo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PROTOCOLLO);
- if(first==false){
- policy.getGroupBy().setProtocollo(ServletUtils.isCheckBoxEnabled(protocollo));
- }
-
- // erogatore
- String erogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_EROGATORE);
- if(first==false){
- policy.getGroupBy().setErogatore(ServletUtils.isCheckBoxEnabled(erogatore));
- }
-
- // servizio applicativo erogatore
- String servizioApplicativoErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_EROGATORE);
- if(first==false){
- policy.getGroupBy().setServizioApplicativoErogatore(ServletUtils.isCheckBoxEnabled(servizioApplicativoErogatore));
- }
-
- // servizio
- String servizio = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SERVIZIO);
- if(first==false){
- policy.getGroupBy().setServizio(ServletUtils.isCheckBoxEnabled(servizio));
- policy.getGroupBy().setErogatore(ServletUtils.isCheckBoxEnabled(servizio)); // imposto anche l'erogatore poiche' identifica API differenti
- }
-
- // azione
- String azione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_AZIONE);
- if(first==false){
- policy.getGroupBy().setAzione(ServletUtils.isCheckBoxEnabled(azione));
- }
-
- // fruitore
- String fruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_FRUITORE);
- if(first==false){
- policy.getGroupBy().setFruitore(ServletUtils.isCheckBoxEnabled(fruitore));
- }
-
- // servizio applicativo fruitore
- String servizioApplicativoFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_FRUITORE);
- if(first==false){
- policy.getGroupBy().setServizioApplicativoFruitore(ServletUtils.isCheckBoxEnabled(servizioApplicativoFruitore));
- }
-
- // richiedente
- String richiedente = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RICHIEDENTE);
- if(first==false){
- policy.getGroupBy().setServizioApplicativoFruitore(ServletUtils.isCheckBoxEnabled(richiedente));
- policy.getGroupBy().setFruitore(ServletUtils.isCheckBoxEnabled(richiedente));
- policy.getGroupBy().setIdentificativoAutenticato(ServletUtils.isCheckBoxEnabled(richiedente));
- }
-
- // token
- String token = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN);
- if(first==false){
- if(ServletUtils.isCheckBoxEnabled(token)) {
- String [] tokenSelezionati = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN_CLAIMS);
- if(tokenSelezionati!=null && tokenSelezionati.length>0) {
- StringBuilder bf = new StringBuilder();
- for (int i = 0; i < tokenSelezionati.length; i++) {
- TipoCredenzialeMittente tipo = TipoCredenzialeMittente.toEnumConstant(tokenSelezionati[i], true);
- if(TipoCredenzialeMittente.TOKEN_ISSUER.equals(tipo)) {
- continue;
- }
- else if(TipoCredenzialeMittente.TOKEN_SUBJECT.equals(tipo)) {
- if(!bf.toString().endsWith(",") && bf.length()>0) {
- bf.append(",");
- }
- bf.append(TipoCredenzialeMittente.TOKEN_ISSUER.getRawValue());
- if(i==0) {
- bf.append(",");
- }
- }
- if(i>0) {
- bf.append(",");
- }
- bf.append(tokenSelezionati[i]);
- }
- if(bf.length()>0) {
- policy.getGroupBy().setToken(bf.toString());
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- // per Chiave
- String perChiave = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED);
- if(first==false){
- policy.getGroupBy().setInformazioneApplicativaEnabled(ServletUtils.isCheckBoxEnabled(perChiave));
- }
-
- if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
-
- // Per Chiave - Tipo
- String perChiaveTipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO);
- if(perChiaveTipo!=null && !"".equals(perChiaveTipo) ){
- policy.getGroupBy().setInformazioneApplicativaTipo(perChiaveTipo);
- }
- else{
- if(!first){
- policy.getGroupBy().setInformazioneApplicativaTipo(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO_DEFAULT); // default
- }
- }
-
- // Per Chiave - Nome
- String perChiaveNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_NOME);
- if(perChiaveNome!=null && !"".equals(perChiaveNome) ){
- policy.getGroupBy().setInformazioneApplicativaNome(perChiaveNome);
- }
- else{
- if(!first){
- policy.getGroupBy().setInformazioneApplicativaNome(null);
- }
- }
-
-
- }
- else{
- policy.getGroupBy().setInformazioneApplicativaTipo(null);
- policy.getGroupBy().setInformazioneApplicativaNome(null);
- }
- }
- else{
- policy.getGroupBy().setRuoloPorta(false);
- policy.getGroupBy().setFruitore(false);
- policy.getGroupBy().setServizioApplicativoFruitore(false);
- policy.getGroupBy().setIdentificativoAutenticato(false);
- policy.getGroupBy().setToken(null);
- policy.getGroupBy().setErogatore(false);
- policy.getGroupBy().setServizioApplicativoErogatore(false);
- policy.getGroupBy().setServizio(false);
- policy.getGroupBy().setAzione(false);
- policy.getGroupBy().setInformazioneApplicativaEnabled(false);
- policy.getGroupBy().setInformazioneApplicativaTipo(null);
- policy.getGroupBy().setInformazioneApplicativaNome(null);
- }
-
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
- private void addDataElementRisorsa(
- List<DataElement> dati,
- String parametroRisorsaNome, String valoreRisorsa,
- String parametroEsitiNome, String valoreEsiti,
- boolean editMode) {
- addDataElementRisorsa(
- dati,
- parametroRisorsaNome, valoreRisorsa,
- parametroEsitiNome, valoreEsiti,
- editMode,
- null);
- }
- private void addDataElementRisorsa(
- List<DataElement> dati,
- String parametroRisorsaNome, String valoreRisorsa,
- String parametroEsitiNome, String valoreEsiti,
- boolean editMode,
- PolicyGroupByActiveThreadsType type) {
-
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
-
- DataElement de = new DataElement();
- de.setName(parametroRisorsaNome);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA);
- if(editMode) {
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA);
- de.setSelected(valoreRisorsa);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.TEXT);
- }
- de.setValue(valoreRisorsa);
- dati.add(de);
-
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE.equals(valoreRisorsa)) {
-
- de = new DataElement();
- de.setName(parametroEsitiNome);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ESITI);
- if(editMode) {
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_ESITI);
- de.setSelected(valoreEsiti);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- if(valoreEsiti==null || "".equals(valoreEsiti)) {
- valoreEsiti = CostantiControlStation.LABEL_QUALSIASI;
- }
- de.setType(DataElementType.TEXT);
- }
- de.setValue(valoreEsiti);
- dati.add(de);
-
- }
- }
- else {
- DataElement de = new DataElement();
- de.setName(parametroRisorsaNome);
- de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO);
- if(editMode) {
- if(type!=null) {
- List<String> valoriFiltrati = new ArrayList<>();
- List<String> labelFiltrate = new ArrayList<>();
- for (int i = 0; i < CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI.length; i++) {
- String v = CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI[i];
- TipoRisorsaPolicyAttiva tipoRisorsa = TipoRisorsaPolicyAttiva.toEnumConstant(v);
- if(type.isSupportedResource(tipoRisorsa)) {
- valoriFiltrati.add(v);
- labelFiltrate.add(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_LABELS[i]);
- }
- }
- de.setValues(valoriFiltrati);
- de.setLabels(labelFiltrate);
- }
- else {
- de.setValues(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_VALORI);
- de.setLabels(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_TIPI_RISORSE_LABELS);
- }
- de.setSelected(valoreRisorsa);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- de.setValue(valoreRisorsa);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(valoreRisorsa);
- dati.add(de);
-
- de = new DataElement();
- de.setName(parametroRisorsaNome+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setLabel(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO);
- de.setType(DataElementType.TEXT);
- String labelRisorsaPolicyAttiva = this.getLabelTipoRisorsaPolicyAttiva(valoreRisorsa);
- de.setValue(labelRisorsaPolicyAttiva);
- }
- dati.add(de);
- }
-
- }
-
- private TipoRisorsa getTipoRisorsa(String valoreRisorsa, String valoreEsiti) throws DriverControlStationException, NotFoundException {
-
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
-
- TipoRisorsa tipoRisorsaSelezionata = null;
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE.equals(valoreRisorsa)) {
- if(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK.equals(valoreEsiti)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO;
- }
- else if(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE.equals(valoreEsiti)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE_FALLITE;
- }
- else if(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FAULT.equals(valoreEsiti)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_FAULT_APPLICATIVI;
- }
- else if(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE_FAULT.equals(valoreEsiti)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI;
- }
- else if(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK_FAULT.equals(valoreEsiti)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI;
- }
- else {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE;
- }
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE_SIMULTANEE.equals(valoreRisorsa)) {
- tipoRisorsaSelezionata = TipoRisorsa.NUMERO_RICHIESTE;
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_OCCUPAZIONE_BANDA.equals(valoreRisorsa)) {
- tipoRisorsaSelezionata = TipoRisorsa.OCCUPAZIONE_BANDA;
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_TEMPO_MEDIO_RISPOSTA.equals(valoreRisorsa)) {
- tipoRisorsaSelezionata = TipoRisorsa.TEMPO_MEDIO_RISPOSTA;
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_TEMPO_COMPLESSIVO_RISPOSTA.equals(valoreRisorsa)) {
- tipoRisorsaSelezionata = TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA;
- }
- else {
- throw new DriverControlStationException("Risorsa '"+valoreRisorsa+"' sconosciuta");
- }
- return tipoRisorsaSelezionata;
-
- }
- else {
-
- TipoRisorsaPolicyAttiva tipoRisorsaPolicyAttiva = TipoRisorsaPolicyAttiva.toEnumConstant(valoreRisorsa, false);
- if(tipoRisorsaPolicyAttiva==null) {
- throw new DriverControlStationException("Risorsa '"+valoreRisorsa+"' sconosciuta");
- }
- return tipoRisorsaPolicyAttiva.getTipoRisorsa(true);
-
- }
-
- }
- public boolean isTipoRisorsaNumeroRichiesteSimultanee(String valoreRisorsa) throws Exception {
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE_SIMULTANEE.equals(valoreRisorsa);
- }
- else {
- TipoRisorsaPolicyAttiva tipoRisorsaPolicyAttiva = TipoRisorsaPolicyAttiva.toEnumConstant(valoreRisorsa, false);
- if(tipoRisorsaPolicyAttiva==null) {
- return false;
- }
- return tipoRisorsaPolicyAttiva.isRichiesteSimultanee();
- }
- }
-
- public String getDataElementValueRisorsa(String tipoRisorsa, boolean simultanee) throws Exception {
- TipoRisorsa tipo = TipoRisorsa.toEnumConstant(tipoRisorsa);
- if(tipo==null) {
- return null;
- }
- return this.getDataElementValueRisorsa(tipo, simultanee);
- }
- public String getDataElementValueRisorsa(TipoRisorsa tipoRisorsa, boolean simultanee) throws Exception {
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
- switch (tipoRisorsa) {
- case NUMERO_RICHIESTE:
- if(simultanee) {
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE_SIMULTANEE;
- }
- else {
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE;
- }
- case NUMERO_RICHIESTE_FALLITE:
- case NUMERO_FAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_NUMERO_RICHIESTE;
- case OCCUPAZIONE_BANDA:
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_OCCUPAZIONE_BANDA;
- case TEMPO_MEDIO_RISPOSTA:
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_TEMPO_MEDIO_RISPOSTA;
- case TEMPO_COMPLESSIVO_RISPOSTA:
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_TEMPO_COMPLESSIVO_RISPOSTA;
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- return ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_DIMENSIONE_MASSIMA;
- }
-
- throw new DriverControlStationException("Tipo risorsa '"+tipoRisorsa+"' non gestita");
- }
- else {
- TipoRisorsaPolicyAttiva tipoRisorsaPolicyAttiva = TipoRisorsaPolicyAttiva.getTipo(tipoRisorsa, simultanee);
- return tipoRisorsaPolicyAttiva.getValue();
- }
- }
-
- public String getDataElementValueRisorsaEsiti(String tipoRisorsa) throws Exception {
- TipoRisorsa tipo = TipoRisorsa.toEnumConstant(tipoRisorsa);
- if(tipo==null) {
- return null;
- }
- return this.getDataElementValueRisorsaEsiti(tipo);
- }
- public String getDataElementValueRisorsaEsiti(TipoRisorsa tipoRisorsa) throws DriverControlStationException {
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
- switch (tipoRisorsa) {
- case NUMERO_RICHIESTE_FALLITE:
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE;
- case NUMERO_FAULT_APPLICATIVI:
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FAULT;
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_FALLITE_FAULT;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRAZIONE_ESITI_OK_FAULT;
- case NUMERO_RICHIESTE:
- case OCCUPAZIONE_BANDA:
- case TEMPO_MEDIO_RISPOSTA:
- case TEMPO_COMPLESSIVO_RISPOSTA:
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- return null;
- }
-
- throw new DriverControlStationException("Tipo risorsa '"+tipoRisorsa+"' non gestita");
- }
- else {
- return null;
- }
- }
-
- public void findPolicyBuiltIn(List<InfoPolicy> policies,
- List<InfoPolicy> idPoliciesSoddisfanoCriteri,
- String modalitaRisorsa, String modalitaEsiti,
- boolean modalitaSimultaneeEnabled, String modalitaIntervallo,
- boolean modalitaCongestioneEnabled,
- boolean modalitaDegradoEnabled,
- boolean modalitaErrorRateEnabled) throws Exception {
- if(policies!=null && policies.size()>0 && modalitaRisorsa!=null){
-
- TipoRisorsa tipoRisorsaSelezionata = getTipoRisorsa(modalitaRisorsa, modalitaEsiti);
-
- for (InfoPolicy info : policies) {
-
- if(!tipoRisorsaSelezionata.equals(info.getTipoRisorsa())) {
- continue;
- }
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsaSelezionata)) {
- idPoliciesSoddisfanoCriteri.add(info);
- continue;
- }
-
- if(modalitaSimultaneeEnabled) {
- if(!info.isCheckRichiesteSimultanee()) {
- continue;
- }
- }
-
- if(!modalitaSimultaneeEnabled) {
- if(!info.isIntervalloUtilizzaRisorseRealtime()) {
- continue;
- }
- if(modalitaIntervallo==null) {
- throw new DriverControlStationException("Intervallo Temporale non definito");
- }
- TipoPeriodoRealtime tipo = TipoPeriodoRealtime.toEnumConstant(modalitaIntervallo, true);
- if(!tipo.equals(info.getIntervalloUtilizzaRisorseRealtimeTipoPeriodo())) {
- continue;
- }
- }
-
- if(modalitaCongestioneEnabled) {
- if(!info.isControlloCongestione()) {
- continue;
- }
- }
- else {
- if(info.isControlloCongestione()) {
- continue;
- }
- }
-
- if(modalitaDegradoEnabled) {
- if(!info.isDegradoPrestazionaleUtilizzaRisorseStatistiche()) {
- continue;
- }
- }
- else {
- if(info.isDegradoPrestazionaleUtilizzaRisorseStatistiche()) {
- continue;
- }
- }
-
- if(modalitaErrorRateEnabled) {
- if(!info.isErrorRate()) {
- continue;
- }
- }
- else {
- if(info.isErrorRate()) {
- continue;
- }
- }
-
- idPoliciesSoddisfanoCriteri.add(info);
- }
- }
- }
-
- public void addAttivazionePolicyToDati(List<DataElement> dati, TipoOperazione tipoOperazione, AttivazionePolicy policy, String nomeSezione, List<InfoPolicy> policies,
- RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding, String modalita, PolicyGroupByActiveThreadsType type) throws Exception {
-
-
-
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_RUOLO_PORTA, ruoloPorta.getValue());
- }
- Parameter parNomePorta = null;
- if(nomePorta!=null) {
- parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_NOME_PORTA, nomePorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_SERVICE_BINDING, serviceBinding.name());
- }
-
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_IS_ATTIVAZIONE_GLOBALE);
- de.setValue(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_IS_ATTIVAZIONE_GLOBALE_VALORE);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_RUOLO_PORTA);
- de.setValue(ruoloPorta!=null ? ruoloPorta.getValue() : null);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_NOME_PORTA);
- de.setValue(nomePorta);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(serviceBinding!=null) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_RATE_LIMITING_POLICY_GLOBALI_LINK_SERVICE_BINDING);
- de.setValue(serviceBinding.name());
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- /* Servono per le bradcump */
-
- String jmxParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE);
- boolean jmx = jmxParam!=null && "true".equals(jmxParam);
-
- if(!jmx){
- de = new DataElement();
- de.setLabel(nomeSezione);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- if(policy!=null && policy.getId()!=null && policy.getId()>0){
- // id
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID);
- de.setValue(policy.getId()+"");
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- InfoPolicy infoPolicy = null;
- List<String> idPolicies = new ArrayList<>();
- String modalitaRisorsa = null;
- String modalitaEsiti = null;
- String modalitaIntervallo = null;
- String modalitaCongestione = null;
- String modalitaDegrado = null;
- String modalitaErrorRate = null;
- boolean modalitaSimultaneeEnabled = false;
- boolean modalitaCongestioneEnabled = false;
- boolean modalitaDegradoEnabled = false;
- boolean modalitaErrorRateEnabled = false;
-
- boolean addInfoDescrizionePolicy = !jmx;
-
- if(TipoOperazione.ADD.equals(tipoOperazione)){
-
- if(modalita==null) {
- modalita = ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_DEFAULT;
- }
-
- }
-
-
- if(TipoOperazione.ADD.equals(tipoOperazione) && modalita!=null &&
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_BUILT_IN.equals(modalita)){
-
- modalitaRisorsa = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_RISORSA);
- modalitaEsiti = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_ESITI);
- modalitaIntervallo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_INTERVALLO);
- modalitaCongestione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_CONGESTIONE);
- modalitaDegrado = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_DEGRADO);
- modalitaErrorRate = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_ERROR_RATE);
-
- if(modalitaRisorsa==null) {
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
- modalitaRisorsa = ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_DEFAULT;
- }
- else {
- modalitaRisorsa = CostantiControlStation.DEFAULT_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_RISORSA_TIPO_VALUE.getValue();
- }
- }
- if(modalitaEsiti==null) {
- if(CostantiControlStation.USE_SELECT_LIST_SEPARATE_METRICHE) {
- modalitaEsiti = ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_ESITI_DEFAULT;
- }
- }
- if(modalitaIntervallo==null) {
- modalitaIntervallo = ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_RISORSA_INTERVALLO_OSSERVAZIONE_DEFAULT;
- }
-
- modalitaSimultaneeEnabled = isTipoRisorsaNumeroRichiesteSimultanee(modalitaRisorsa);
- modalitaCongestioneEnabled = ServletUtils.isCheckBoxEnabled(modalitaCongestione);
-
- modalitaDegradoEnabled = ServletUtils.isCheckBoxEnabled(modalitaDegrado);
-
- modalitaErrorRateEnabled = ServletUtils.isCheckBoxEnabled(modalitaErrorRate);
-
- List<String> idPoliciesTmp = new ArrayList<>();
- List<InfoPolicy> idPoliciesSoddisfanoCriteri = new ArrayList<>();
- findPolicyBuiltIn(policies,
- idPoliciesSoddisfanoCriteri,
- modalitaRisorsa, modalitaEsiti,
- modalitaSimultaneeEnabled, modalitaIntervallo,
- modalitaCongestioneEnabled,
- modalitaDegradoEnabled,
- modalitaErrorRateEnabled);
-
- // filtro per compatibilita'
- if(type!=null) {
- List<InfoPolicy> idPoliciesSoddisfanoCriteriFiltered = new ArrayList<>();
- for (InfoPolicy infoPolicyCheck : idPoliciesSoddisfanoCriteri) {
- TipoRisorsaPolicyAttiva tipoRisorsa = TipoRisorsaPolicyAttiva.getTipo(infoPolicyCheck.getTipoRisorsa(), infoPolicyCheck.isCheckRichiesteSimultanee());
- if(type.isSupportedResource(tipoRisorsa)) {
- idPoliciesSoddisfanoCriteriFiltered.add(infoPolicyCheck);
- }
- }
- idPoliciesSoddisfanoCriteri = idPoliciesSoddisfanoCriteriFiltered;
- }
-
- if(!idPoliciesSoddisfanoCriteri.isEmpty()) {
- for (InfoPolicy infoPolicyCheck : idPoliciesSoddisfanoCriteri) {
- idPoliciesTmp.add(infoPolicyCheck.getIdPolicy());
- if(policy.getIdPolicy()!=null && policy.getIdPolicy().equals(infoPolicyCheck.getIdPolicy())){
- infoPolicy = infoPolicyCheck;
- }
- }
- }
- if(idPoliciesTmp.size()<=0) {
-
- if(policies==null || policies.size()<=0 ) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_POLICY_BUILT_IN_NON_ESISTENTI, MessageType.ERROR);
- }
- else {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_POLICY_BUILT_IN_CRITERI_NON_ESISTENTI, MessageType.ERROR);
- }
-
- }
- else {
-
- if(idPoliciesTmp.size()>1) {
- idPoliciesTmp.add("-");
- idPolicies.addAll(idPoliciesTmp);
- }
- else {
- String idPolicy = idPoliciesTmp.get(0);
- idPolicies.add(idPolicy);
- for (InfoPolicy info : policies) {
- if(idPolicy!=null && idPolicy.equals(info.getIdPolicy())){
- infoPolicy = info;
- }
- }
- }
-
- }
-
- }
- else {
-
- // filtro per compatibilita'
- if(type!=null) {
- List<InfoPolicy> idPoliciesSoddisfanoCriteriFiltered = new ArrayList<>();
- for (InfoPolicy infoPolicyCheck : policies) {
- TipoRisorsaPolicyAttiva tipoRisorsa = TipoRisorsaPolicyAttiva.getTipo(infoPolicyCheck.getTipoRisorsa(), infoPolicyCheck.isCheckRichiesteSimultanee());
- if(type.isSupportedResource(tipoRisorsa)) {
- idPoliciesSoddisfanoCriteriFiltered.add(infoPolicyCheck);
- }
- }
- policies = idPoliciesSoddisfanoCriteriFiltered;
- }
-
- if(policies==null || policies.size()<=0) {
-
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_POLICY_UTENTE_NON_ESISTENTI, MessageType.ERROR);
-
- }
- else {
- idPolicies.add("-");
- for (InfoPolicy info : policies) {
- idPolicies.add(info.getIdPolicy());
- if(policy.getIdPolicy()!=null && policy.getIdPolicy().equals(info.getIdPolicy())){
- infoPolicy = info;
- }
- }
- }
- }
-
- if(!jmx){
-
- // alias
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ALIAS);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ALIAS);
- //if(infoPolicy!=null){
- de.setType(DataElementType.TEXT_EDIT);
- // }
- // else {
- // de.setType(DataElementType.HIDDEN);
- // }
- de.setValue(policy.getAlias());
- de.setRequired(true);
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_DESCRIZIONE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_DESCRIZIONE);
- if(infoPolicy!=null){
- if(!addInfoDescrizionePolicy) {
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setRows(6);
- //de.setCols(57);
- de.setCols(55);
- de.setLabelAffiancata(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(infoPolicy.getDescrizione());
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue(null);
- }
- dati.add(de);
-
- //if(infoPolicy!=null){
- // stato
- //boolean hidden = (ruoloPorta!=null);
- boolean hidden = false; // anche una policy di rate limiting sulla singola porta puo' essere disabiltiata temporaneamente
- boolean policyWithWarningOnly = true;
- if(infoPolicy!=null && TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())) {
- policyWithWarningOnly=false;
- }
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ENABLED, policy.isEnabled(), false,
- policyWithWarningOnly, policy.isWarningOnly(), hidden);
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione) && addInfoDescrizionePolicy && infoPolicy!=null) {
- DataElementInfo dInfoDescrizionePolicy = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- dInfoDescrizionePolicy.setHeaderBody(replaceToHtmlSeparator(infoPolicy.getDescrizione()));
- dInfoDescrizionePolicy.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_POLICY_STATO_VALORI);
- dati.get(dati.size()-1).setInfo(dInfoDescrizionePolicy);
- }
- else {
- DataElementInfo dInfoDescrizionePolicy = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ENABLED);
- dInfoDescrizionePolicy.setListBody(CostantiControlStation.LABEL_CONFIGURAZIONE_POLICY_STATO_VALORI);
- dati.get(dati.size()-1).setInfo(dInfoDescrizionePolicy);
- }
-
- // continue
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- if(hidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- de.setLabels(ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- de.setPostBack_viaPOST(true);
- de.setSelected(policy.isContinuaValutazione()+"");
- }
- de.setValue(policy.isContinuaValutazione()+"");
-
- DataElementInfo dInfoContinuePolicy = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE);
- dInfoContinuePolicy.setListBody(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_CONTINUE_ELEM);
- de.setInfo(dInfoContinuePolicy);
-
- dati.add(de);
- }
-
- if(!jmx){
- if(TipoOperazione.CHANGE.equals(tipoOperazione) && infoPolicy!=null) {
-
- if(infoPolicy.isBuiltIn()) {
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_POLICY_CRITERI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- String modalitaRisorsaConvertValue = this.getDataElementValueRisorsa(infoPolicy.getTipoRisorsa(), infoPolicy.isCheckRichiesteSimultanee());
- String modalitaEsitiConvertValue = this.getDataElementValueRisorsaEsiti(infoPolicy.getTipoRisorsa());
- addDataElementRisorsa(dati,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_RISORSA+CostantiControlStation.PARAMETRO_SUFFIX_LABEL, modalitaRisorsaConvertValue,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_ESITI+CostantiControlStation.PARAMETRO_SUFFIX_LABEL, modalitaEsitiConvertValue,
- false);
-
- if(!TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(modalitaRisorsaConvertValue)) {
-
- if(!infoPolicy.isCheckRichiesteSimultanee()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_INTERVALLO+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_INTERVALLO_OSSERVAZIONE);
- de.setType(DataElementType.TEXT);
- if(infoPolicy.getIntervalloUtilizzaRisorseRealtimeTipoPeriodo()!=null) {
- String labelValue = infoPolicy.getIntervalloUtilizzaRisorseRealtimeTipoPeriodo().getValue();
- for (int i = 0; i < ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_INTERVALLO_OSSERVAZIONE.length; i++) {
- if(labelValue.equals(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_INTERVALLO_OSSERVAZIONE[i])) {
- labelValue = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_INTERVALLO_OSSERVAZIONE[i];
- break;
- }
- }
- de.setValue(labelValue);
- }
- dati.add(de);
- }
-
- if(infoPolicy.isControlloCongestione()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_CONGESTIONE+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
-
- if(infoPolicy.isDegradoPrestazione()) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_DEGRADO+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- de.setType(DataElementType.TEXT);
- dati.add(de);
- }
- }
-
- }
- else {
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- de.setType(DataElementType.TEXT);
- de.setValue(infoPolicy.getIdPolicy());
- dati.add(de);
-
- }
-
- }
- }
-
- if(!jmx){
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
- if(policy!=null && policy.isEnabled()){
-
- if(infoPolicy==null || !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())) {
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUNTIME);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
- }
- }
- }
-
- }
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione) &&
- policy.getIdActivePolicy()!=null && !"".equals(policy.getIdActivePolicy())){
- // id-active-policy
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_ID_UNICO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_ID_UNICO);
- //if(!jmx){
- //de.setType(DataElementType.TEXT);
- de.setType(DataElementType.HIDDEN);
- //}
- //else{
- // de.setType(DataElementType.HIDDEN);
- //}
- de.setValue(policy.getIdActivePolicy());
- dati.add(de);
- }
-
- if(!jmx){
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
- if(policy!=null && policy.isEnabled()){
-
- if(infoPolicy==null || !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())) {
-
- // Link visualizza stato
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO);
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- parRuoloPorta,parNomePorta,parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""));
- }
- de.setType(DataElementType.LINK);
- dati.add(de);
-
- }
- }
- }
-
-
- if(TipoOperazione.ADD.equals(tipoOperazione)) {
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA);
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_VALORI);
- de.setSelected(modalita);
- de.setValue(modalita);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- }
-
- }
-
- // policy
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- boolean configurazionePerCriteri = false;
- if(TipoOperazione.ADD.equals(tipoOperazione)){
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_BUILT_IN.equals(modalita) &&
- (idPolicies==null || idPolicies.size()<=1)) {
- de.setType(DataElementType.HIDDEN);
- configurazionePerCriteri = true;
- }
- else {
- de.setValues(idPolicies);
- if(policy.getIdPolicy()!=null)
- de.setSelected(policy.getIdPolicy());
- else
- de.setSelected("-");
- de.setType(DataElementType.SELECT);
- de.setRequired(true);
- de.setPostBack_viaPOST(true);
-
- if(addInfoDescrizionePolicy && infoPolicy!=null) {
- DataElementInfo dInfoDescrizionePolicy = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- dInfoDescrizionePolicy.setHeaderBody(replaceToHtmlSeparator(infoPolicy.getDescrizione()));
- de.setInfo(dInfoDescrizionePolicy);
- }
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- if(configurazionePerCriteri && idPolicies!=null && idPolicies.size()==1) {
- de.setValue(idPolicies.get(0));
- }
- else {
- if(policy.getIdPolicy()!=null) {
- de.setValue(policy.getIdPolicy());
- }
- else {
- de.setValue("-");
- }
- }
- dati.add(de);
-
- if(!jmx){
-
- if(TipoOperazione.ADD.equals(tipoOperazione) && modalita!=null &&
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_BUILT_IN.equals(modalita)){
-
- org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico = this.confCore.getConfigurazioneControlloTraffico();
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_POLICY_CRITERI);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- addDataElementRisorsa(dati,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_RISORSA, modalitaRisorsa,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_ESITI, modalitaEsiti,
- true,
- type);
-
- if(!TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(modalitaRisorsa)) {
-
- if(!modalitaSimultaneeEnabled) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_INTERVALLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_INTERVALLO_OSSERVAZIONE);
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_INTERVALLO_OSSERVAZIONE);
- de.setLabels(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_INTERVALLO_OSSERVAZIONE);
- de.setSelected(modalitaIntervallo);
- de.setValue(modalitaIntervallo);
- de.setPostBack_viaPOST(true);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_CONGESTIONE);
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_LABEL);
- de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_NOTE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(modalitaCongestioneEnabled);
- de.setValue(modalitaCongestioneEnabled+"");
- de.setPostBack_viaPOST(true);
- DataElementInfo dInfoDescrizioneCongestione = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_CONGESTIONE_LABEL);
- dInfoDescrizioneCongestione.setHeaderBody(replaceToHtmlSeparator(this.getApplicabilitaConCongestione(configurazioneControlloTraffico.getControlloTraffico())));
- de.setInfo(dInfoDescrizioneCongestione);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_DEGRADO);
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_LABEL);
- de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_NOTE);
- if(!TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(modalitaRisorsa) &&
- !TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(modalitaRisorsa)
- ){
- de.setType(DataElementType.CHECKBOX);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- }
- de.setSelected(modalitaDegradoEnabled);
- de.setValue(modalitaDegradoEnabled+"");
- de.setPostBack_viaPOST(true);
- DataElementInfo dInfoDescrizioneDegrado = new DataElementInfo(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_CON_DEGRADO_PRESTAZIONALE_LABEL);
- dInfoDescrizioneDegrado.setHeaderBody(replaceToHtmlSeparator(this.getApplicabilitaDegradoPrestazionale()));
- de.setInfo(dInfoDescrizioneDegrado);
- dati.add(de);
-
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_MODALITA_CRITERIO_ERROR_RATE);
- // //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_ERROR_RATE_LABEL);
- // de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_APPLICABILITA_ERROR_RATE_NOTE);
- // de.setType(DataElementType.CHECKBOX);
- // de.setSelected(modalitaErrorRateEnabled);
- // de.setValue(modalitaErrorRateEnabled+"");
- // de.setPostBack_viaPOST(true);
- // dati.add(de);
- }
-
- }
-
-
- if(idPolicies!=null && idPolicies.size()>0 && infoPolicy!=null) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_POLICY_INFORMAZIONI_SOGLIA);
- de.setType(DataElementType.TITLE);
- dati.add(de);
- }
-
- // ridefinisci
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_RIDEFINISCI);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_RIDEFINISCI);
- if(infoPolicy!=null){
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.isRidefinisci());
- de.setValue(policy.isRidefinisci()+"");
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue("false");
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- // Valore Soglia
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(modalitaRisorsa) ||
- (infoPolicy!=null && infoPolicy.getTipoRisorsa()!=null && TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa()))) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VALORE_2);
- if(infoPolicy!=null){
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL);
- }
- if(infoPolicy!=null){
- if(policy.isRidefinisci()){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- if(policy.getValore2()!=null){
- de.setValue(policy.getValore2()+"");
- }
- else{
- de.setValue("");
- }
- }
- else{
- de.setType(DataElementType.TEXT);
- if(infoPolicy.getValore2()!=null){
- de.setValue(infoPolicy.getValore2()+"");
- }
- else{
- de.setValue("");
- }
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue("");
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VALORE);
- if(infoPolicy!=null){
- switch (infoPolicy.getTipoRisorsa()) {
- case NUMERO_RICHIESTE:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- break;
- case DIMENSIONE_MASSIMA_MESSAGGIO:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_NOTE);
- break;
- case OCCUPAZIONE_BANDA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_NOTE);
- break;
- case TEMPO_MEDIO_RISPOSTA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_NOTE);
- break;
- case TEMPO_COMPLESSIVO_RISPOSTA:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_NOTE);
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_NOTE);
- break;
- case NUMERO_RICHIESTE_FALLITE:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_FALLITE_NOTE);
- break;
- case NUMERO_FAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_FAULT_APPLICATIVI_NOTE);
- break;
- case NUMERO_RICHIESTE_FALLITE_OFAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_FALLITE_O_FAULT_NOTE);
- break;
- case NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_OFAULT_APPLICATIVI:
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE_COMPLETATE_CON_SUCCESSO_O_FAULT_NOTE);
- break;
- }
- }
- if(infoPolicy!=null){
- if(policy.isRidefinisci()){
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- if(policy.getValore()!=null){
- de.setValue(policy.getValore()+"");
- }
- else{
- de.setValue("");
- }
- }
- else{
- de.setType(DataElementType.TEXT);
- if(infoPolicy.getValore()!=null){
- de.setValue(infoPolicy.getValore()+"");
- }
- else{
- de.setValue("");
- }
- }
- }
- else{
- de.setType(DataElementType.HIDDEN);
- de.setValue("");
- }
- //de.setSize(consoleHelper.getSize());
- dati.add(de);
-
- if(infoPolicy!=null){
-
- boolean delegata = false;
- boolean applicativa = false;
- @SuppressWarnings("unused")
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- boolean multitenant = this.confCore.isMultitenant();
-
- boolean tokenAbilitato = true;
-
- PddTipologia pddTipologiaSoggettoAutenticati = null;
- boolean gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore = false;
- PortaDelegata portaDelegata = null;
- PortaApplicativa portaApplicativa = null;
- CredenzialeTipo tipoAutenticazione = null;
- Boolean appId = null;
- String tokenPolicy = null;
- IDSoggetto idSoggettoProprietario = null;
- if(ruoloPorta!=null) {
- if(applicativa) {
-
- if(multitenant && this.confCore.getMultitenantSoggettiErogazioni()!=null) {
- switch (this.confCore.getMultitenantSoggettiErogazioni()) {
- case SOLO_SOGGETTI_ESTERNI:
- pddTipologiaSoggettoAutenticati = PddTipologia.ESTERNO;
- break;
- case ESCLUDI_SOGGETTO_EROGATORE:
- gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore = true;
- break;
- case TUTTI:
- break;
- }
- }
-
- IDPortaApplicativa idPA = new IDPortaApplicativa();
- idPA.setNome(nomePorta);
- portaApplicativa = this.porteApplicativeCore.getPortaApplicativa(idPA);
- tipoAutenticazione = CredenzialeTipo.toEnumConstant(portaApplicativa.getAutenticazione());
- if(CredenzialeTipo.APIKEY.equals(tipoAutenticazione)) {
- ApiKeyState apiKeyState = new ApiKeyState(this.porteApplicativeCore.getParametroAutenticazione(portaApplicativa.getAutenticazione(), portaApplicativa.getProprietaAutenticazioneList()));
- appId = apiKeyState.appIdSelected;
- }
- if(portaApplicativa.getGestioneToken()!=null && portaApplicativa.getGestioneToken().getPolicy()!=null) {
- tokenPolicy = portaApplicativa.getGestioneToken().getPolicy();
- }
- idSoggettoProprietario = new IDSoggetto(portaApplicativa.getTipoSoggettoProprietario(), portaApplicativa.getNomeSoggettoProprietario());
-
- if(portaApplicativa.getGestioneToken()!=null) {
- String gestioneTokenPolicy = portaApplicativa.getGestioneToken().getPolicy();
- if( gestioneTokenPolicy == null ||
- gestioneTokenPolicy.equals("") ||
- gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
- tokenAbilitato = false;
- }
- }
- else {
- tokenAbilitato = false;
- }
-
- }
- if(delegata) {
- IDPortaDelegata idPD = new IDPortaDelegata();
- idPD.setNome(nomePorta);
- portaDelegata = this.porteDelegateCore.getPortaDelegata(idPD);
- tipoAutenticazione = CredenzialeTipo.toEnumConstant(portaDelegata.getAutenticazione());
- if(CredenzialeTipo.APIKEY.equals(tipoAutenticazione)) {
- ApiKeyState apiKeyState = new ApiKeyState(this.porteDelegateCore.getParametroAutenticazione(portaDelegata.getAutenticazione(), portaDelegata.getProprietaAutenticazioneList()));
- appId = apiKeyState.appIdSelected;
- }
- if(portaDelegata.getGestioneToken()!=null && portaDelegata.getGestioneToken().getPolicy()!=null) {
- tokenPolicy = portaDelegata.getGestioneToken().getPolicy();
- }
- idSoggettoProprietario = new IDSoggetto(portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario());
-
- if(portaDelegata.getGestioneToken()!=null) {
- String gestioneTokenPolicy = portaDelegata.getGestioneToken().getPolicy();
- if( gestioneTokenPolicy == null ||
- gestioneTokenPolicy.equals("") ||
- gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
- tokenAbilitato = false;
- }
- }
- else {
- tokenAbilitato = false;
- }
- }
- }
-
- // GroupBy
- if(!TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(modalitaRisorsa) &&
- (infoPolicy==null || infoPolicy.getTipoRisorsa()==null || !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa()))) {
- addToDatiAttivazioneGroupBy(dati, tipoOperazione, policy, nomeSezione, infoPolicy,
- ruoloPorta, nomePorta, serviceBinding,
- tokenAbilitato
- );
- }
-
- // Filtro
- addToDatiAttivazioneFiltro(dati, tipoOperazione, policy, nomeSezione, infoPolicy, ruoloPorta, nomePorta, serviceBinding,
- idSoggettoProprietario, tokenAbilitato,
- tipoAutenticazione, appId, tokenPolicy,
- pddTipologiaSoggettoAutenticati, gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore
- );
-
- }
-
- }
-
- else{
-
- // jmx
-
- List<String> aliases = this.core.getJmxPdDAliases();
- if(aliases==null || aliases.size()<=0){
- throw new DriverControlStationException("Pagina non prevista, la sezione configurazione non permette di accedere a questa pagina, se la configurazione non e' corretta");
- }
-
- String jmxResetParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET);
- boolean jmxReset = jmxResetParam!=null && !"".equals(jmxResetParam);
- String aliasJmxReset = null;
- if(jmxReset){
- if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET_ALL_VALUE.equals(jmxResetParam)==false){
- aliasJmxReset = jmxResetParam;
- }
- }
- boolean showResetCounters = (infoPolicy.isCheckRichiesteSimultanee()==false) &&
- (infoPolicy.isIntervalloUtilizzaRisorseRealtime() || infoPolicy.isDegradoPrestazionaleUtilizzaRisorseRealtime());
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INFORMAZIONI_RUNTIME);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // Link refresh
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_REFRESH);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_REFRESH);
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- parRuoloPorta, parNomePorta,parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""));
- }
- de.setType(DataElementType.LINK);
- dati.add(de);
- if(showResetCounters && aliases.size()>1){
- // Link resetCounters
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_RESET);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_RESET_ALL_NODES);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_RESET_ALL_NODES);
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET_ALL_VALUE),
- parRuoloPorta, parNomePorta,parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET_ALL_VALUE));
- }
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- int i=0;
- for (String alias : aliases) {
-
- String descrizioneAlias = this.core.getJmxPdDDescrizione(alias);
-
- de = new DataElement();
- de.setLabel(descrizioneAlias);
- de.setValue(descrizioneAlias);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- if(jmxReset && (aliasJmxReset==null || aliasJmxReset.equals(alias))){
-
- String resultReset = null;
- String uniqueIdMap = null;
- try{
- uniqueIdMap = UniqueIdentifierUtilities.getUniqueId(policy);
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE,
- JMXConstants.JMX_NAME,
- JMXConstants.CC_METHOD_NAME_RESET_POLICY_COUNTERS,
- uniqueIdMap);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+JMXConstants.CC_METHOD_NAME_RESET_POLICY_COUNTERS+"] sulla risorsa ["+JMXConstants.JMX_NAME+"] (param:"+uniqueIdMap+"): "+e.getMessage();
- ControlStationCore.getLog().error(errorMessage,e);
- resultReset = errorMessage;
- }
-
- de = new DataElement();
- de.setType(DataElementType.NOTE);
- de.setValue(resultReset);
- dati.add(de);
-
- }
-
- // Link resetCounters
- if(showResetCounters){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_RESET+"_"+i);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_RESET);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_VISUALIZZA_STATO_RESET);
- if(ruoloPorta!=null) {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET, alias),
- parRuoloPorta, parNomePorta,parServiceBinding);
- }
- else {
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CONTROLLO_TRAFFICO_ATTIVAZIONE_POLICY_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ID,policy.getId()+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE, true+""),
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_RESET, alias));
- }
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- String result = null;
- String uniqueIdMap = null;
- try{
- uniqueIdMap = UniqueIdentifierUtilities.getUniqueId(policy);
- result = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE,
- JMXConstants.JMX_NAME,
- JMXConstants.CC_METHOD_NAME_GET_STATO_POLICY,
- uniqueIdMap);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+JMXConstants.CC_METHOD_NAME_GET_STATO_POLICY+"] sulla risorsa ["+JMXConstants.JMX_NAME+"] (param:"+uniqueIdMap+"): "+e.getMessage();
- ControlStationCore.getLog().error(errorMessage,e);
- result = errorMessage;
- }
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_JMX_STATE);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setRows(20);
- de.setCols(100);
- de.setValue(result);
- dati.add(de);
-
- this.pd.disableEditMode();
-
- i++;
- }
-
- }
- }
-
- protected void addToDatiDataElementStato_postBackViaGET(List<DataElement> dati, String param, String label, boolean enabled, boolean postBack, boolean withWarningOnly,
- boolean warningOnly, boolean hidden){
- this._addToDatiDataElementStato(dati, param, label, enabled, postBack, false, withWarningOnly, warningOnly, hidden);
- }
- protected void addToDatiDataElementStato_postBackViaPOST(List<DataElement> dati, String param, String label, boolean enabled, boolean postBackPOST, boolean withWarningOnly,
- boolean warningOnly, boolean hidden){
- this._addToDatiDataElementStato(dati, param, label, enabled, false, postBackPOST, withWarningOnly, warningOnly, hidden);
- }
-
- private void _addToDatiDataElementStato(List<DataElement> dati, String param, String label, boolean enabled, boolean postBack, boolean postBackPOST, boolean withWarningOnly,
- boolean warningOnly, boolean hidden){
- DataElement de = new DataElement();
- de.setName(param);
- de.setLabel(label);
- if(hidden) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.SELECT);
- if(withWarningOnly){
- de.setValues(ConfigurazioneCostanti.STATI_CON_WARNING);
- }
- else{
- de.setValues(ConfigurazioneCostanti.STATI);
- }
- if(postBack) {
- de.setPostBack(postBack);
- }
- if(postBackPOST) {
- de.setPostBack_viaPOST(postBackPOST);
- }
- }
- if(enabled && (!withWarningOnly || !warningOnly) ){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else if(warningOnly && withWarningOnly){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY);
- }
- else{
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- dati.add(de);
- }
- private void addToDatiDataElementStatoReadOnly(List<DataElement> dati, String param, String label, boolean enabled, boolean postBack,
- boolean withWarningOnly, boolean warningOnly){
- DataElement de = new DataElement();
- de.setName(param);
- de.setLabel(label);
- de.setType(DataElementType.HIDDEN);
- if(enabled && (!withWarningOnly || !warningOnly) ){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else if(warningOnly && withWarningOnly){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY);
- }
- else{
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- dati.add(de);
-
- de = new DataElement();
- de.setName(param+"___LABEL");
- de.setLabel(label);
- de.setType(DataElementType.TEXT);
- if(enabled && (!withWarningOnly || !warningOnly) ){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else if(warningOnly && withWarningOnly){
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_STATO_WARNING_ONLY);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_WARNING_ONLY);
- }
- else{
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- dati.add(de);
-
- }
-
- private void addToDatiAttivazioneFiltro(List<DataElement> dati, TipoOperazione tipoOperazione,AttivazionePolicy policy, String nomeSezione, InfoPolicy infoPolicy,
- RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding,
- IDSoggetto idSoggettoProprietario, boolean tokenAbilitato,
- CredenzialeTipo tipoAutenticazione, Boolean appId, String tokenPolicy,
- PddTipologia pddTipologiaSoggettoAutenticati, boolean gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- org.openspcoop2.core.config.constants.CredenzialeTipo tipoAutenticazioneConfig = null;
- if(tipoAutenticazione!=null) {
- tipoAutenticazioneConfig = org.openspcoop2.core.config.constants.CredenzialeTipo.toEnumConstant(tipoAutenticazione.getValue(), true);
- }
-
- boolean tokenPolicyOR = false;
- if(tokenPolicy!=null && !"".equals(tokenPolicy)) {
- if(tipoAutenticazione!=null && !org.openspcoop2.core.config.constants.CredenzialeTipo.TOKEN.equals(tipoAutenticazioneConfig)) {
- tokenPolicyOR = true;
- }
- else {
- tipoAutenticazioneConfig = org.openspcoop2.core.config.constants.CredenzialeTipo.TOKEN;
- }
- }
-
- boolean multitenant = this.confCore.isMultitenant();
-
-
- // Elaboro valori con dipendenze
-
- List<String> protocolliLabel = null;
- List<String> protocolliValue = null;
- String protocolloSelezionatoLabel = null;
- String protocolloSelezionatoValue = null;
-
- List<String> ruoliErogatoreLabel = null;
- List<String> ruoliErogatoreValue = null;
- String ruoloErogatoreSelezionatoLabel = null;
- String ruoloErogatoreSelezionatoValue = null;
-
- List<String> erogatoriLabel = null;
- List<String> erogatoriValue = null;
- String datiIdentificativiErogatoreSelezionatoLabel = null;
- String datiIdentificativiErogatoreSelezionatoValue = null;
-
- List<String> tagLabel = null;
- List<String> tagValue = null;
- @SuppressWarnings("unused")
- String datiIdentificativiTagSelezionatoLabel = null;
- String datiIdentificativiTagSelezionatoValue = null;
-
- List<String> serviziLabel = null;
- List<String> serviziValue = null;
- String datiIdentificativiServizioSelezionatoLabel = null;
- String datiIdentificativiServizioSelezionatoValue = null;
-
- List<String> azioniLabel = null;
- List<String> azioniValue = null;
- List<String> azioniSelezionataLabel = null;
- List<String> azioniSelezionataValue = null;
-
- List<String> serviziApplicativiErogatoreLabel = null;
- List<String> serviziApplicativiErogatoreValue = null;
- String servizioApplicativoErogatoreSelezionatoLabel = null;
- String servizioApplicativoErogatoreSelezionatoValue = null;
-
- List<String> ruoliFruitoreLabel = null;
- List<String> ruoliFruitoreValue = null;
- String ruoloFruitoreSelezionatoLabel = null;
- String ruoloFruitoreSelezionatoValue = null;
-
- List<String> fruitoriLabel = null;
- List<String> fruitoriValue = null;
- String datiIdentificativiFruitoreSelezionatoLabel = null;
- String datiIdentificativiFruitoreSelezionatoValue = null;
-
- List<String> serviziApplicativiFruitoreLabel = null;
- List<String> serviziApplicativiFruitoreValue = null;
- String servizioApplicativoFruitoreSelezionatoLabel = null;
- String servizioApplicativoFruitoreSelezionatoValue = null;
-
- String tokenClaims = null;
-
- boolean filtroByKey = false;
-
- // Cerco Ruoli con queste caratteristiche
- FiltroRicercaRuoli filtroRuoli = new FiltroRicercaRuoli();
- filtroRuoli.setTipologia(RuoloTipologia.INTERNO);
-
- boolean protocolloAssociatoFiltroNonSelezionatoUtente = false;
- if(policy.getFiltro().isEnabled()){
- protocolliValue = this.confCore.getProtocolli(this.request, this.session);
- if(policy.getFiltro().getProtocollo()!=null) {
- // sara' sempre impostato, a meno della prima volta (create policy)
- if(protocolliValue.contains(policy.getFiltro().getProtocollo())==false) {
- protocolloAssociatoFiltroNonSelezionatoUtente = true;
- }
- }
- }
-
- if(policy.getFiltro().isEnabled()){
-
- // protocollo
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- protocolloSelezionatoValue = policy.getFiltro().getProtocollo();
- }
- else {
- if(!protocolliValue.contains(policy.getFiltro().getProtocollo())){
- policy.getFiltro().setProtocollo(null);
- }
- protocolloSelezionatoValue = policy.getFiltro().getProtocollo();
- if(protocolloSelezionatoValue==null || protocolloSelezionatoValue.equals("")) {
- if(protocolliValue.size()==1) {
- protocolloSelezionatoValue = protocolliValue.get(0);
- }
- else {
- protocolloSelezionatoValue = this.confCore.getProtocolloDefault(this.request, this.session, protocolliValue);
- }
- }
- //protocolli = enrichListConQualsiasi(protocolli); NOTA: In questa versione un protocollo deve essere per forza selezionato.
- protocolliLabel = new ArrayList<>();
- for (String protocollo : protocolliValue) {
- protocolliLabel.add(this.getLabelProtocollo(protocollo));
- }
- }
- protocolloSelezionatoLabel = this.getLabelProtocollo(protocolloSelezionatoValue);
- }
- else {
- protocolloSelezionatoValue = policy.getFiltro().getProtocollo();
- if(protocolloSelezionatoValue==null) {
- protocolloSelezionatoValue = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(idSoggettoProprietario.getTipo());
- }
- }
-
- // ruolo erogatore
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- ruoloErogatoreSelezionatoValue = policy.getFiltro().getRuoloErogatore();
- ruoloErogatoreSelezionatoLabel = ruoloErogatoreSelezionatoValue!=null ? ruoloErogatoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<String> ruoliErogatore = this.core.getAllRuoli(filtroRuoli);
-
- if(policy.getFiltro().getRuoloErogatore()!=null) {
- ruoloErogatoreSelezionatoValue = policy.getFiltro().getRuoloErogatore();
- }
- if(!ruoliErogatore.contains(ruoloErogatoreSelezionatoValue)){
- policy.getFiltro().setRuoloErogatore(null);
- ruoloErogatoreSelezionatoValue = null;
- }
- ruoliErogatoreLabel = enrichListConLabelQualsiasi(ruoliErogatore);
- ruoliErogatoreValue = enrichListConValueQualsiasi(ruoliErogatore);
- }
- }
-
- // erogatore
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDSoggetto idSoggetto = null;
- if(policy.getFiltro().getTipoErogatore()!=null && policy.getFiltro().getNomeErogatore()!=null){
- datiIdentificativiErogatoreSelezionatoValue = policy.getFiltro().getTipoErogatore() + "/" + policy.getFiltro().getNomeErogatore();
- idSoggetto = new IDSoggetto(policy.getFiltro().getTipoErogatore() , policy.getFiltro().getNomeErogatore());
- }
- datiIdentificativiErogatoreSelezionatoLabel = idSoggetto!=null ? this.getLabelNomeSoggetto(idSoggetto) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<IDSoggetto> listErogatori = new ArrayList<>();
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggettiErogatori(protocolloSelezionatoValue, protocolliValue);
- if(policy.getFiltro().getRuoloPorta()!=null && !RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta())) {
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(RuoloPolicy.DELEGATA.equals(policy.getFiltro().getRuoloPorta())) {
- if(isPddEsterna) {
- listErogatori.add(idSoggetto);
- }
- else {
- if(!PddTipologia.ESTERNO.equals(pddTipologiaSoggettoAutenticati)) {
- // multitenant abilitato
- listErogatori.add(idSoggetto);
- }
- }
- }
- else {
- if(!isPddEsterna) {
- listErogatori.add(idSoggetto);
- }
- }
- }
- }
- else {
- listErogatori.addAll(listSoggettiPreFilterMultitenant);
- }
-
- erogatoriLabel = new ArrayList<>();
- erogatoriValue = new ArrayList<>();
- for (IDSoggetto idSoggetto : listErogatori) {
- erogatoriLabel.add(this.getLabelNomeSoggetto(idSoggetto));
- erogatoriValue.add(idSoggetto.getTipo()+"/"+idSoggetto.getNome());
- }
- if(policy.getFiltro().getTipoErogatore()!=null && policy.getFiltro().getNomeErogatore()!=null){
- datiIdentificativiErogatoreSelezionatoValue = policy.getFiltro().getTipoErogatore() + "/" + policy.getFiltro().getNomeErogatore();
- }
- if(!erogatoriValue.contains(datiIdentificativiErogatoreSelezionatoValue)){
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- datiIdentificativiErogatoreSelezionatoValue = null;
- }
- erogatoriLabel = enrichListConLabelQualsiasi(erogatoriLabel);
- erogatoriValue = enrichListConValueQualsiasi(erogatoriValue);
- }
- }
-
- // tag
- if(configurazione) {
- FiltroRicercaGruppi filtroRicerca = new FiltroRicercaGruppi();
- List<String> elencoGruppi = this.gruppiCore.getAllGruppi(filtroRicerca);
- tagLabel = enrichListConLabelQualsiasi(elencoGruppi);
- tagValue = enrichListConValueQualsiasi(elencoGruppi);
- datiIdentificativiTagSelezionatoValue=policy.getFiltro().getTag();
- datiIdentificativiTagSelezionatoLabel=policy.getFiltro().getTag();
- }
-
- // servizio
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDServizio idServizio = null;
- if(policy.getFiltro().getTipoServizio()!=null && policy.getFiltro().getNomeServizio()!=null && policy.getFiltro().getVersioneServizio()!=null &&
- policy.getFiltro().getTipoErogatore()!=null && policy.getFiltro().getNomeErogatore()!=null
- ){
- datiIdentificativiServizioSelezionatoValue = policy.getFiltro().getTipoServizio()+"/"+policy.getFiltro().getNomeServizio()+"/"+policy.getFiltro().getVersioneServizio().intValue();
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- datiIdentificativiServizioSelezionatoValue = datiIdentificativiServizioSelezionatoValue+"/"+policy.getFiltro().getTipoErogatore()+"/"+policy.getFiltro().getNomeErogatore();
- idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(policy.getFiltro().getTipoServizio(),
- policy.getFiltro().getNomeServizio(),
- policy.getFiltro().getTipoErogatore(),
- policy.getFiltro().getNomeErogatore(),
- policy.getFiltro().getVersioneServizio());
- }
- else {
- idServizio = IDServizioFactory.getInstance().getIDServizioFromValuesWithoutCheck(policy.getFiltro().getTipoServizio(),
- policy.getFiltro().getNomeServizio(),
- null,
- null,
- policy.getFiltro().getVersioneServizio());
- }
- }
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- datiIdentificativiServizioSelezionatoLabel = idServizio!=null ? this.getLabelIdServizio(idServizio) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- datiIdentificativiServizioSelezionatoLabel = idServizio!=null ? this.getLabelIdServizioSenzaErogatore(idServizio) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- }
- else {
- List<IDServizio> listServizi = this.confCore.getServizi(protocolloSelezionatoValue, protocolliValue,
- policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(), policy.getFiltro().getTag());
- serviziLabel = new ArrayList<>();
- serviziValue = new ArrayList<>();
- for (IDServizio idServizio : listServizi) {
-
- String valueAPI = idServizio.getTipo()+"/"+idServizio.getNome()+"/"+idServizio.getVersione().intValue();
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- valueAPI = valueAPI +"/"+ idServizio.getSoggettoErogatore().getTipo()+"/"+idServizio.getSoggettoErogatore().getNome();
- }
- if(serviziValue.contains(valueAPI)) {
- continue;
- }
- serviziValue.add(valueAPI);
-
- String labelAPI = null;
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- labelAPI = this.getLabelIdServizio(idServizio);
- }
- else {
- labelAPI = this.getLabelIdServizioSenzaErogatore(idServizio);
- }
- serviziLabel.add(labelAPI);
- }
- boolean definedApi = policy.getFiltro().getTipoServizio()!=null && policy.getFiltro().getNomeServizio()!=null && policy.getFiltro().getVersioneServizio()!=null;
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- definedApi = definedApi && policy.getFiltro().getTipoErogatore()!=null && policy.getFiltro().getNomeErogatore()!=null;
- }
- if( definedApi ){
- datiIdentificativiServizioSelezionatoValue = policy.getFiltro().getTipoServizio()+"/"+policy.getFiltro().getNomeServizio()+"/"+policy.getFiltro().getVersioneServizio().intValue();
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- datiIdentificativiServizioSelezionatoValue = datiIdentificativiServizioSelezionatoValue +"/"+policy.getFiltro().getTipoErogatore()+"/"+policy.getFiltro().getNomeErogatore();
- }
- }
- if(!serviziValue.contains(datiIdentificativiServizioSelezionatoValue)){
- policy.getFiltro().setTipoServizio(null);
- policy.getFiltro().setNomeServizio(null);
- policy.getFiltro().setVersioneServizio(null);
- datiIdentificativiServizioSelezionatoValue = null;
- }
- serviziLabel = enrichListConLabelQualsiasi(serviziLabel);
- serviziValue = enrichListConValueQualsiasi(serviziValue);
- }
- }
-
- // azioni
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(policy.getFiltro().getAzione()!=null && !"".equals(policy.getFiltro().getAzione())){
- azioniSelezionataValue = new ArrayList<>();
- if(policy.getFiltro().getAzione().contains(",")) {
- String [] tmp = policy.getFiltro().getAzione().split(",");
- for (String az : tmp) {
- azioniSelezionataValue.add(az);
- }
- }
- else {
- azioniSelezionataValue.add(policy.getFiltro().getAzione());
- }
- if(!azioniSelezionataValue.isEmpty()) {
- azioniSelezionataLabel = new ArrayList<>();
- for (String az : azioniSelezionataValue) {
- azioniSelezionataLabel.add(az);
- }
- }
- }
- if(azioniSelezionataLabel==null) {
- azioniSelezionataLabel = new ArrayList<>();
- azioniSelezionataLabel.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- }
- }
- else {
- List<String> azioni = null;
- Map<String,String> azioniConLabel = null;
- if(configurazione && datiIdentificativiServizioSelezionatoValue!=null) {
- if(StringUtils.isNotEmpty(policy.getFiltro().getTipoServizio()) &&
- StringUtils.isNotEmpty(policy.getFiltro().getNomeServizio()) &&
- policy.getFiltro().getVersioneServizio()!=null && policy.getFiltro().getVersioneServizio()>0) {
- if(StringUtils.isNotEmpty(policy.getFiltro().getTipoErogatore()) &&
- StringUtils.isNotEmpty(policy.getFiltro().getNomeErogatore())) {
- IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(),
- policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(),
- policy.getFiltro().getVersioneServizio());
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else {
- List<IDServizio> listServizi = this.confCore.getServizi(protocolloSelezionatoValue, protocolliValue,
- policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(), policy.getFiltro().getVersioneServizio(), null);
- List<String> uris = new ArrayList<>();
- AccordoServizioParteSpecifica aspsRiferimento = null;
- if(listServizi!=null && !listServizi.isEmpty()) {
- for (IDServizio idS : listServizi) {
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idS,false);
- if(!uris.contains(asps.getAccordoServizioParteComune())) {
- uris.add(asps.getAccordoServizioParteComune());
- if(aspsRiferimento==null) {
- aspsRiferimento = asps;
- }
- }
- if(uris.size()>1) {
- break;
- }
- }
- }
- if(uris.size()==1) {
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(uris.get(0)));
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(aspsRiferimento, aspc, false, true, null);
- }
- }
- }
- azioni = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(),
- policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(), policy.getFiltro().getVersioneServizio());
- }
- else if(delegata) {
- IDPortaDelegata idPD = new IDPortaDelegata();
- idPD.setNome(policy.getFiltro().getNomePorta());
- PortaDelegata pd = this.porteDelegateCore.getPortaDelegata(idPD);
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(pd);
- IDServizio idServizio = mappingPD.getIdServizio();
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
-
- if(pd.getAzione()!=null && pd.getAzione().sizeAzioneDelegataList()>0) {
- azioni = pd.getAzione().getAzioneDelegataList();
- }
- else {
- List<String> azioniAll = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- pd.getSoggettoErogatore().getTipo(), pd.getSoggettoErogatore().getNome(),
- pd.getServizio().getTipo(), pd.getServizio().getNome(), pd.getServizio().getVersione());
-
- IDSoggetto idSoggettoFruitore = mappingPD.getIdFruitore();
- List<MappingFruizionePortaDelegata> listaMappingFruizione = this.apsCore.serviziFruitoriMappingList(idSoggettoFruitore, idServizio, null);
- List<String> azioniOccupate = new ArrayList<>();
- int listaMappingFruizioneSize = listaMappingFruizione != null ? listaMappingFruizione.size() : 0;
- if(listaMappingFruizioneSize > 0) {
- for (int i = 0; i < listaMappingFruizione.size(); i++) {
- MappingFruizionePortaDelegata mappingFruizionePortaDelegata = listaMappingFruizione.get(i);
- // colleziono le azioni gia' configurate
- PortaDelegata portaDelegataTmp = this.porteDelegateCore.getPortaDelegata(mappingFruizionePortaDelegata.getIdPortaDelegata());
- if(portaDelegataTmp.getAzione() != null && portaDelegataTmp.getAzione().getAzioneDelegataList() != null)
- azioniOccupate.addAll(portaDelegataTmp.getAzione().getAzioneDelegataList());
- }
- }
-
- azioni = new ArrayList<>();
- for (int i = 0; i < azioniAll.size(); i++) {
- String az = azioniAll.get(i);
- if(azioniOccupate.contains(az)==false) {
- azioni.add(az);
- }
- }
- }
-
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else if(applicativa) {
- IDPortaApplicativa idPA = new IDPortaApplicativa();
- idPA.setNome(policy.getFiltro().getNomePorta());
- PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idPA);
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(pa);
- IDServizio idServizio = mappingPA.getIdServizio();
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
-
- if(pa.getAzione()!=null && pa.getAzione().sizeAzioneDelegataList()>0) {
- azioni = pa.getAzione().getAzioneDelegataList();
- }
- else {
- List<String> azioniAll = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
- pa.getServizio().getTipo(), pa.getServizio().getNome(), pa.getServizio().getVersione());
-
- List<MappingErogazionePortaApplicativa> listaMappingErogazione = this.apsCore.mappingServiziPorteAppList(idServizio, null);
- List<String> azioniOccupate = new ArrayList<>();
- int listaMappingErogazioneSize = listaMappingErogazione != null ? listaMappingErogazione.size() : 0;
- if(listaMappingErogazioneSize > 0) {
- for (int i = 0; i < listaMappingErogazione.size(); i++) {
- MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa = listaMappingErogazione.get(i);
- // colleziono le azioni gia' configurate
- PortaApplicativa portaApplicativaTmp = this.porteApplicativeCore.getPortaApplicativa(mappingErogazionePortaApplicativa.getIdPortaApplicativa());
- if(portaApplicativaTmp.getAzione() != null && portaApplicativaTmp.getAzione().getAzioneDelegataList() != null)
- azioniOccupate.addAll(portaApplicativaTmp.getAzione().getAzioneDelegataList());
- }
- }
-
- azioni = new ArrayList<>();
- for (int i = 0; i < azioniAll.size(); i++) {
- String az = azioniAll.get(i);
- if(azioniOccupate.contains(az)==false) {
- azioni.add(az);
- }
- }
- }
-
- azioniConLabel = this.porteApplicativeCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else {
- azioni = new ArrayList<>();
- }
- if(policy.getFiltro().getAzione()!=null && !"".equals(policy.getFiltro().getAzione())){
- azioniSelezionataValue = new ArrayList<>();
- if(policy.getFiltro().getAzione().contains(",")) {
- String [] tmp = policy.getFiltro().getAzione().split(",");
- for (String az : tmp) {
- if(azioni.contains(az)){
- azioniSelezionataValue.add(az);
- }
- }
- }
- else {
- if(azioni.contains(policy.getFiltro().getAzione())){
- azioniSelezionataValue.add(policy.getFiltro().getAzione());
- }
- }
- }
- if(azioniSelezionataValue==null || azioniSelezionataValue.isEmpty()) {
- azioniSelezionataValue = null;
- }
- if(azioniConLabel!=null && azioniConLabel.size()>0) {
- azioniLabel = new ArrayList<>();
- azioniValue = new ArrayList<>();
- for (String idAzione : azioniConLabel.keySet()) {
- if(azioni.contains(idAzione)) {
- azioniValue.add(idAzione);
- azioniLabel.add(azioniConLabel.get(idAzione));
- }
- }
-
- // azioniLabel = enrichListConLabelQualsiasi(azioniLabel);
- // azioniValue = enrichListConValueQualsiasi(azioniValue);
- }
- else {
- // azioniLabel = enrichListConLabelQualsiasi(azioni);
- // azioniValue = enrichListConValueQualsiasi(azioni);
- azioniLabel = azioni;
- azioniValue = azioni;
- }
- }
-
- // servizi applicativi erogatore
- if(configurazione) {
- if(policy.getFiltro().getRuoloPorta()==null ||
- RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta()) ||
- RuoloPolicy.APPLICATIVA.equals(policy.getFiltro().getRuoloPorta())){
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(policy.getFiltro().getServizioApplicativoErogatore()!=null){
- servizioApplicativoErogatoreSelezionatoValue = policy.getFiltro().getServizioApplicativoErogatore();
- }
- servizioApplicativoErogatoreSelezionatoLabel = servizioApplicativoErogatoreSelezionatoValue!=null ? servizioApplicativoErogatoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- serviziApplicativiErogatoreLabel = new ArrayList<>();
- serviziApplicativiErogatoreValue = new ArrayList<>();
- if(datiIdentificativiErogatoreSelezionatoValue!=null) {
- List<IDServizioApplicativo> listSA = this.confCore.getServiziApplicativiErogatori(protocolloSelezionatoValue, protocolliValue,
- policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(),
- policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(), policy.getFiltro().getVersioneServizio(),
- null);
- for (IDServizioApplicativo idServizioApplicativo : listSA) {
- serviziApplicativiErogatoreLabel.add(idServizioApplicativo.getNome());
- serviziApplicativiErogatoreValue.add(idServizioApplicativo.getNome());
- }
- }
-
- if(policy.getFiltro().getServizioApplicativoErogatore()!=null){
- servizioApplicativoErogatoreSelezionatoValue = policy.getFiltro().getServizioApplicativoErogatore();
- }
- if(!serviziApplicativiErogatoreValue.contains(servizioApplicativoErogatoreSelezionatoValue)){
- policy.getFiltro().setServizioApplicativoErogatore(null);
- servizioApplicativoErogatoreSelezionatoValue = null;
- }
- serviziApplicativiErogatoreLabel = enrichListConLabelQualsiasi(serviziApplicativiErogatoreLabel);
- serviziApplicativiErogatoreValue = enrichListConValueQualsiasi(serviziApplicativiErogatoreValue);
- }
- }
- }
-
- // ruolo fruitore (diventa ruolo richiedente nel caso di porta)
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(policy.getFiltro().getRuoloFruitore()!=null) {
- ruoloFruitoreSelezionatoValue = policy.getFiltro().getRuoloFruitore();
- }
- ruoloFruitoreSelezionatoLabel = ruoloFruitoreSelezionatoValue!=null ? ruoloFruitoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<String> ruoliFruitore = this.core.getAllRuoli(filtroRuoli);
- if(policy.getFiltro().getRuoloFruitore()!=null) {
- ruoloFruitoreSelezionatoValue = policy.getFiltro().getRuoloFruitore();
- }
- if(!ruoliFruitore.contains(ruoloFruitoreSelezionatoValue)){
- policy.getFiltro().setRuoloFruitore(null);
- ruoloFruitoreSelezionatoValue = null;
- }
- ruoliFruitoreLabel = enrichListConLabelQualsiasi(ruoliFruitore);
- ruoliFruitoreValue = enrichListConValueQualsiasi(ruoliFruitore);
- }
-
- // fruitore
- if(configurazione || applicativa) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDSoggetto idSoggetto = null;
- if(policy.getFiltro().getTipoFruitore()!=null && policy.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = policy.getFiltro().getTipoFruitore() + "/" + policy.getFiltro().getNomeFruitore();
- idSoggetto = new IDSoggetto(policy.getFiltro().getTipoFruitore() , policy.getFiltro().getNomeFruitore());
- }
- datiIdentificativiFruitoreSelezionatoLabel = idSoggetto!=null ? this.getLabelNomeSoggetto(idSoggetto) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- // List<IDSoggetto> listFruitori = this.confCore.getSoggettiFruitori(protocolloSelezionatoValue, protocolliValue,
- // policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(),
- // policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(), policy.getFiltro().getVersioneServizio());
-
- List<IDSoggetto> listSoggetti = new ArrayList<>();
- if(configurazione) {
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggetti(protocolloSelezionatoValue, protocolliValue);
- if(policy.getFiltro().getRuoloPorta()!=null && !RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta())) {
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(RuoloPolicy.APPLICATIVA.equals(policy.getFiltro().getRuoloPorta())) {
- if(isPddEsterna) {
- listSoggetti.add(idSoggetto);
- }
- else {
- if(!PddTipologia.ESTERNO.equals(pddTipologiaSoggettoAutenticati)) {
- // multitenant abilitato
- listSoggetti.add(idSoggetto);
- }
- }
- }
- else {
- if(!isPddEsterna) {
- listSoggetti.add(idSoggetto);
- }
- }
- }
- }
- else {
- listSoggetti.addAll(listSoggettiPreFilterMultitenant);
- }
- }
- else {
-
- User user = ServletUtils.getUserFromSession(this.request, this.session);
- String userLogin = user.getLogin();
-
- List<String> tipiSoggettiGestitiProtocollo = this.soggettiCore.getTipiSoggettiGestitiProtocollo(protocolloSelezionatoValue);
-
- List<IDSoggettoDB> list = null;
- if(this.core.isVisioneOggettiGlobale(userLogin)){
- list = this.soggettiCore.getSoggettiFromTipoAutenticazione(tipiSoggettiGestitiProtocollo, null, tipoAutenticazione, appId, pddTipologiaSoggettoAutenticati);
- }else{
- list = this.soggettiCore.getSoggettiFromTipoAutenticazione(tipiSoggettiGestitiProtocollo, userLogin, tipoAutenticazione, appId, pddTipologiaSoggettoAutenticati);
- }
- if(list!=null && !list.isEmpty() && gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore) {
- for (int i = 0; i < list.size(); i++) {
- IDSoggettoDB soggettoCheck = list.get(i);
- if(soggettoCheck.getTipo().equals(idSoggettoProprietario.getTipo()) && soggettoCheck.getNome().equals(idSoggettoProprietario.getNome())) {
- list.remove(i);
- break;
- }
- }
- }
-
- if(list==null) {
- list = new ArrayList<>();
- }
-
- // soggetti esterni
- boolean isSupportatoAutenticazioneApplicativiEsterni = false;
- if(protocolloSelezionatoValue!=null && !"".equals(protocolloSelezionatoValue)) {
- isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocolloSelezionatoValue);
- }
-
- // multitenant: aggiungo soggetti operativi per poi poter selezionare un applicativo
- // isSupportatoAutenticazioneApplicativiEsterni: aggiungo i soggettti che possiedono applicativi esterno
- if(isSupportatoAutenticazioneApplicativiEsterni || multitenant) {
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggetti(protocolloSelezionatoValue, protocolliValue);
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
-
- boolean found = false;
- if( (multitenant && !isPddEsterna)
- ||
- (isSupportatoAutenticazioneApplicativiEsterni && isPddEsterna)) {
- for (IDSoggettoDB sogg : list) {
- if(sogg.getTipo().equals(s.getTipo()) && sogg.getNome().equals(s.getNome())) {
- found = true;
- break;
- }
- }
- }
-
- boolean bothSslAndToken = false;
-
- if(!found && multitenant && !isPddEsterna) {
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggetto,userLogin,tipoAutenticazioneConfig, appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- IDSoggettoDB idSoggettoDB = new IDSoggettoDB();
- idSoggettoDB.setTipo(s.getTipo());
- idSoggettoDB.setNome(s.getNome());
- idSoggettoDB.setCodicePorta(s.getIdentificativoPorta());
- idSoggettoDB.setId(s.getId());
- list.add(idSoggettoDB);
- }
- }
-
- if(!found && isSupportatoAutenticazioneApplicativiEsterni && isPddEsterna) {
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggetto,userLogin,tipoAutenticazioneConfig, appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- IDSoggettoDB idSoggettoDB = new IDSoggettoDB();
- idSoggettoDB.setTipo(s.getTipo());
- idSoggettoDB.setNome(s.getNome());
- idSoggettoDB.setCodicePorta(s.getIdentificativoPorta());
- idSoggettoDB.setId(s.getId());
- list.add(idSoggettoDB);
- }
- }
- }
- }
-
- if(!list.isEmpty()) {
- for (IDSoggettoDB soggetto : list) {
- listSoggetti.add(new IDSoggetto(soggetto.getTipo(), soggetto.getNome()));
- }
- }
-
- }
-
- fruitoriLabel = new ArrayList<>();
- fruitoriValue = new ArrayList<>();
- for (IDSoggetto idSoggetto : listSoggetti) {
- fruitoriLabel.add(this.getLabelNomeSoggetto(idSoggetto));
- fruitoriValue.add(idSoggetto.getTipo()+"/"+idSoggetto.getNome());
- }
- if(policy.getFiltro().getTipoFruitore()!=null && policy.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = policy.getFiltro().getTipoFruitore() + "/" + policy.getFiltro().getNomeFruitore();
- }
- if(!fruitoriValue.contains(datiIdentificativiFruitoreSelezionatoValue)){
- policy.getFiltro().setTipoFruitore(null);
- policy.getFiltro().setNomeFruitore(null);
- datiIdentificativiFruitoreSelezionatoValue = null;
- }
- fruitoriLabel = enrichListConLabelQualsiasi(fruitoriLabel);
- fruitoriValue = enrichListConValueQualsiasi(fruitoriValue);
- }
- }
- else {
- if(delegata) {
- if(policy.getFiltro().getTipoFruitore()!=null && policy.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = policy.getFiltro().getTipoFruitore() + "/" + policy.getFiltro().getNomeFruitore();
- }
- }
- }
-
- // servizi applicativi fruitore
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(policy.getFiltro().getServizioApplicativoFruitore()!=null){
- servizioApplicativoFruitoreSelezionatoValue = policy.getFiltro().getServizioApplicativoFruitore();
- }
- servizioApplicativoFruitoreSelezionatoLabel = servizioApplicativoFruitoreSelezionatoValue!=null ? servizioApplicativoFruitoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
-
- IDSoggetto soggettoProprietarioServiziApplicativi = null;
- if(datiIdentificativiFruitoreSelezionatoValue!=null || !configurazione) {
- String tipoFruitore = null;
- String nomeFruitore = null;
- if(datiIdentificativiFruitoreSelezionatoValue!=null) {
- tipoFruitore = policy.getFiltro().getTipoFruitore();
- nomeFruitore = policy.getFiltro().getNomeFruitore();
- }
- else {
- tipoFruitore = idSoggettoProprietario.getTipo();
- nomeFruitore = idSoggettoProprietario.getNome();
- }
- soggettoProprietarioServiziApplicativi = new IDSoggetto(tipoFruitore, nomeFruitore);
- }
-
- if(soggettoProprietarioServiziApplicativi!=null) {
- serviziApplicativiFruitoreLabel = new ArrayList<>();
- serviziApplicativiFruitoreValue = new ArrayList<>();
- List<IDServizioApplicativo> listSA =null;
- if(configurazione) {
- listSA = this.confCore.getServiziApplicativiFruitore(protocolloSelezionatoValue, protocolliValue,
- soggettoProprietarioServiziApplicativi.getTipo(), soggettoProprietarioServiziApplicativi.getNome());
- }
- else {
-
- listSA = new ArrayList<>();
-
- User user = ServletUtils.getUserFromSession(this.request, this.session);
- String userLogin = user.getLogin();
-
- // soggetti esterni
- boolean isSupportatoAutenticazioneApplicativiEsterni = false;
- if(protocolloSelezionatoValue!=null && !"".equals(protocolloSelezionatoValue)) {
- isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocolloSelezionatoValue);
- }
-
- boolean bothSslAndToken = false;
-
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = null;
- if(delegata || !multitenant) {
- listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggettoProprietario,userLogin,tipoAutenticazioneConfig,appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- }
- else {
- // sull'applicativa con multitenant deve essere stata selezionato un soggetto operativo.
- if(policy.getFiltro().getTipoFruitore()!=null && policy.getFiltro().getNomeFruitore()!=null) {
- IDSoggetto idSoggettoSelezionato = new IDSoggetto(policy.getFiltro().getTipoFruitore(), policy.getFiltro().getNomeFruitore());
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggettoSelezionato);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(!isPddEsterna || isSupportatoAutenticazioneApplicativiEsterni) {
- listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggettoSelezionato,userLogin,tipoAutenticazioneConfig,appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- }
- }
- }
-
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- for (IDServizioApplicativoDB servizioApplicativo : listServiziApplicativiTmp) {
- IDServizioApplicativo idSA = new IDServizioApplicativo();
- idSA.setIdSoggettoProprietario(idSoggettoProprietario);
- idSA.setNome(servizioApplicativo.getNome());
- listSA.add(idSA);
- }
- }
-
- }
- for (IDServizioApplicativo idServizioApplicativo : listSA) {
- serviziApplicativiFruitoreLabel.add(idServizioApplicativo.getNome());
- serviziApplicativiFruitoreValue.add(idServizioApplicativo.getNome());
- }
-
- if(policy.getFiltro().getServizioApplicativoFruitore()!=null){
- servizioApplicativoFruitoreSelezionatoValue = policy.getFiltro().getServizioApplicativoFruitore();
- }
- if(!serviziApplicativiFruitoreValue.contains(servizioApplicativoFruitoreSelezionatoValue)){
- policy.getFiltro().setServizioApplicativoFruitore(null);
- servizioApplicativoFruitoreSelezionatoValue = null;
- }
- serviziApplicativiFruitoreLabel = enrichListConLabelQualsiasi(serviziApplicativiFruitoreLabel);
- serviziApplicativiFruitoreValue = enrichListConValueQualsiasi(serviziApplicativiFruitoreValue);
- }
- }
-
- tokenClaims = policy.getFiltro().getTokenClaims();
-
- // filtro by key se non sono richiesti campionamenti statistici
- // NON è vero. Il filtro ci può sempre essere
- //if(infoPolicy!=null && infoPolicy.isUtilizzoRisorseStatistiche()==false){
- if(infoPolicy!=null){
- filtroByKey = true;
- }
- }
-
-
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILTRO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- boolean filtroAbilitatoAPI = false;
- if(ruoloPorta!=null) {
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_FIRST_TIME);
- if(first) {
- String filtro = this.toStringCompactFilter(policy.getFiltro(),ruoloPorta,nomePorta,serviceBinding);
- filtroAbilitatoAPI = filtro!=null && !"".equals(filtro) && !CostantiControlStation.LABEL_STATO_DISABILITATO.equals(filtro);
- }
- else {
- String filtro = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED_CONSOLE_ONLY);
- filtroAbilitatoAPI = ServletUtils.isCheckBoxEnabled(filtro);
- }
- }
-
- // stato
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
-
- addToDatiDataElementStatoReadOnly(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED, policy.getFiltro().isEnabled(), true,
- false, false);
-
- if(policy.getFiltro().isEnabled()){
- de = new DataElement();
- de.setType(DataElementType.NOTE);
- de.setValue("Filtro non modificabile poichè definito per un "+CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_DI.toLowerCase()+" non attivo nella console");
- dati.add(de);
- }
- }
- else {
- boolean hidden = ruoloPorta!=null;
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED, policy.getFiltro().isEnabled(), true,
- false, false, hidden);
-
- if(ruoloPorta!=null) {
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED_CONSOLE_ONLY,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED, filtroAbilitatoAPI, true,
- false, false, false);
- }
-
- }
-
- boolean filtroEnabled = policy.getFiltro().isEnabled();
- if(ruoloPorta!=null) {
- filtroEnabled = filtroAbilitatoAPI;
- }
-
- if(!filtroEnabled && ruoloPorta!=null) {
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoValue); // un protocollo e' sempre selezionato
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(filtroEnabled){
-
- // Ruolo PdD
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD);
- if(policy.getFiltro().getRuoloPorta()!=null){
- de.setValue(policy.getFiltro().getRuoloPorta().getValue());
- }
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD);
- if(policy.getFiltro().getRuoloPorta()!=null){
- de.setValue(policy.getFiltro().getRuoloPorta().getValue());
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- }
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setValues(ConfigurazioneCostanti.TIPI_RUOLO_PDD);
- de.setLabels(ConfigurazioneCostanti.LABEL_TIPI_RUOLO_PDD);
- if(policy.getFiltro().getRuoloPorta()!=null){
- de.setSelected(policy.getFiltro().getRuoloPorta().getValue());
- }
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
-
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoValue); // un protocollo e' sempre selezionato
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoLabel); // un protocollo e' sempre selezionato
- de.setType(DataElementType.TEXT);
- }
- }
- else if(protocolliValue!=null && protocolliValue.size()>1){
- de.setValues(protocolliValue);
- de.setLabels(protocolliLabel);
- de.setSelected(protocolloSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- if(protocolliValue!=null && protocolliValue.size()>0) {
- dati.add(de);
-
- // Si è deciso cmq di farlo vedere
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO);
- de.setValue(this.getLabelProtocollo(protocolliValue.get(0))); // un protocollo e' sempre selezionato
- de.setType(DataElementType.TEXT);
- }
- }
- dati.add(de);
-
- // Ruolo Erogatore
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE);
- if(datiIdentificativiErogatoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(ruoloErogatoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE);
- de.setValue(ruoloErogatoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(ruoliErogatoreLabel);
- de.setValues(ruoliErogatoreValue);
- de.setSelected(ruoloErogatoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Erogatore
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE);
- if(ruoloErogatoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(datiIdentificativiErogatoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE);
- de.setValue(datiIdentificativiErogatoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(erogatoriLabel);
- de.setValues(erogatoriValue);
- de.setSelected(datiIdentificativiErogatoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Tag
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG);
- de.setValue(datiIdentificativiTagSelezionatoValue);
- if(!configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else {
- de.setValue(datiIdentificativiTagSelezionatoValue);
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApi() && datiIdentificativiServizioSelezionatoValue==null ) {
- de.setLabels(tagLabel);
- de.setValues(tagValue);
- de.setSelected(datiIdentificativiTagSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
-
- // Servizio
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO);
- de.setValue(datiIdentificativiServizioSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO);
- de.setValue(datiIdentificativiServizioSelezionatoLabel);
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApi()) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- }
- else {
- de.setValue(datiIdentificativiServizioSelezionatoValue);
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApi()) {
- de.setLabels(serviziLabel);
- de.setValues(serviziValue);
- de.setSelected(datiIdentificativiServizioSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
-
- // Azione
- boolean showAzione = true;
- if(configurazione) {
- if(datiIdentificativiServizioSelezionatoValue==null) {
- showAzione = false;
- }
- }
- if(showAzione) {
-
- boolean azioniAll = false;
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_FIRST_TIME);
- if(first) {
- azioniAll = azioniSelezionataValue==null || azioniSelezionataValue.isEmpty();
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO.equals(this.getPostBackElementName()) ||
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_ENABLED_CONSOLE_ONLY.equals(this.getPostBackElementName())) {
- azioniAll = true;
- }
- else {
- String azioniAllPart = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE);
- azioniAll = ServletUtils.isCheckBoxEnabled(azioniAllPart);
- }
-
- if(!protocolloAssociatoFiltroNonSelezionatoUtente) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE);
- de.setPostBack_viaPOST(true);
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE_ALL_VALUES);
- if(ServiceBinding.REST.equals(serviceBinding)) {
- de.setLabels(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE_RISORSE_ALL_VALUES);
- }
- else {
- de.setLabels(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE_ALL_VALUES);
- }
- if(azioniAll) {
- de.setSelected(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE_ALL_VALUE_TRUE);
- }
- else {
- de.setSelected(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE_PUNTUALE_ALL_VALUE_FALSE);
- }
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE);
- }
- de.setType(DataElementType.SELECT);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE);
- }
- }
- else {
- de.setLabel("");
- }
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setValue(policy.getFiltro().getAzione());
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE+"___LABEL");
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE);
- }
- if(azioniSelezionataLabel!=null && !azioniSelezionataLabel.isEmpty()) {
- if(azioniSelezionataLabel.size()==1) {
- de.setValue(azioniSelezionataLabel.get(0));
- }
- else {
- de.setValue(azioniSelezionataLabel.toString());
- }
- }
- de.setType(DataElementType.TEXT);
- }
- else {
- if(!azioniAll) {
- de.setLabels(azioniLabel);
- de.setValues(azioniValue);
- de.setSelezionati(azioniSelezionataValue);
- de.setType(DataElementType.MULTI_SELECT);
- if(azioniValue!=null && azioniValue.size()<=10) {
- if(azioniValue.size()<=3) {
- de.setRows(3);
- }
- else {
- de.setRows(azioniValue.size());
- }
- }
- else {
- de.setRows(10);
- }
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
- }
-
- // Servizio Applicativo Erogatore
- if(serviziApplicativiErogatoreValue!=null){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE);
- de.setValue(servizioApplicativoErogatoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE);
- de.setValue(servizioApplicativoErogatoreSelezionatoLabel);
- //de.setType(DataElementType.TEXT);
- de.setType(DataElementType.HIDDEN);
- }
- }
- else {
- de.setLabels(serviziApplicativiErogatoreLabel);
- de.setValues(serviziApplicativiErogatoreValue);
- de.setSelected(servizioApplicativoErogatoreSelezionatoValue);
- de.setValue(servizioApplicativoErogatoreSelezionatoValue);
- //de.setType(DataElementType.SELECT);
- de.setType(DataElementType.HIDDEN);
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
- }
-
- // Ruolo Fruitore
- boolean showRuoloRichiedente = false;
- if(configurazione) {
- showRuoloRichiedente = true;
- if(infoPolicy!=null && TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())) {
- showRuoloRichiedente=false;
- }
- }
- else {
- if(infoPolicy!=null && TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())) {
- showRuoloRichiedente=false;
- }
- else if(serviziApplicativiFruitoreValue!=null && serviziApplicativiFruitoreValue.size()>1){
- showRuoloRichiedente = true;
- }
- else if(fruitoriValue!=null && fruitoriValue.size()>1){
- showRuoloRichiedente = true;
- }
- }
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE);
- // if(configurazione) {
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE);
- // }
- // else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_RICHIEDENTE);
- //}
- if((datiIdentificativiFruitoreSelezionatoValue!=null && !delegata) || servizioApplicativoFruitoreSelezionatoValue!=null || !showRuoloRichiedente) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(ruoloFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE+"___LABEL");
- // if(configurazione) {
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE);
- // }
- // else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_RICHIEDENTE);
- //}
- de.setValue(ruoloFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(ruoliFruitoreLabel);
- de.setValues(ruoliFruitoreValue);
- de.setSelected(ruoloFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Fruitore
- if(fruitoriValue!=null && fruitoriValue.size()>1 &&
- (infoPolicy==null || !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa()))
- ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE);
- if(ruoloFruitoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(datiIdentificativiFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || delegata) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE);
- de.setValue(datiIdentificativiFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(fruitoriLabel);
- de.setValues(fruitoriValue);
- de.setSelected(datiIdentificativiFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
- }
-
- // Servizio Applicativo Fruitore
- if(serviziApplicativiFruitoreValue!=null && serviziApplicativiFruitoreValue.size()>1 &&
- (infoPolicy==null || !TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa()))
- ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE);
- if(ruoloFruitoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(servizioApplicativoFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE);
- de.setValue(servizioApplicativoFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(serviziApplicativiFruitoreLabel);
- de.setValues(serviziApplicativiFruitoreValue);
- de.setSelected(servizioApplicativoFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
- }
-
- if(tokenAbilitato) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TOKEN_CLAIMS);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TOKEN_CLAIMS_NOTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TOKEN_CLAIMS);
- de.setValue(tokenClaims);
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(6);
- de.setCols(55);
- dati.add(de);
- }
-
- if(filtroByKey){
-
- // per chiave
-
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED);
- de.setType(DataElementType.NOTE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED);
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO);
- }
- else{
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED_COMPACT);
- }
- de.setValue(policy.getFiltro().isInformazioneApplicativaEnabled()+"");
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED+"___LABEL");
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO);
- }
- else{
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED);
- }
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getFiltro().isInformazioneApplicativaEnabled());
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
-
- TipoFiltroApplicativo tipoFiltro = null;
- if(policy.getFiltro().getInformazioneApplicativaTipo()!=null && !"".equals(policy.getFiltro().getInformazioneApplicativaTipo())){
- tipoFiltro = TipoFiltroApplicativo.toEnumConstant(policy.getFiltro().getInformazioneApplicativaTipo());
- }
- if(tipoFiltro==null){
- tipoFiltro = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO_DEFAULT);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO);
- de.setValue(policy.getFiltro().getInformazioneApplicativaTipo());
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO);
- de.setValue(policy.getFiltro().getInformazioneApplicativaTipo());
- de.setType(DataElementType.TEXT);
- }
- else {
- if(infoPolicy!=null && TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(infoPolicy.getTipoRisorsa())){
- String [] arr = TipoFiltroApplicativo.toStringArray();
- List<String> values = new ArrayList<>();
- for (String v : arr) {
- if(TipoFiltroApplicativo.CONTENT_BASED.equals(v)) {
- continue;
- }
- values.add(v);
- }
- de.setValues(values);
- de.setLabels(ConfigurazioneCostanti.LABEL_RATE_LIMITING_FILTRO_APPLICATIVO_SENZA_CONTENUTO);
- }
- else {
- de.setValues(TipoFiltroApplicativo.toStringArray());
- de.setLabels(ConfigurazioneCostanti.LABEL_RATE_LIMITING_FILTRO_APPLICATIVO);
- }
- de.setSelected(policy.getFiltro().getInformazioneApplicativaTipo());
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
- if(TipoFiltroApplicativo.PLUGIN_BASED.equals(tipoFiltro)) {
- this.addCustomField(TipoPlugin.RATE_LIMITING,
- null,
- null,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_NOME,
- this.getLabelTipoInformazioneApplicativaFiltro(policy.getFiltro().getInformazioneApplicativaTipo()),
- policy.getFiltro().getInformazioneApplicativaNome(), false, dati,
- true);
- }
- else {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_NOME);
- de.setLabel(this.getLabelTipoInformazioneApplicativaFiltro(policy.getFiltro().getInformazioneApplicativaTipo()));
- de.setValue(policy.getFiltro().getInformazioneApplicativaNome());
- if(tipoFiltro==null ||
- TipoFiltroApplicativo.SOAPACTION_BASED.equals(tipoFiltro) ||
- TipoFiltroApplicativo.INDIRIZZO_IP.equals(tipoFiltro) ||
- TipoFiltroApplicativo.INDIRIZZO_IP_FORWARDED.equals(tipoFiltro)){
- de.setType(DataElementType.HIDDEN);
- }
- else{
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setRequired(true);
- if(TipoFiltroApplicativo.URLBASED.equals(tipoFiltro) ||
- TipoFiltroApplicativo.CONTENT_BASED.equals(tipoFiltro)) {
- de.setType(DataElementType.TEXT_AREA);
- }
- else {
- de.setType(DataElementType.TEXT_EDIT);
- }
- }
- }
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE);
- de.setValue(StringEscapeUtils.escapeHtml(policy.getFiltro().getInformazioneApplicativaValore())); // il valore può contenere ""
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE);
- de.setValue(StringEscapeUtils.escapeHtml(policy.getFiltro().getInformazioneApplicativaValore())); // il valore può contenere ""
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setRequired(true);
- de.setType(DataElementType.TEXT_EDIT);
- }
- dati.add(de);
-
- // se sono richiesti campionamenti statistici
- if(infoPolicy!=null && infoPolicy.isIntervalloUtilizzaRisorseStatistiche()){
- de = new DataElement();
- de.setType(DataElementType.NOTE);
- de.setBold(true);
- de.setLabel("Nota");
- de.setValue("Il filtro per chiave, su campionamento statistico, serve solamente a filtrare l'applicabilità della policy.<BR/>Verranno conteggiate anche le richieste che non hanno un match con il filtro per chiave indicato.");
- dati.add(de);
- }
- }
-
- }
-
- }
- }
-
- private void addToDatiAttivazioneGroupBy(List<DataElement> dati, TipoOperazione tipoOperazione,AttivazionePolicy policy, String nomeSezione,
- InfoPolicy infoPolicy, RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding,
- boolean tokenAbilitato) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
-
-
- List<String> protocolli = null;
- boolean groupByKey = false;
-
- if(policy!=null && policy.getGroupBy()!=null && policy.getGroupBy().isEnabled()){
-
- // protocollo
- protocolli = this.confCore.getProtocolli();
-
- // group by by key se non sono richiesti campionamenti statistici
- if(infoPolicy!=null && !infoPolicy.isIntervalloUtilizzaRisorseStatistiche() &&
- !infoPolicy.isDegradoPrestazionaleUtilizzaRisorseStatistiche()){
- groupByKey = true;
- }
- }
- //
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RAGGRUPPAMENTO);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RAGGRUPPAMENTO_NOTE);
- de.setType(DataElementType.NOTE);
- dati.add(de);
-
- boolean policyGropuByEnabled = policy!=null && policy.getGroupBy()!=null && policy.getGroupBy().isEnabled();
-
- // stato
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_ENABLED_STATO,
- policyGropuByEnabled,
- true, false, false, false);
-
- /**
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_ENABLED);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_ENABLED);
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.CONFIGURAZIONE_STATI_COLLEZIONAMENTO);
- if(policyGropuByEnabled){
- de.setSelected(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO);
- }
- else{
- de.setSelected(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_DISABILITATO);
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
- */
-
- if(policyGropuByEnabled){
-
-
- // --- GENERALI ---
-
- if(configurazione) {
-
- boolean showRuoloPdD = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getRuoloPorta()==null ||
- RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta());
-
- boolean showProtocollo = protocolli.size()>1 && (policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getProtocollo()==null);
-
- boolean showErogatore = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getTipoErogatore()==null ||
- policy.getFiltro().getNomeErogatore()==null;
-
- if(showRuoloPdD || showProtocollo || showErogatore) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_DATI_GENERALI);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
-
- // Ruolo PdD
- if( showRuoloPdD ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RUOLO_PDD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RUOLO_PDD_LABEL);
- //de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RUOLO_PDD_NOTE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isRuoloPorta());
- de.setValue(policy.getGroupBy().isRuoloPorta()+"");
- dati.add(de);
- }
-
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PROTOCOLLO);
- if(showProtocollo){
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isProtocollo());
- de.setValue(policy.getGroupBy().isProtocollo()+"");
- }
- else{
- de.setType(DataElementType.HIDDEN);
- if(protocolli.size()==1){
- de.setValue("false");
- }
- }
- dati.add(de);
-
- // Erogatore
- if( showErogatore ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_EROGATORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isErogatore());
- de.setValue(policy.getGroupBy().isErogatore()+"");
- dati.add(de);
- }
-
- }
-
- // --- API ---
-
- boolean showServizio = false;
-
- boolean showAzione = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getAzione()==null ||
- "".equals(policy.getFiltro().getAzione()) ||
- policy.getFiltro().getAzione().contains(",");
-
- boolean showSAErogatore = false;
-
- if(configurazione) {
-
- if(this.core.isControlloTrafficoPolicyGlobaleGroupByApi()) {
- showServizio = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getTipoServizio()==null ||
- policy.getFiltro().getNomeServizio()==null;
- }
- if(showAzione) {
- showAzione = showServizio && policy.getGroupBy().isServizio(); // l'azione la scelgo se ho prima selezionato una API
- }
-
- showSAErogatore = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getRuoloPorta()==null ||
- RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta()) ||
- RuoloPolicy.APPLICATIVA.equals(policy.getFiltro().getRuoloPorta());
- if(showSAErogatore) {
- showSAErogatore = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getServizioApplicativoErogatore()==null;
- }
-
- if(showServizio || showAzione || showSAErogatore) {
- if(configurazione) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_API);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
- }
-
- // Servizio
- if( showServizio ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SERVIZIO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SERVIZIO);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isServizio());
- de.setValue(policy.getGroupBy().isServizio()+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
- }
- }
-
- // Azione
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_AZIONE);
- if(serviceBinding!=null) {
- de.setLabel(getLabelAzione(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_AZIONE);
- }
- if( showAzione ){
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isAzione());
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(policy.getGroupBy().isAzione()+"");
- dati.add(de);
-
-
- // Servizio Applicativo Erogatore
- if(configurazione) {
- if( showSAErogatore ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_EROGATORE);
- //de.setType(DataElementType.CHECKBOX);
- de.setType(DataElementType.HIDDEN);
- de.setSelected(policy.getGroupBy().isServizioApplicativoErogatore());
- de.setValue(policy.getGroupBy().isServizioApplicativoErogatore()+"");
- dati.add(de);
- }
- }
-
-
- // --- RICHIEDENTI ---
-
- if(configurazione) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_MITTENTE);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
-
- // Fruitore
-
- if(configurazione) {
-
- boolean showFruitore = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getTipoFruitore()==null ||
- policy.getFiltro().getNomeFruitore()==null;
-
- // Fruitore
- if( showFruitore ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_FRUITORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isFruitore());
- de.setValue(policy.getGroupBy().isFruitore()+"");
- dati.add(de);
- }
-
-
- boolean showRichiedenteApplicativo = policy.getFiltro()==null ||
- policy.getFiltro().isEnabled()==false ||
- policy.getFiltro().getRuoloPorta()==null ||
- policy.getFiltro().getServizioApplicativoFruitore()==null;
-
- // Applicativo Fruitore
- if( showRichiedenteApplicativo ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_SA_FRUITORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isServizioApplicativoFruitore());
- de.setValue(policy.getGroupBy().isServizioApplicativoFruitore()+"");
- dati.add(de);
- }
-
- }
- else {
-
- // Richiedente API (Significa SoggettoMittente per le erogazioni, Applicativo e Identificativo Autenticato sia per le erogazioni che per le fruizioni)
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RICHIEDENTE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_RICHIEDENTE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isIdentificativoAutenticato()); // uso isIdentificativoAutenticato come informazione equivalente a isServizioApplicativoFruitore e isSoggettoFruitore
- de.setValue(policy.getGroupBy().isIdentificativoAutenticato()+"");
- dati.add(de);
-
- }
-
- // Token
-
- if(tokenAbilitato) {
-
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_FIRST_TIME);
- String token = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN);
-
- String [] tokenSelezionatiDB = null;
- if(policy.getGroupBy().getToken()!=null && !"".equals(policy.getGroupBy().getToken())) {
- tokenSelezionatiDB = policy.getGroupBy().getToken().split(",");
- }
- String [] tokenSelezionatiSenzaIssuer = null;
- if(tokenSelezionatiDB!=null && tokenSelezionatiDB.length>0) {
- List<String> l = new ArrayList<>();
- for (int i = 0; i < tokenSelezionatiDB.length; i++) {
- TipoCredenzialeMittente tipo = TipoCredenzialeMittente.toEnumConstant(tokenSelezionatiDB[i], true);
- if(!TipoCredenzialeMittente.TOKEN_ISSUER.equals(tipo)) {
- l.add(tokenSelezionatiDB[i]);
- }
- }
- if(!l.isEmpty()) {
- tokenSelezionatiSenzaIssuer = l.toArray(new String[1]);
- }
- }
- boolean groupByToken = false;
- if(first) {
- groupByToken = (tokenSelezionatiDB!=null && tokenSelezionatiDB.length>0);
- }
- else {
- groupByToken = ServletUtils.isCheckBoxEnabled(token);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(groupByToken); // uso isIdentificativoAutenticato come informazione equivalente a isServizioApplicativoFruitore e isSoggettoFruitore
- de.setValue(groupByToken+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(groupByToken) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN_CLAIMS);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN_CLAIMS);
-
- boolean modiPdnd = applicativa && policy.getFiltro()!=null &&
- org.openspcoop2.protocol.engine.constants.Costanti.MODIPA_PROTOCOL_NAME.equals(policy.getFiltro().getProtocollo());
- if(modiPdnd) {
- de.setValues(CostantiControlStation.TOKEN_VALUES_WITHOUT_ISSUER_CON_PDND_INFO);
- de.setLabels(CostantiControlStation.LABEL_TOKEN_VALUES_WITHOUT_ISSUER_CON_PDND);
- }
- else {
- de.setValues(CostantiControlStation.TOKEN_VALUES_WITHOUT_ISSUER);
- de.setLabels(CostantiControlStation.LABEL_TOKEN_VALUES_WITHOUT_ISSUER);
- }
- de.setSelezionati(tokenSelezionatiSenzaIssuer);
- de.setType(DataElementType.MULTI_SELECT);
- if(modiPdnd) {
- de.setRows(5);
- }
- else {
- de.setRows(4);
- }
- de.setRequired(true);
- dati.add(de);
- }
-
- }
-
- if(groupByKey){
-
- // per chiave
-
- if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_NOTE);
- de.setType(DataElementType.NOTE);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED);
- if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO);
- }
- else{
- //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_LABEL);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_LABEL);
- //de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_NOTE);
- }
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(policy.getGroupBy().isInformazioneApplicativaEnabled());
- de.setValue(policy.getGroupBy().isInformazioneApplicativaEnabled()+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
-
- TipoFiltroApplicativo tipoChiaveGroupBy = null;
- if(policy.getGroupBy().getInformazioneApplicativaTipo()!=null && !"".equals(policy.getGroupBy().getInformazioneApplicativaTipo())){
- tipoChiaveGroupBy = TipoFiltroApplicativo.toEnumConstant(policy.getGroupBy().getInformazioneApplicativaTipo());
- }
- if(tipoChiaveGroupBy==null){
- tipoChiaveGroupBy = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO_DEFAULT);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO);
- de.setValues(TipoFiltroApplicativo.toStringArray());
- de.setLabels(ConfigurazioneCostanti.LABEL_RATE_LIMITING_FILTRO_APPLICATIVO);
- de.setSelected(policy.getGroupBy().getInformazioneApplicativaTipo());
- de.setValue(policy.getGroupBy().getInformazioneApplicativaTipo());
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- if(TipoFiltroApplicativo.PLUGIN_BASED.equals(tipoChiaveGroupBy)) {
- this.addCustomField(TipoPlugin.RATE_LIMITING,
- null,
- null,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO,
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_NOME,
- this.getLabelTipoInformazioneApplicativaGroupBy(policy.getGroupBy().getInformazioneApplicativaTipo()),
- policy.getGroupBy().getInformazioneApplicativaNome(), false, dati,
- true);
- }
- else {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_NOME);
- de.setLabel(this.getLabelTipoInformazioneApplicativaGroupBy(policy.getGroupBy().getInformazioneApplicativaTipo()));
- de.setValue(policy.getGroupBy().getInformazioneApplicativaNome());
- if(tipoChiaveGroupBy==null ||
- TipoFiltroApplicativo.SOAPACTION_BASED.equals(tipoChiaveGroupBy) ||
- TipoFiltroApplicativo.INDIRIZZO_IP.equals(tipoChiaveGroupBy) ||
- TipoFiltroApplicativo.INDIRIZZO_IP_FORWARDED.equals(tipoChiaveGroupBy)){
- de.setType(DataElementType.HIDDEN);
- }
- else if(TipoFiltroApplicativo.URLBASED.equals(tipoChiaveGroupBy) ||
- TipoFiltroApplicativo.CONTENT_BASED.equals(tipoChiaveGroupBy)) {
- de.setRequired(true);
- de.setType(DataElementType.TEXT_AREA);
- }
- else{
- de.setRequired(true);
- de.setType(DataElementType.TEXT_EDIT);
- }
- dati.add(de);
- }
- }
-
- }
- }
- }
-
- private List<String> enrichListConLabelQualsiasi(List<String> l){
- List<String> newList = new ArrayList<>();
- newList.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- if(l!=null && l.size()>0){
- newList.addAll(l);
- }
- return newList;
- }
- private List<String> enrichListConValueQualsiasi(List<String> l){
- List<String> newList = new ArrayList<>();
- newList.add(ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- if(l!=null && l.size()>0){
- newList.addAll(l);
- }
- return newList;
- }
-
- public String getLabelTipoInformazioneApplicativaFiltro(String tipoInformazioneApplicativa){
- TipoFiltroApplicativo tipo = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO_DEFAULT);
- if(tipoInformazioneApplicativa!=null){
- tipo = TipoFiltroApplicativo.toEnumConstant(tipoInformazioneApplicativa);
- }
- switch (tipo) {
- case HEADER_BASED:
- return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
- case FORM_BASED:
- return ModalitaIdentificazione.FORM_BASED.getLabelParametro();
- case CONTENT_BASED:
- return ModalitaIdentificazione.CONTENT_BASED.getLabelParametro();
- case URLBASED:
- return ModalitaIdentificazione.URL_BASED.getLabelParametro();
- case SOAPACTION_BASED:
- return ModalitaIdentificazione.SOAP_ACTION_BASED.getLabelParametro();
- case INDIRIZZO_IP:
- return ModalitaIdentificazione.INDIRIZZO_IP_BASED.getLabelParametro();
- case INDIRIZZO_IP_FORWARDED:
- return ModalitaIdentificazione.X_FORWARD_FOR_BASED.getLabelParametro();
- case PLUGIN_BASED:
- return ModalitaIdentificazione.PLUGIN_BASED.getLabelParametro();
- }
- return null;
- }
-
- public String getLabelTipoInformazioneApplicativaGroupBy(String tipoInformazioneApplicativa){
- TipoFiltroApplicativo tipo = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO_DEFAULT);
- if(tipoInformazioneApplicativa!=null){
- tipo = TipoFiltroApplicativo.toEnumConstant(tipoInformazioneApplicativa);
- }
- switch (tipo) {
- case HEADER_BASED:
- return ModalitaIdentificazione.HEADER_BASED.getLabelParametro();
- case FORM_BASED:
- return ModalitaIdentificazione.FORM_BASED.getLabelParametro();
- case CONTENT_BASED:
- return ModalitaIdentificazione.CONTENT_BASED.getLabelParametro();
- case URLBASED:
- return ModalitaIdentificazione.URL_BASED.getLabelParametro();
- case SOAPACTION_BASED:
- return ModalitaIdentificazione.SOAP_ACTION_BASED.getLabelParametro();
- case INDIRIZZO_IP:
- return ModalitaIdentificazione.INDIRIZZO_IP_BASED.getLabelParametro();
- case INDIRIZZO_IP_FORWARDED:
- return ModalitaIdentificazione.X_FORWARD_FOR_BASED.getLabelParametro();
- case PLUGIN_BASED:
- return ModalitaIdentificazione.PLUGIN_BASED.getLabelParametro();
- }
- return null;
- }
- public boolean attivazionePolicyCheckData(StringBuilder sbParsingError, TipoOperazione tipoOperazione, ConfigurazioneGenerale configurazioneControlloTraffico,
- AttivazionePolicy policy, InfoPolicy infoPolicy, RuoloPolicy ruoloPorta, String nomePorta, ServiceBinding serviceBinding, String modalita) throws Exception {
-
- // errori di parsing letti durante la read della richiesta
- if(sbParsingError.length() >0){
- this.pd.setMessage(sbParsingError.toString());
- return false;
- }
-
- boolean check = this.checkAttivazionePolicy(configurazioneControlloTraffico,policy,infoPolicy,
- serviceBinding);
- if(!check) {
- return false;
- }
-
- StringBuilder existsMessage = new StringBuilder();
-
- boolean alreadyExists = ConfigurazioneUtilities.alreadyExists(tipoOperazione, this.confCore, this,
- policy, infoPolicy, ruoloPorta, nomePorta, serviceBinding,
- existsMessage, org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE, modalita);
-
- if(alreadyExists) {
- this.pd.setMessage(existsMessage.toString());
- return false;
- }
-
- return true;
- }
-
- public boolean checkAttivazionePolicy(ConfigurazioneGenerale c,AttivazionePolicy policy,InfoPolicy infoPolicy,
- ServiceBinding serviceBinding) throws Exception{
-
- // IdPolicy
- if(policy.getIdPolicy()==null || "".equals(policy.getIdPolicy()) || "-".equals(policy.getIdPolicy())){
- String messaggio = "Deve essere selezionata una policy in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(policy.getAlias()!=null && !"".equals(policy.getAlias())) {
- if(this.checkLength255(policy.getAlias(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ALIAS)==false) {
- return false;
- }
- if(this.checkNCName(policy.getAlias(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ALIAS)==false) {
- return false;
- }
- }
- else {
- String messaggio = "Deve essere indicato un nome";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(policy.isRidefinisci()){
-
- // Valori di Soglia
- if(infoPolicy!=null){
- TipoRisorsa tipoRisorsa = infoPolicy.getTipoRisorsa();
- String name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_NUMERO_RICHIESTE;
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RISPOSTA_LABEL;
- }
- else if(TipoRisorsa.OCCUPAZIONE_BANDA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_OCCUPAZIONE_DI_BANDA_LABEL;
- }
- else if(TipoRisorsa.TEMPO_MEDIO_RISPOSTA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_MEDIO_LABEL;
- }
- else if(TipoRisorsa.TEMPO_COMPLESSIVO_RISPOSTA.equals(tipoRisorsa)){
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_TEMPO_COMPLESSIVO_LABEL;
- }
- if(policy.getValore()==null){
- String messaggio = "Deve essere indicato un valore in '"+name+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- long l = policy.getValore();
- try{
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- }catch(Exception e){
- String max = Long.MAX_VALUE+"";
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- max = Integer.MAX_VALUE+"";
- }
- String messaggio = "Il valore ("+policy.getValore()+") indicato in '"+name+"' deve essere un numero intero maggiore di 0 e minore di "+max;
- this.pd.setMessage(messaggio);
- return false;
- }
- if(TipoRisorsa.NUMERO_RICHIESTE.equals(tipoRisorsa) && infoPolicy.isCheckRichiesteSimultanee()){
- if(c.getControlloTraffico().isControlloMaxThreadsEnabled()) {
- if(l > c.getControlloTraffico().getControlloMaxThreadsSoglia()){
- String messaggio = "Deve essere indicato un valore in '"+name+
- "' minore di quanto indicato nella configurazione generale alla voce '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_NUM_MASSIMO_RICHIESTE_SIMULTANEE_SOGLIA+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
- }
-
- if(TipoRisorsa.DIMENSIONE_MASSIMA_MESSAGGIO.equals(tipoRisorsa)) {
- name = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_SOGLIA_VALORE_DIMENSIONE_MASSIMA_RICHIESTA_LABEL;
- if(policy.getValore2()==null){
- String messaggio = "Deve essere indicato un valore in '"+name+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- l = policy.getValore2();
- try{
- if(l<=0){
- throw new DriverControlStationException("Valore non nell'intervallo");
- }
- }catch(Exception e){
- String messaggio = "Il valore ("+policy.getValore2()+") indicato in '"+name+"' deve essere un numero intero maggiore di 0 e minore di "+Integer.MAX_VALUE;
- this.pd.setMessage(messaggio);
- return false;
- }
- }
- }
-
- }
-
- if(policy.getFiltro().isEnabled()){
-
- if( (policy.getFiltro().getRuoloPorta()==null || RuoloPolicy.ENTRAMBI.equals(policy.getFiltro().getRuoloPorta()))
- &&
- policy.getFiltro().getProtocollo()==null &&
- policy.getFiltro().getRuoloFruitore()==null &&
- policy.getFiltro().getTipoFruitore()==null &&
- policy.getFiltro().getNomeFruitore()==null &&
- policy.getFiltro().getServizioApplicativoFruitore()==null &&
- policy.getFiltro().getRuoloErogatore()==null &&
- policy.getFiltro().getTipoErogatore()==null &&
- policy.getFiltro().getNomeErogatore()==null &&
- policy.getFiltro().getServizioApplicativoErogatore()==null &&
- policy.getFiltro().getTag()==null &&
- policy.getFiltro().getTipoServizio()==null &&
- policy.getFiltro().getNomeServizio()==null &&
- policy.getFiltro().getAzione()==null &&
- policy.getFiltro().getTokenClaims()==null &&
- policy.getFiltro().isInformazioneApplicativaEnabled()==false){
- String messaggio = "Se si abilita il filtro deve essere selezionato almeno un criterio";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(policy.getFiltro().getTokenClaims()!=null && !"".equals(policy.getFiltro().getTokenClaims())) {
- Scanner scanner = new Scanner(policy.getFiltro().getTokenClaims());
- try {
- while (scanner.hasNextLine()) {
- String line = scanner.nextLine();
- if(line==null || line.trim().equals("")) {
- continue;
- }
- if(line.contains("=")==false) {
- this.pd.setMessage(CostantiControlStation.MESSAGGIO_ERRORE_AUTORIZZAZIONE_TOKEN);
- return false;
- }
- }
- }finally {
- scanner.close();
- }
- }
-
- if(policy.getFiltro().isInformazioneApplicativaEnabled()){
-
- TipoFiltroApplicativo tipo = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO_DEFAULT);
- if(policy.getFiltro().getInformazioneApplicativaTipo()!=null){
- tipo = TipoFiltroApplicativo.toEnumConstant(policy.getFiltro().getInformazioneApplicativaTipo());
- }
-
- if(!TipoFiltroApplicativo.SOAPACTION_BASED.equals(tipo) &&
- !TipoFiltroApplicativo.INDIRIZZO_IP.equals(tipo) &&
- !TipoFiltroApplicativo.INDIRIZZO_IP_FORWARDED.equals(tipo)){
-
- String label = "'"+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED
- +" - "+getLabelTipoInformazioneApplicativaFiltro(policy.getFiltro().getInformazioneApplicativaTipo())+"'";
-
- if(policy.getFiltro().getInformazioneApplicativaNome()==null ||
- CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(policy.getFiltro().getInformazioneApplicativaNome())){
- String messaggio = null;
- if(TipoFiltroApplicativo.PLUGIN_BASED.equals(tipo) && this.confCore.isConfigurazionePluginsEnabled()) {
- messaggio = ConfigurazioneCostanti.MESSAGGIO_ERRORE_RATE_LIMITING_PLUGIN_FILTRO_NON_SELEZIONATO;
- }
- else {
- messaggio = "Deve essere indicato un valore in "+label;
- }
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if (TipoFiltroApplicativo.URLBASED.equals(tipo)) {
- if(this.checkRegexp(policy.getFiltro().getInformazioneApplicativaNome(),label)==false){
- return false;
- }
- }
- if (TipoFiltroApplicativo.CONTENT_BASED.equals(tipo)) {
- if(ServiceBinding.SOAP.equals(serviceBinding)) {
- if(this.checkXPath(policy.getFiltro().getInformazioneApplicativaNome(),label)==false){
- return false;
- }
- }
- else {
- if(this.checkXPathOrJsonPath(policy.getFiltro().getInformazioneApplicativaNome(),label)==false){
- return false;
- }
- }
- }
- }
-
- // Puo' essere anche una jsonPath
- // if(TipoFiltroApplicativo.CONTENT_BASED.equals(tipo)){
- // XPathExpressionEngine xPathEngine = new XPathExpressionEngine();
- // try{
- // xPathEngine.validate(policy.getFiltro().getInformazioneApplicativaNome());
- // }catch(XPathNotValidException notValidException){
- // String messaggio = "L'espressione fornita in '"+
- // ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED
- // +" - "+getLabelTipoInformazioneApplicativaFiltro(policy.getFiltro().getInformazioneApplicativaTipo())+"' non è valida: "+
- // notValidException.getMessage();
- // this.pd.setMessage(messaggio);
- // return false;
- // }
- // }
-
- if(policy.getFiltro().getInformazioneApplicativaValore()==null){
- String messaggio = "Deve essere indicato un valore in '"+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED+
- " - "+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- }
-
- }
-
- if(policy.getGroupBy().isEnabled()){
-
- // token
- String token = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN);
- if(ServletUtils.isCheckBoxEnabled(token)) {
- String [] tokenSelezionati = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_TOKEN_CLAIMS);
- if(tokenSelezionati==null || tokenSelezionati.length<=0) {
- String messaggio = "Se si abilita il raggruppamento per token deve essere selezionato almeno un claim";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
- if( !policy.getGroupBy().isRuoloPorta() &&
- !policy.getGroupBy().getProtocollo() &&
- !policy.getGroupBy().getFruitore() &&
- !policy.getGroupBy().getServizioApplicativoFruitore() &&
- !policy.getGroupBy().getIdentificativoAutenticato() &&
- (policy.getGroupBy().getToken()==null || "".equals(policy.getGroupBy().getToken())) &&
- !policy.getGroupBy().getErogatore() &&
- !policy.getGroupBy().getServizioApplicativoErogatore() &&
- !policy.getGroupBy().getServizio() &&
- !policy.getGroupBy().getAzione() &&
- !policy.getGroupBy().isInformazioneApplicativaEnabled()){
- String messaggio = "Se si abilita il collezionamento dei dati deve essere selezionato almeno un criterio di raggruppamento";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
-
- TipoFiltroApplicativo tipo = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_TIPO_DEFAULT);
- if(policy.getGroupBy().getInformazioneApplicativaTipo()!=null){
- tipo = TipoFiltroApplicativo.toEnumConstant(policy.getGroupBy().getInformazioneApplicativaTipo());
- }
-
- if(!TipoFiltroApplicativo.SOAPACTION_BASED.equals(tipo) &&
- !TipoFiltroApplicativo.INDIRIZZO_IP.equals(tipo) &&
- !TipoFiltroApplicativo.INDIRIZZO_IP_FORWARDED.equals(tipo)){
-
- if(policy.getGroupBy().getInformazioneApplicativaNome()==null ||
- CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED.equals(policy.getGroupBy().getInformazioneApplicativaNome())){
- String messaggio = null;
- if(TipoFiltroApplicativo.PLUGIN_BASED.equals(tipo)) {
- messaggio = ConfigurazioneCostanti.MESSAGGIO_ERRORE_RATE_LIMITING_PLUGIN_GROUP_BY_NON_SELEZIONATO;
- }
- else {
- messaggio = "Deve essere indicato un valore in '"+
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_NOTE
- +" - "+getLabelTipoInformazioneApplicativaGroupBy(policy.getGroupBy().getInformazioneApplicativaTipo())+"'";
- }
- this.pd.setMessage(messaggio);
- return false;
- }
-
- }
-
- // Puo' essere anche una jsonPath
- // if(TipoFiltroApplicativo.CONTENT_BASED.equals(tipo)){
- // XPathExpressionEngine xPathEngine = new XPathExpressionEngine();
- // try{
- // xPathEngine.validate(policy.getGroupBy().getInformazioneApplicativaNome());
- // }catch(XPathNotValidException notValidException){
- // String messaggio = "L'espressione fornita in '"+
- // ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_GROUPBY_PER_CHIAVE_ENABLED_NOTE
- // +" - "+getLabelTipoInformazioneApplicativaGroupBy(policy.getGroupBy().getInformazioneApplicativaTipo())+"' non è valida: "+
- // notValidException.getMessage();
- // this.pd.setMessage(messaggio);
- // return false;
- // }
- // }
-
- }
-
- }
- return true;
- }
-
- public String toStringFilter(AttivazionePolicyFiltro filtro, RuoloPolicy ruoloPorta, String nomePorta) throws NotFoundException {
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPolicy.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPolicy.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- StringBuilder bf = new StringBuilder("Filtro");
- if(filtro.isEnabled()){
- bf.append(" abilitato con le seguenti impostazioni:");
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getRuoloPorta()==null || RuoloPolicy.ENTRAMBI.equals(filtro.getRuoloPorta())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_PDD+":"+filtro.getRuoloPorta().getValue());
- }
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getProtocollo()==null || "".equals(filtro.getProtocollo())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PROTOCOLLO+": "+filtro.getProtocollo());
- }
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if(filtro.getRuoloErogatore()!=null) {
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_EROGATORE+": "+filtro.getRuoloErogatore());
- }
- else if( (filtro.getTipoErogatore()==null || "".equals(filtro.getTipoErogatore()))
- ||
- (filtro.getNomeErogatore()==null || "".equals(filtro.getNomeErogatore()))){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_EROGATORE+": "+filtro.getTipoErogatore()+"/"+filtro.getNomeErogatore());
- }
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( filtro.getTag()==null || "".equals(filtro.getTag()) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_TAG+": "+filtro.getTag());
- }
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getTipoServizio()==null || "".equals(filtro.getTipoServizio()))
- ||
- (filtro.getNomeServizio()==null || "".equals(filtro.getNomeServizio()))){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SERVIZIO+": "+filtro.getTipoServizio()+"/"+filtro.getNomeServizio());
- }
- }
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getAzione()==null || "".equals(filtro.getAzione())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_AZIONE+": "+filtro.getAzione());
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getServizioApplicativoErogatore()==null || "".equals(filtro.getServizioApplicativoErogatore())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_EROGATORE+": "+filtro.getServizioApplicativoErogatore());
- }
- }
-
- if(configurazione || applicativa) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if(filtro.getRuoloFruitore()!=null) {
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE+": "+filtro.getRuoloFruitore());
- }
- else if( (filtro.getTipoFruitore()==null || "".equals(filtro.getTipoFruitore()))
- ||
- (filtro.getNomeFruitore()==null || "".equals(filtro.getNomeFruitore()))){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_FRUITORE+": "+filtro.getTipoFruitore()+"/"+filtro.getNomeFruitore());
- }
-
- if(configurazione) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if( (filtro.getServizioApplicativoFruitore()==null || "".equals(filtro.getServizioApplicativoFruitore())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE+": "+filtro.getServizioApplicativoFruitore());
- }
- }
- }
- else if(delegata) {
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- if(filtro.getRuoloFruitore()!=null) {
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_RUOLO_FRUITORE+": "+filtro.getRuoloFruitore());
- }
- else if( (filtro.getServizioApplicativoFruitore()==null || "".equals(filtro.getServizioApplicativoFruitore())) ){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE+": Qualsiasi");
- }
- else{
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_SA_FRUITORE+": "+filtro.getServizioApplicativoFruitore());
- }
- }
-
- if(filtro.isInformazioneApplicativaEnabled()){
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED+": Abilitato");
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_TIPO+": "+filtro.getInformazioneApplicativaTipo());
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- bf.append(getLabelTipoInformazioneApplicativaFiltro(filtro.getInformazioneApplicativaTipo())).append(": ").append(filtro.getInformazioneApplicativaNome());
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_VALORE+": "+filtro.getInformazioneApplicativaValore());
- }
- else{
-
- bf.append(org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_FILTRO_PER_CHIAVE_ENABLED+": Disabilitato");
-
- }
-
- }
- else{
- bf.append(": Disabilitato");
- }
- return bf.toString();
- }
-
- public String eseguiResetJmx(TipoOperazione tipoOperazione, RuoloPolicy ruoloPorta, String nomePorta) throws Exception{
- try{
- List<String> aliases = this.core.getJmxPdDAliases();
- if(aliases==null || aliases.size()<=0){
- throw new DriverControlStationException("Pagina non prevista, la sezione configurazione non permette di accedere a questa pagina, se la configurazione non e' corretta");
- }
- for (String alias : aliases) {
-
- String resultReset = null;
- String idAllPolicy = null;
- try{
- if(nomePorta!=null && !"".equals(nomePorta)) {
- idAllPolicy = ConfigurazionePdD.getKeyMethodElencoIdPolicyAttiveAPI(RuoloPolicy.DELEGATA.equals(ruoloPorta)?TipoPdD.DELEGATA : TipoPdD.APPLICATIVA, nomePorta);
- }
- else {
- idAllPolicy = ConfigurazionePdD.getKeyMethodElencoIdPolicyAttiveGlobali();
- }
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE, CostantiPdD.JMX_CONFIGURAZIONE_PDD, JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT, idAllPolicy);
- this.log.debug("reset["+idAllPolicy+"] "+resultReset);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT+"] sulla risorsa ["+
- CostantiPdD.JMX_CONFIGURAZIONE_PDD+"] (param:"+idAllPolicy+"): "+e.getMessage();
- this.logError(errorMessage,e);
- resultReset = errorMessage;
- }
-
- try{
- if(nomePorta!=null && !"".equals(nomePorta)) {
- idAllPolicy = ConfigurazionePdD.getKeyMethodElencoIdPolicyAttiveAPIDimensioneMessaggio(RuoloPolicy.DELEGATA.equals(ruoloPorta)?TipoPdD.DELEGATA : TipoPdD.APPLICATIVA, nomePorta);
- }
- else {
- idAllPolicy = ConfigurazionePdD.getKeyMethodElencoIdPolicyAttiveGlobaliDimensioneMessaggio();
- }
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE, CostantiPdD.JMX_CONFIGURAZIONE_PDD, JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT, idAllPolicy);
- this.log.debug("reset["+idAllPolicy+"] "+resultReset);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT+"] sulla risorsa ["+
- CostantiPdD.JMX_CONFIGURAZIONE_PDD+"] (param:"+idAllPolicy+"): "+e.getMessage();
- this.logError(errorMessage,e);
- resultReset = errorMessage;
- }
-
- boolean resetSinglePolicy = false; // le policy attive contengono anche la data quindi non e' possibile resettarle singolarmente.
- if(resetSinglePolicy) {
- resultReset = null;
- String idPolicy = null;
- String tmpIdPolicy = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO_TRAFFICO_POLICY_ACTIVE_POLICY_ID);
- try{
- idPolicy = ConfigurazionePdD._getKey_AttivazionePolicy(tmpIdPolicy);
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE, CostantiPdD.JMX_CONFIGURAZIONE_PDD, JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT, idPolicy);
- this.log.debug("reset["+idPolicy+"] "+resultReset);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+JMXUtils.CACHE_METHOD_NAME_REMOVE_OBJECT+"] sulla risorsa ["+
- CostantiPdD.JMX_CONFIGURAZIONE_PDD+"] (param:"+idPolicy+"): "+e.getMessage();
- this.logError(errorMessage,e);
- resultReset = errorMessage;
- }
- }
-
- String risorsa = null;
- String methodName = null;
- String params = null;
- try{
- TipoPdD tipoPdD = null;
- risorsa = this.core.getJmxPdDConfigurazioneSistemaNomeRisorsaDatiRichieste(alias);
- if(nomePorta!=null && !"".equals(nomePorta)) {
- methodName = this.core.getJmxPdDConfigurazioneSistemaNomeMetodoRemoveRateLimitingAPIConfigCache(alias);
- tipoPdD = RuoloPolicy.DELEGATA.equals(ruoloPorta)?TipoPdD.DELEGATA : TipoPdD.APPLICATIVA;
- params = tipoPdD.getTipo() + ", " + nomePorta;
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE,
- risorsa,
- methodName,
- tipoPdD.getTipo(), nomePorta);
- }
- else {
- methodName = this.core.getJmxPdDConfigurazioneSistemaNomeMetodoRemoveRateLimitingGlobalConfigCache(alias);
- params = "non sono previsti parametri";
- resultReset = this.core.getInvoker().invokeJMXMethod(alias,JMXConstants.JMX_TYPE,
- risorsa,
- methodName);
- }
- this.log.debug("reset["+idAllPolicy+"] "+resultReset);
- }catch(Exception e){
- String errorMessage = "Errore durante l'invocazione dell'operazione ["+methodName+"] sulla risorsa ["+
- risorsa+"] (params:"+params+"): "+e.getMessage();
- this.logError(errorMessage,e);
- resultReset = errorMessage;
- }
-
- }
- }catch(Exception e){
- this.logError("ResetCache:"+e.getMessage(), e);
- }
-
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CONTROLLO_TRAFFICO_MODIFICATA_CON_SUCCESSO_SENZA_RIAVVIO_RICHIESTO;
- }
- public void prepareGestorePolicyTokenList(ConsoleSearch ricerca, List<GenericProperties> lista, int idLista) throws Exception{
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN);
- String infoType = this.getParameter(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- if(infoType==null) {
- infoType = ServletUtils.getObjectFromSession(this.request, this.session, String.class, ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- }
- Parameter pInfoType = new Parameter(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE, infoType);
- boolean attributeAuthority = ConfigurazioneCostanti.isConfigurazioneAttributeAuthority(infoType);
-
- // decido la vista custom da mostrare
- if(attributeAuthority) {
- this.pd.setCustomListViewName(ConfigurazioneCostanti.CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_NOME_VISTA_CUSTOM_LISTA_ATTRIBUTE_AUTHORITY);
- } else {
- this.pd.setCustomListViewName(ConfigurazioneCostanti.CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_NOME_VISTA_CUSTOM_LISTA_TOKEN_POLICIY);
- }
-
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
-
- PropertiesSourceConfiguration propertiesSourceConfiguration = attributeAuthority ?
- this.confCore.getAttributeAuthorityPropertiesSourceConfiguration() :
- this.confCore.getPolicyGestioneTokenPropertiesSourceConfiguration();
- ConfigManager configManager = ConfigManager.getinstance(ControlStationCore.getLog());
- configManager.leggiConfigurazioni(propertiesSourceConfiguration, true);
- List<String> nomiConfigurazioniPolicyGestioneToken = configManager.getNomiConfigurazioni(propertiesSourceConfiguration);
- List<String> labelConfigurazioniPolicyGestioneToken = configManager.convertToLabel(propertiesSourceConfiguration, nomiConfigurazioniPolicyGestioneToken);
-
- if(!attributeAuthority) {
- String filterTipoTokenPolicy = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_TOKEN_POLICY);
- addFilterTipoTokenPolicy(filterTipoTokenPolicy, false, nomiConfigurazioniPolicyGestioneToken, labelConfigurazioniPolicyGestioneToken);
- }
-
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- String label = attributeAuthority ?
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ATTRIBUTE_AUTHORITY :
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN;
-
- lstParam.add(new Parameter(label, null));
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- }else{
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME, search);
- }
-
- List<String> lstLabels = new ArrayList<>();
-
- boolean forceId = attributeAuthority ?
- this.core.isAttributeAuthorityForceIdEnabled() :
- this.core.isTokenPolicyForceIdEnabled();
-
- lstLabels.add(label);
-
- // setto le label delle colonne
- String[] labels = lstLabels.toArray(new String[lstLabels.size()]);
-
- this.pd.setLabels(labels);
-
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- for (int i = 0; i < lista.size(); i++) {
- List<DataElement> e = creaEntryTokenPolicyCustom(lista, pInfoType, attributeAuthority,
- nomiConfigurazioniPolicyGestioneToken, labelConfigurazioniPolicyGestioneToken, forceId, i);
-
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && !lista.isEmpty() &&
- (this.core.isShowPulsantiImportExport())
- ){
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- org.openspcoop2.protocol.sdk.constants.ArchiveType archiveType = attributeAuthority ?
- org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_ATTRIBUTE_AUTHORITY :
- org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_TOKEN_POLICY;
- if(exporterUtils.existsAtLeastOneExportMode(archiveType, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- if(attributeAuthority) {
- de.setValue(ConfigurazioneCostanti.LABEL_ATTRIBUTE_AUTHORITY_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_ATTRIBUTE_AUTHORITY_ESPORTA_SELEZIONATI_ONCLICK);
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_TOKEN_POLICY_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_TOKEN_POLICY_ESPORTA_SELEZIONATI_ONCLICK);
- }
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public List<DataElement> creaEntryTokenPolicy(List<GenericProperties> lista, Parameter pInfoType,
- boolean attributeAuthority, List<String> nomiConfigurazioniPolicyGestioneToken,
- List<String> labelConfigurazioniPolicyGestioneToken, boolean forceId, int i) {
- List<DataElement> e = new ArrayList<>();
- GenericProperties policy = lista.get(i);
-
- Parameter pPolicyId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID, policy.getId() + "");
- DataElement de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_CHANGE, pInfoType, pPolicyId);
- de.setValue(policy.getNome());
- de.setIdToRemove(""+policy.getId());
- e.add(de);
-
- de = new DataElement();
- de.setValue(policy.getDescrizione());
- e.add(de);
-
- if(!forceId) {
- de = new DataElement();
- if(nomiConfigurazioniPolicyGestioneToken!=null && nomiConfigurazioniPolicyGestioneToken.contains(policy.getTipo())) {
- boolean found = false;
- for (int j = 0; j < nomiConfigurazioniPolicyGestioneToken.size(); j++) {
- String nome = nomiConfigurazioniPolicyGestioneToken.get(j);
- if(nome.equals(policy.getTipo())) {
- de.setValue(labelConfigurazioniPolicyGestioneToken.get(j));
- found = true;
- break;
- }
- }
- if(!found) {
- de.setValue(policy.getTipo());
- }
- }
- else {
- de.setValue(policy.getTipo());
- }
- e.add(de);
- }
-
- InUsoType inUsoType = attributeAuthority ? InUsoType.ATTRIBUTE_AUTHORITY : InUsoType.TOKEN_POLICY;
- this.addInUsoButtonVisualizzazioneClassica(e, policy.getNome(), policy.getId()+"", inUsoType);
- return e;
- }
-
- private List<DataElement> creaEntryTokenPolicyCustom(List<GenericProperties> lista, Parameter pInfoType,
- boolean attributeAuthority, List<String> nomiConfigurazioniPolicyGestioneToken,
- List<String> labelConfigurazioniPolicyGestioneToken, boolean forceId, int i) {
- List<DataElement> e = new ArrayList<>();
- GenericProperties policy = lista.get(i);
-
- Parameter pPolicyId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID, policy.getId() + "");
-
- List<Parameter> listaParametriChange = new ArrayList<>();
- listaParametriChange.add(pInfoType);
- listaParametriChange.add(pPolicyId);
-
- // TITOLO nome
- DataElement de = new DataElement();
- de.setValue(policy.getNome());
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_CHANGE, pInfoType, pPolicyId);
- de.setSize(this.core.getElenchiMenuIdentificativiLunghezzaMassima());
- de.setIdToRemove(""+policy.getId());
- de.setType(DataElementType.TITLE);
- e.add(de);
-
- // seconda riga
- boolean visualizzaSecondaRiga = StringUtils.isNotBlank(policy.getDescrizione()) || !forceId || attributeAuthority;
-
- boolean verificaConnettivita = true;
-
- if(visualizzaSecondaRiga) {
- de = new DataElement();
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_DESCRIZIONE, policy.getDescrizione()));
-
- if(!forceId) {
-
- boolean validazione = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN.equals(policy.getTipologia());
- boolean negoziazione = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_RETRIEVE_POLICY_TOKEN.equals(policy.getTipologia());
-
- String labelTipo = policy.getTipo();
- if(nomiConfigurazioniPolicyGestioneToken!=null && nomiConfigurazioniPolicyGestioneToken.contains(policy.getTipo())) {
- boolean found = false;
- for (int j = 0; j < nomiConfigurazioniPolicyGestioneToken.size(); j++) {
- String nome = nomiConfigurazioniPolicyGestioneToken.get(j);
- if(nome.equals(policy.getTipo())) {
- labelTipo = labelConfigurazioniPolicyGestioneToken.get(j);
- found = true;
- break;
- }
- }
- if(!found) {
- labelTipo = policy.getTipo();
- }
- }
- else {
- labelTipo = policy.getTipo();
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_TIPO, labelTipo));
- if(validazione) {
-
- GestioneToken gestioneToken = new GestioneToken();
- gestioneToken.setIntrospection(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setUserInfo(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setValidazione(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setForward(StatoFunzionalita.ABILITATO);
- try {
- PolicyGestioneToken policyGestioneToken = TokenUtilities.convertTo(policy, gestioneToken);
-
- String labelToken = policyGestioneToken.getLabelTipoToken();
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_TOKEN, labelToken));
-
- String labelValidazione = policyGestioneToken.getAzioniGestioneToken();
- labelValidazione = labelValidazione.replace("JWT", "ValidazioneJWT");
- labelValidazione = labelValidazione.replace(",", " - ").trim();
-
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_MODALITA, labelValidazione));
-
- String labelForward = policyGestioneToken.getAzioniForwardToken();
- labelForward = labelForward.replace(",", " - ").trim();
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_FORWARD, labelForward));
-
- if(!policyGestioneToken.isDynamicDiscovery() && !policyGestioneToken.isIntrospection() && !policyGestioneToken.isUserInfo()) {
- if(policyGestioneToken.isValidazioneJWT()) {
- verificaConnettivita = policyGestioneToken.isValidazioneJWTLocationHttp();
- }
- else {
- verificaConnettivita = false;
- }
- }
-
- }catch(Exception t) {
- this.logError(t.getMessage(),t);
- }
-
- if(StringUtils.isNotBlank(policy.getDescrizione())) {
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_DESCRIZIONE, labelTipo, policy.getDescrizione()));
- }
- }
- else if(negoziazione) {
-
- try {
- PolicyNegoziazioneToken policyNegoziazione = TokenUtilities.convertTo(policy);
-
- String labelModalita = policyNegoziazione.getLabelGrant();
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_MODALITA, labelModalita));
- }catch(Exception t) {
- this.logError(t.getMessage(),t);
- }
-
- if(StringUtils.isNotBlank(policy.getDescrizione())) {
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_DESCRIZIONE, labelTipo, policy.getDescrizione()));
- }
- }
- else {
- if(StringUtils.isNotBlank(policy.getDescrizione())) {
- sb.append(ConfigurazioneCostanti.MESSAGE_METADATI_SEPARATORE);
- sb.append(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_TOKEN_POLICY_DESCRIZIONE, labelTipo, policy.getDescrizione()));
- }
- }
-
- de.setValue(sb.toString());
- }
- else {
- if(attributeAuthority) {
- String tipoRisposta = null;
- String attributi = null;
- for (Property p : policy.getPropertyList()) {
- if(org.openspcoop2.pdd.core.token.attribute_authority.Costanti.AA_RESPONSE_TYPE.equals(p.getNome())){
- tipoRisposta = p.getValore();
- }
- else if(org.openspcoop2.pdd.core.token.attribute_authority.Costanti.AA_RESPONSE_ATTRIBUTES.equals(p.getNome())){
- attributi = p.getValore();
- }
- }
- TipologiaResponseAttributeAuthority tipologiaResponse = null;
- if(tipoRisposta!=null) {
- tipologiaResponse = TipologiaResponseAttributeAuthority.valueOf(tipoRisposta);
- }
- if(!TipologiaResponseAttributeAuthority.custom.equals(tipologiaResponse)) {
- if(attributi==null || StringUtils.isBlank(attributi)) {
- attributi = "qualsiasi";
- }
- }
- if(StringUtils.isNotBlank(policy.getDescrizione()) && StringUtils.isNotBlank(attributi)) {
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_ATTRIBUTE_AUTHORITY_ATTRIBUTI_E_DESCRIZIONE, attributi, policy.getDescrizione()));
- }
- else if(StringUtils.isNotBlank(attributi)) {
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_ATTRIBUTE_AUTHORITY_SOLO_ATTRIBUTI, attributi));
- }
- else if(StringUtils.isNotBlank(policy.getDescrizione())) {
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_DESCRIZIONE, policy.getDescrizione()));
- }
- else {
- visualizzaSecondaRiga = false;
- }
- }
- }
-
- if(visualizzaSecondaRiga) {
- de.setType(DataElementType.SUBTITLE);
- e.add(de);
- }
- }
-
- listaParametriChange.add(new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CERTIFICATI_FROM_LISTA, "true"));
- listaParametriChange.add(new Parameter(CostantiControlStation.PARAMETRO_RESET_CACHE_FROM_LISTA, "true"));
-
- // in uso
- InUsoType inUsoType = attributeAuthority ? InUsoType.ATTRIBUTE_AUTHORITY : InUsoType.TOKEN_POLICY;
- this.addInUsoButton(e, policy.getNome(), policy.getId()+"", inUsoType);
-
- // validazione certificati
- boolean visualizzaValidazioneCertificati = attributeAuthority ? this.core.isAttributeAuthorityVerificaCertificati() : this.core.isPolicyGestioneTokenVerificaCertificati();
- if(visualizzaValidazioneCertificati) {
- this.addVerificaCertificatiButton(e, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_VERIFICA_CERTIFICATI, listaParametriChange);
- }
-
- // verifica connettivita
- if(verificaConnettivita) {
- List<Parameter> listaParametriVerificaConnettivitaChange = new ArrayList<>();
- listaParametriVerificaConnettivitaChange.addAll(listaParametriChange);
- listaParametriVerificaConnettivitaChange.add(new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTIVITA, "true"));
- this.addVerificaConnettivitaButton(e, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_VERIFICA_CERTIFICATI, listaParametriVerificaConnettivitaChange);
- }
-
- // se e' abilitata l'opzione reset cache per elemento, visualizzo il comando nell'elenco dei comandi disponibili nella lista
- if(this.core.isElenchiVisualizzaComandoResetCacheSingoloElemento()){
- this.addComandoResetCacheButton(e,policy.getNome(), ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_CHANGE, listaParametriChange);
- }
-
- // Proprieta Button
- /**if(this.existsProprietaOggetto(policy.getProprietaOggetto(), policy.getDescrizione())) {
- * la lista non riporta le proprietà . Ma esistono e poi sarà la servlet a gestirlo
- */
- this.addProprietaOggettoButton(e, policy.getNome(), policy.getId()+"", inUsoType);
-
- return e;
-
- }
- public List<DataElement> addPolicyGestioneTokenToDati(TipoOperazione tipoOperazione, List<DataElement> dati, String id, String nome, String descrizione, String tipo, String[] propConfigPolicyGestioneTokenLabelList, String[] propConfigPolicyGestioneTokenList,
- boolean attributeAuthority, GenericProperties genericProperties) throws Exception {
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
-
- Parameter pPolicyId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID, id);
-
- String infoType = this.getParameter(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- if(infoType==null) {
- infoType = ServletUtils.getObjectFromSession(this.request, this.session, String.class, ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- }
- Parameter pInfoType = new Parameter(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE, infoType);
-
- List<Parameter> listaParametriChange = new ArrayList<>();
- listaParametriChange.add(pInfoType);
- listaParametriChange.add(pPolicyId);
-
- boolean verificaConnettivita = true;
- boolean validazione = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPOLOGIA_GESTIONE_POLICY_TOKEN.equals(genericProperties.getTipologia());
- if(validazione) {
- GestioneToken gestioneToken = new GestioneToken();
- gestioneToken.setIntrospection(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setUserInfo(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setValidazione(StatoFunzionalitaConWarning.ABILITATO);
- gestioneToken.setForward(StatoFunzionalita.ABILITATO);
- try {
- PolicyGestioneToken policyGestioneToken = TokenUtilities.convertTo(genericProperties, gestioneToken);
- if(!policyGestioneToken.isIntrospection() && !policyGestioneToken.isUserInfo()) {
- verificaConnettivita = false;
- }
- }catch(Exception t) {
- this.logError(t.getMessage(),t);
- }
- }
-
- // In Uso Button
- InUsoType inUsoType = attributeAuthority ? InUsoType.ATTRIBUTE_AUTHORITY : InUsoType.TOKEN_POLICY;
- this.addComandoInUsoButton(nome,
- id,
- inUsoType);
-
- // Verifica Certificati
- boolean visualizzaValidazioneCertificati = attributeAuthority ? this.core.isAttributeAuthorityVerificaCertificati() : this.core.isPolicyGestioneTokenVerificaCertificati();
- if(visualizzaValidazioneCertificati) {
- this.pd.addComandoVerificaCertificatiElementoButton(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_VERIFICA_CERTIFICATI, listaParametriChange);
- }
-
- // verifica connettivita
- if(verificaConnettivita) {
- List<Parameter> listaParametriVerificaConnettivitaChange = new ArrayList<>();
- listaParametriVerificaConnettivitaChange.addAll(listaParametriChange);
- listaParametriVerificaConnettivitaChange.add(new Parameter(CostantiControlStation.PARAMETRO_VERIFICA_CONNETTIVITA, "true"));
- this.pd.addComandoVerificaConnettivitaElementoButton(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_VERIFICA_CERTIFICATI, listaParametriVerificaConnettivitaChange);
- }
-
- // se e' abilitata l'opzione reset cache per elemento, visualizzo il comando nell'elenco dei comandi disponibili nella lista
- if(this.core.isElenchiVisualizzaComandoResetCacheSingoloElemento()){
- listaParametriChange.add(new Parameter(CostantiControlStation.PARAMETRO_ELIMINA_ELEMENTO_DALLA_CACHE, "true"));
- this.pd.addComandoResetCacheElementoButton(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN_CHANGE, listaParametriChange);
- }
-
- // Proprieta Button
- if(this.existsProprietaOggetto(genericProperties.getProprietaOggetto(), genericProperties.getDescrizione())) {
- this.addComandoProprietaOggettoButton(nome,
- id,
- inUsoType);
- }
- }
-
-
-
- boolean forceIdEnabled = attributeAuthority ?
- this.confCore.isAttributeAuthorityForceIdEnabled() :
- this.confCore.isTokenPolicyForceIdEnabled() ;
-
- DataElement de = new DataElement();
- de.setLabel(attributeAuthority ?
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ATTRIBUTE_AUTHORITY :
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_POLICY_GESTIONE_TOKEN);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // id
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID);
- de.setType(DataElementType.HIDDEN);
- de.setValue(id);
- dati.add(de);
- // tipo
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO);
- if(!forceIdEnabled) {
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- de.setType(DataElementType.SELECT);
- de.setPostBack(true);
- de.setValues(propConfigPolicyGestioneTokenList);
- de.setLabels(propConfigPolicyGestioneTokenLabelList);
- de.setSelected(tipo);
- de.setRequired(true);
- }else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(tipo);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO+CostantiControlStation.PARAMETRO_SUFFIX_LABEL);
- de.setType(DataElementType.TEXT);
- if(propConfigPolicyGestioneTokenList!=null && propConfigPolicyGestioneTokenList.length>0) {
- boolean found = false;
- for (int j = 0; j < propConfigPolicyGestioneTokenList.length; j++) {
- String nomeP = propConfigPolicyGestioneTokenList[j];
- if(nomeP.equals(tipo)) {
- de.setValue(propConfigPolicyGestioneTokenLabelList[j]);
- found = true;
- break;
- }
- }
- if(!found) {
- de.setValue(tipo);
- }
- }
- else {
- de.setValue(tipo);
- }
- }
- } else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(tipo);
- }
- dati.add(de);
-
- // nome
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME);
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- } else {
- de.setType(DataElementType.TEXT);
- }
- de.setValue(nome);
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_DESCRIZIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_DESCRIZIONE);
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(2);
- de.setValue(descrizione);
- dati.add(de);
-
- return dati;
- }
- public boolean policyGestioneTokenCheckData(TipoOperazione tipoOperazione, String nome, String descrizione, String tipo,String tipologia) throws DriverControlStationException {
-
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- // Nome
- if(StringUtils.isEmpty(nome)){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
- if(nome.contains(" ")){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME+"' senza spazi";
- this.pd.setMessage(messaggio);
- return false;
- }
-
-
- // Tipo
- if(StringUtils.isEmpty(tipo) || CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO.equals(tipo)){
- String messaggio = "Deve essere indicato un valore in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_TIPO+"'";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- // Lunghezze
- if(!this.checkLength255(nome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_NOME)) {
- return false;
- }
-
- try {
- // check duplicati per tipologia
- this.confCore.getGenericProperties(nome, tipologia,false);
- String messaggio = "È già presente un Policy, del tipo indicato, con nome " + nome ;
- this.pd.setMessage(messaggio);
- return false;
- } catch(DriverConfigurazioneNotFound e) {
- // ok
- } catch(Exception e) {
- throw new DriverControlStationException(e.getMessage(),e);
- }
- }
-
- // Anche in change
- if(descrizione!=null && !"".equals(descrizione) &&
- !this.checkLength4000(descrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_DESCRIZIONE)) {
- return false;
- }
-
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- // nop
- }
-
- return true;
- }
-
- public String replaceToHtmlSeparator(String value) {
- return this.replaceSeparator(value, "\n", org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE);
- }
- public String replaceSeparator(String value, String originale,String destinazione) {
- if(value!=null) {
- while(value.contains(originale)) {
- value = value.replace(originale, destinazione);
- }
- }
- return value;
- }
-
- // Prepara la lista delle regole di configurazione proxy pass
- public void prepareProxyPassConfigurazioneRegolaList(ISearch ricerca, List<ConfigurazioneUrlInvocazioneRegola> lista) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA);
- int idLista = Liste.CONFIGURAZIONE_PROXY_PASS_REGOLA;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROXY_PASS_REGOLE, null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PROXY_PASS_REGOLE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- if(lista != null && lista.size() > 1)
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_POSIZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_DESCRIZIONE);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<ConfigurazioneUrlInvocazioneRegola> it = lista.iterator();
- int numeroElementi = lista.size();
- int i = 0;
- while (it.hasNext()) {
- ConfigurazioneUrlInvocazioneRegola regola = it.next();
- List<DataElement> e = new ArrayList<>();
- Parameter pIdRegola = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_ID_REGOLA, regola.getId() + "");
-
- // Posizione
- if(lista.size() > 1) {
- DataElement de = new DataElement();
- de.setWidthPx(48);
- de.setType(DataElementType.IMAGE);
- DataElementImage imageUp = new DataElementImage();
- Parameter pDirezioneSu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
- Parameter pDirezioneGiu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
-
- if(i > 0) {
- imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
- imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
- imageUp.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_LIST, pIdRegola, pDirezioneSu);
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
- }
- de.addImage(imageUp);
-
- if(i < numeroElementi -1) {
- DataElementImage imageDown = new DataElementImage();
- imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
- imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
- imageDown.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_LIST, pIdRegola, pDirezioneGiu);
- de.addImage(imageDown);
- }
- de.setValue(regola.getPosizione()+"");
- e.add(de);
- }
-
- // Stato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(regola.getStato()==null // backward compatibility
- ||
- StatoFunzionalita.ABILITATO.equals(regola.getStato())){
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_CHANGE, pIdRegola);
- e.add(de);
-
-
- // Nome
- de = new DataElement();
- de.setIdToRemove(regola.getId() + "");
- de.setValue(regola.getNome());
- de.setToolTip(regola.getNome());
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PROXY_PASS_REGOLA_CHANGE, pIdRegola);
- e.add(de);
-
- de = new DataElement();
- if(regola.getDescrizione() != null && regola.getDescrizione().length() > 100) {
- de.setValue(regola.getDescrizione().substring(0, 97)+"...");
- de.setToolTip(regola.getDescrizione());
- } else {
- de.setValue(regola.getDescrizione());
- }
-
- e.add(de);
- dati.add(e);
- i++;
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport()) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_URL_INVOCAZIONE_REGOLA, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_URL_INVOCAZIONE_REGOLA_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_URL_INVOCAZIONE_REGOLA_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Controlla i dati del registro
- public boolean proxyPassConfigurazioneRegolaCheckData(TipoOperazione tipoOp, String oldNome) throws Exception {
- try{
-
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME);
-
- if(StringUtils.isEmpty(nome)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME));
- return false;
- }
-
- if(!this.checkLength(nome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_NOME, 1, 255)) {
- return false;
- }
-
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO);
-
- if(StringUtils.isEmpty(stato)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO));
- return false;
- } else {
- if(!stato.equals(StatoFunzionalita.ABILITATO.getValue()) && !stato.equals(StatoFunzionalita.DISABILITATO.getValue())) {
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_STATO));
- return false;
- }
- }
-
- String regolaText = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT);
-
- if(StringUtils.isEmpty(regolaText)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT));
- return false;
- }
-
- if(!this.checkLength(regolaText, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_REGOLA_TEXT, 1, 255)) {
- return false;
- }
-
- String contestoEsterno = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO);
-
- /*
- if(StringUtils.isEmpty(contestoEsterno)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO));
- return false;
- }
- */
-
- if(!StringUtils.isEmpty(contestoEsterno)){
- if(contestoEsterno.contains(" ")) {
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO));
- return false;
- }
-
- if(!this.checkLength(contestoEsterno, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_CONTESTO_ESTERNO, 1, 255)) {
- return false;
- }
- }
-
- String baseUrl = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL);
-
- if(!StringUtils.isEmpty(baseUrl)){
- if(baseUrl.contains(" ")) {
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CORS_SPAZI_BIANCHI_NON_AMMESSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL));
- return false;
- }
-
- if(!this.checkLength(baseUrl, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL, 1, 255)) {
- return false;
- }
-
- try{
- org.openspcoop2.utils.regexp.RegExpUtilities.validateUrl(baseUrl, true);
- }catch(Exception e){
- this.pd.setMessage(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_BASE_URL + " non correttamente formata: "+e.getMessage());
- return false;
- }
- }
-
- // String protocollo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_PROFILO);
- //
- // if(!StringUtils.isEmpty(protocollo)){
- //
- // // valida protocollo
- //
- // String soggetto = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SOGGETTO);
- //
- // if(!StringUtils.isEmpty(soggetto)){
- // // valida id soggetto
- // }
- // }
-
- String ruolo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_RUOLO);
- if(!StringUtils.isEmpty(ruolo)){
- if(!ruolo.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROXY_PASS_REGOLA_RUOLO_EROGAZIONE) && !ruolo.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROXY_PASS_REGOLA_RUOLO_FRUIZIONE)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_RUOLO));
- return false;
- }
- }
- String serviceBinding = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SERVICE_BINDING);
-
- if(!StringUtils.isEmpty(serviceBinding)){
- if(!serviceBinding.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_SOAP) && !serviceBinding.equals(CostantiControlStation.DEFAULT_VALUE_PARAMETRO_SERVICE_BINDING_REST)) {
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRORE_CONFIGURAZIONE_DUMPO_VALORE_DEL_CAMPO_XX_NON_VALIDO,ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PROXY_PASS_REGOLA_SERVICE_BINDING));
- return false;
- }
- }
-
- // Se tipoOp = add, controllo che la regola non sia gia' stata registrata
- if (tipoOp.equals(TipoOperazione.ADD)) {
- boolean giaRegistrato = this.confCore.existsProxyPassConfigurazioneRegola(nome);
- if (giaRegistrato) {
- this.pd.setMessage("È già presente una Regola di Proxy Pass con questo nome.");
- return false;
- }
- } else { // change controllo che se ho modificato il nome, il nuovo nome non sia comunque utilizzato
- if(!oldNome.equals(nome)) {
- boolean giaRegistrato = this.confCore.existsProxyPassConfigurazioneRegola(nome);
- if (giaRegistrato) {
- this.pd.setMessage("È già presente una Regola di Proxy Pass con questo nome.");
- return false;
- }
- }
- }
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public CanaliConfigurazione getGestioneCanali(boolean canaliEnabled, String canaliDefault, List<CanaleConfigurazione> canaleList, String canaliNome,
- String canaliDescrizione, List<CanaleConfigurazioneNodo> nodoList) {
- CanaliConfigurazione configurazione = new CanaliConfigurazione();
-
- if(canaliEnabled) {
- configurazione.setStato(StatoFunzionalita.ABILITATO);
-
- if(canaleList == null)
- canaleList = new ArrayList<>();
-
- if(canaliDefault != null) {
- // viene modificato solo il canale default
- for (CanaleConfigurazione canaleConfigurazione : canaleList) {
- canaleConfigurazione.setCanaleDefault(false);
- }
-
- for (CanaleConfigurazione canaleConfigurazione : canaleList) {
- if(canaleConfigurazione.getNome().equals(canaliDefault)) {
- canaleConfigurazione.setCanaleDefault(true);
- break;
- }
- }
- } else {
- // creo il canale default
-
- CanaleConfigurazione canaleConfigurazione = new CanaleConfigurazione();
- canaleConfigurazione.setNome(canaliNome);
- canaleConfigurazione.setDescrizione(canaliDescrizione);
- canaleConfigurazione.setCanaleDefault(true);
-
- canaleList.add(canaleConfigurazione);
- }
-
- configurazione.setCanaleList(canaleList);
-
- if(nodoList == null)
- nodoList = new ArrayList<>();
-
- configurazione.setNodoList(nodoList);
- } else {
- configurazione.setStato(StatoFunzionalita.DISABILITATO);
- }
-
- return configurazione;
- }
- public void prepareCanaleConfigurazioneList(ConsoleSearch ricerca, List<CanaleConfigurazione> lista) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_CANALI);
- int idLista = Liste.CONFIGURAZIONE_CANALI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI, null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT);
- lstLabels.add(CostantiControlStation.LABEL_IN_USO_COLONNA_HEADER); // inuso
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<CanaleConfigurazione> it = lista.iterator();
- while (it.hasNext()) {
- CanaleConfigurazione regola = it.next();
- List<DataElement> e = new ArrayList<>();
- Parameter pIdCanale = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_ID_CANALE, regola.getId() + "");
-
- // Nome
- DataElement de = new DataElement();
- de.setIdToRemove(regola.getId() + "");
- de.setValue(regola.getNome());
- de.setToolTip(regola.getNome());
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_CHANGE, pIdCanale);
- e.add(de);
-
- de = new DataElement();
- if(regola.getDescrizione() != null && regola.getDescrizione().length() > 100) {
- de.setValue(regola.getDescrizione().substring(0, 97)+"...");
- de.setToolTip(regola.getDescrizione());
- } else {
- de.setValue(regola.getDescrizione());
- }
-
- e.add(de);
-
- // Default
- de = new DataElement();
- de.setWidthPx(10);
- if(regola.isCanaleDefault()){
- de.setValue("Si");
- }
- else{
- de.setValue("No");
- }
- e.add(de);
-
-
- this.addInUsoButtonVisualizzazioneClassica(e, regola.getNome(), regola.getNome(), InUsoType.CANALE);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
-
- }
- public List<DataElement> addCanaleToDati(TipoOperazione tipoOp, List<DataElement> dati, String idCanaleS,
- String nome, String descrizione) {
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALE);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- if(tipoOp.equals(TipoOperazione.CHANGE)) {
- // old id canale
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_ID_CANALE);
- de.setType(DataElementType.HIDDEN);
- de.setValue(idCanaleS);
- dati.add(de);
- }
-
- // nome
- DataElement de = new DataElement();
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- de.setSize(this.getSize());
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- de.setValue(descrizione);
- de.setType(DataElementType.TEXT_AREA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
- de.setSize(this.getSize());
- dati.add(de);
-
- return dati;
- }
-
- public boolean canaleCheckData(TipoOperazione tipoOp, String oldNome) throws Exception {
- try{
- String canaliNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
- String canaliDescrizione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
-
- if(canaleDatiCheckData(canaliNome, canaliDescrizione) == false) {
- return false;
- }
-
- boolean existsCanale = this.confCore.existsCanale(canaliNome);
-
- if(tipoOp.equals(TipoOperazione.ADD)) {
- if(existsCanale) { // nome gia' occupato
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_CANALE_GIA_PRESENTE);
- return false;
- }
- } else {
- // se ho cambiato il nome ed e' gia' scelto allora devo segnalare l'errore.
- if(!oldNome.equals(canaliNome) && existsCanale) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_CANALE_NUOVO_NOME_GIA_PRESENTE);
- return false;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public void prepareCanaleNodoConfigurazioneList(ConsoleSearch ricerca, List<CanaleConfigurazioneNodo> lista) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_CANALI_NODI);
- int idLista = Liste.CONFIGURAZIONE_CANALI_NODI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI_NODI, null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI_NODI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_NODI_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_DESCRIZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_CANALI);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<CanaleConfigurazioneNodo> it = lista.iterator();
- while (it.hasNext()) {
- CanaleConfigurazioneNodo regola = it.next();
- List<DataElement> e = new ArrayList<>();
- Parameter pIdCanaleNodo = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_ID_NODO, regola.getId() + "");
-
- // Nome
- DataElement de = new DataElement();
- de.setIdToRemove(regola.getId() + "");
- de.setValue(regola.getNome());
- de.setToolTip(regola.getNome());
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_CANALI_NODI_CHANGE, pIdCanaleNodo);
- e.add(de);
-
- // descrizione
- de = new DataElement();
- if(regola.getDescrizione() != null && regola.getDescrizione().length() > 100) {
- de.setValue(regola.getDescrizione().substring(0, 97)+"...");
- de.setToolTip(regola.getDescrizione());
- } else {
- de.setValue(regola.getDescrizione());
- }
-
- e.add(de);
-
- // Canali
- de = new DataElement();
- List<String> canaleList = regola.getCanaleList();
- if(canaleList == null)
- canaleList = new ArrayList<>();
-
- String labelTooltip = StringUtils.join(canaleList.toArray(new String[canaleList.size()]), ", ");
-
- if(labelTooltip.length() > 100) {
- de.setValue(labelTooltip.substring(0, 97)+"...");
- de.setToolTip(labelTooltip);
- } else {
- de.setValue(labelTooltip);
- }
- e.add(de);
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
-
- }
- public List<DataElement> addCanaleNodoToDati(TipoOperazione tipoOp, List<DataElement> dati, String idNodoS, String oldNome,
- String nome, String descrizione, String[] canali, List<CanaleConfigurazione> canaleList,
- boolean selectListNode, List<String> aliasesNodi) {
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CANALI_NODO);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- if(tipoOp.equals(TipoOperazione.CHANGE)) {
- // old id canale
- DataElement de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_ID_NODO);
- de.setType(DataElementType.HIDDEN);
- de.setValue(idNodoS);
- dati.add(de);
-
- if(selectListNode && aliasesNodi.contains(oldNome) && aliasesNodi.size()>1 && !oldNome.equals(nome)) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_OLD_NOME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_OLD_NOME);
- de.setType(DataElementType.TEXT);
- de.setValue(oldNome);
- dati.add(de);
- }
- }
-
- // nome
- if(selectListNode) {
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- de.setValues(aliasesNodi);
- de.setLabels(aliasesNodi);
- de.setSelected(nome);
- de.setRequired(true);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- if(tipoOp.equals(TipoOperazione.CHANGE)) {
- de.setPostBack(true);
- }
- dati.add(de);
- }
- else {
- DataElement de = new DataElement();
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setRequired(true);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- de.setSize(this.getSize());
- dati.add(de);
- }
-
- // descrizione
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_DESCRIZIONE);
- de.setValue(descrizione);
- de.setType(DataElementType.TEXT_AREA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_DESCRIZIONE);
- de.setSize(this.getSize());
- dati.add(de);
-
- // canali
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_CANALI);
- List<String> canaliListValues = canaleList.stream().map(CanaleConfigurazione::getNome).collect(Collectors.toList());
- de.setValues(canaliListValues);
- de.setLabels(canaliListValues);
- de.setSelezionati(canali);
- de.setRequired(true);
- de.setType(DataElementType.MULTI_SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_CANALI);
- de.setRows(10);
- dati.add(de);
-
- return dati;
- }
- public boolean canaleNodoCheckData(TipoOperazione tipoOp, String oldNome) throws Exception {
- try{
- String canaliNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME);
- String canaliDescrizione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_DESCRIZIONE);
- String [] canali = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NODI_CANALI);
-
- // nome obbligatorio
- if(StringUtils.isEmpty(canaliNome)){
- this.pd.setMessage(MessageFormat.format(CostantiControlStation.MESSAGGIO_ERRRORE_DATI_INCOMPLETI_E_NECESSARIO_INDICARE_XX,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME));
- return false;
- }
-
- if(this.checkSpazi(canaliNome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME)==false) {
- return false;
- }
-
- if(this.checkLength255(canaliNome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_NOME)==false) {
- return false;
- }
-
- if(this.checkLength255(canaliDescrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_DESCRIZIONE)==false) {
- return false;
- }
-
- if(canali == null || canali.length == 0) {
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_CANALE_NODO_CAMPO_CANALE_OBBLIGATORIO,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_CANALI_NODI_CANALI));
- return false;
- }
-
- boolean existsCanale = this.confCore.existsCanaleNodo(canaliNome);
-
- if(tipoOp.equals(TipoOperazione.ADD)) {
- if(existsCanale) { // nome gia' occupato
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_CANALE_NODO_GIA_PRESENTE);
- return false;
- }
- } else {
- // se ho cambiato il nome ed e' gia' scelto allora devo segnalare l'errore.
- if(!oldNome.equals(canaliNome) && existsCanale) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_CANALE_NODO_NUOVO_NOME_GIA_PRESENTE);
- return false;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista dei plugin configurati
- public void preparePluginsArchiviList(ISearch ricerca, List<RegistroPlugin> lista) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI);
- int idLista = Liste.CONFIGURAZIONE_PLUGINS_ARCHIVI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_REGISTRO_ARCHIVI, null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_REGISTRO_ARCHIVI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- if(lista != null && lista.size() > 1)
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_POSIZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_ULTIMO_AGGIORNAMENTO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_APPLICABILITA);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<RegistroPlugin> it = lista.iterator();
- int numeroElementi = lista.size();
- int i = 0;
- while (it.hasNext()) {
- RegistroPlugin registro = it.next();
- List<DataElement> e = new ArrayList<>();
- // Parameter pIdRegola = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_ID_ARCHIVIO, regola.getId() + "");
- Parameter pNomeRegola = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME, registro.getNome() + "");
- Parameter pOldNomePlugin = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_OLD_NOME, registro.getNome() + "");
-
- // Posizione
- if(lista.size() > 1) {
- DataElement de = new DataElement();
- de.setWidthPx(48);
- de.setType(DataElementType.IMAGE);
- DataElementImage imageUp = new DataElementImage();
- Parameter pDirezioneSu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
- Parameter pDirezioneGiu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
-
- if(i > 0) {
- imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
- imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
- imageUp.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_LIST, pNomeRegola, pDirezioneSu);
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
- }
- de.addImage(imageUp);
-
- if(i < numeroElementi -1) {
- DataElementImage imageDown = new DataElementImage();
- imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
- imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
- imageDown.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_LIST, pNomeRegola, pDirezioneGiu);
- de.addImage(imageDown);
- }
- de.setValue(registro.getPosizione()+"");
- e.add(de);
- }
-
- // Stato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(registro.getStato()==null // backward compatibility
- ||
- StatoFunzionalita.ABILITATO.equals(registro.getStato())){
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_CHANGE, pNomeRegola);
- e.add(de);
-
-
- // Nome
- de = new DataElement();
- de.setIdToRemove(registro.getNome());
- de.setValue(registro.getNome());
- de.setToolTip(registro.getNome());
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_CHANGE, pOldNomePlugin);
- e.add(de);
-
- // ultimo aggiornamento
- de = new DataElement();
- Date dataUltimoAggiornamento = registro.getData();
- String dataValue = "--";
-
- if(dataUltimoAggiornamento != null) {
- dataValue = DateUtils.getSimpleDateFormat(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_FORMATO_DATA).format(dataUltimoAggiornamento);
- de.setToolTip(dataValue);
- }
-
- de.setValue(dataValue);
- e.add(de);
-
- // applicabilita
- de = new DataElement();
- if(registro.getCompatibilitaList().size() > 0) {
-
- StringBuilder sb = new StringBuilder();
- for (String appValue : registro.getCompatibilitaList()) {
- TipoPlugin tipo = TipoPlugin.toEnumConstant(appValue, true);
- String label = ConfigurazionePluginsTipoPluginUtils.tipoPluginToLabel(tipo);
- if(sb.length()>0) {
- sb.append(", ");
- }
- sb.append(label);
- }
-
- String compatibilita = sb.toString();
-
- if(compatibilita.length() > 100) {
- de.setValue(compatibilita.substring(0, 97)+"...");
- de.setToolTip(compatibilita);
- } else {
- de.setValue(compatibilita);
- }
- }else {
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN_QUALSIASI_IN_LIST);
- }
-
- e.add(de);
-
- dati.add(e);
- i++;
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport()) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_PLUGIN_ARCHVIO, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PLUGIN_ARCHIVIO_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_PLUGIN_ARCHIVIO_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public List<DataElement> addRegistroPluginToDati(TipoOperazione tipoOp, List<DataElement> dati, String oldNome, String idArchivioS,
- String nome, String descrizione, String stato, String sorgente, BinaryParameter jarArchivio,
- String dirArchivio, String urlArchivio, String classiPlugin, String[] tipoPlugin, int numeroArchivi) {
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_ARCHIVIO);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- de.setValue(nome);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- de.setSize( getSize());
- de.setRequired(true);
- dati.add(de);
-
- if(tipoOp.equals(TipoOperazione.ADD)) {
-
- } else {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_ID_ARCHIVIO);
- de.setValue(idArchivioS);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_ID_ARCHIVIO);
- de.setSize( getSize());
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- de.setValue(oldNome);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_OLD_NOME);
- de.setSize( getSize());
- dati.add(de);
- }
-
- // stato
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_STATO);
- String [] labelsStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
- String [] valuesStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
- de.setLabels(labelsStato);
- de.setValues(valuesStato);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_STATO);
- de.setSelected(stato);
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DESCRIZIONE);
- de.setValue(descrizione);
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(3);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DESCRIZIONE);
- de.setSize(this.getSize());
- dati.add(de);
-
- if(tipoOp.equals(TipoOperazione.ADD)) {
- dati = addRegistroPluginJarToDati(TipoOperazione.ADD, dati, false, nome, sorgente, jarArchivio, dirArchivio, urlArchivio);
- } else {
- // link alla lista degli archivi
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_LIST ,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME, oldNome));
- Boolean contaListe = ServletUtils.getContaListeFromSession(this.session);
- if (contaListe!=null && contaListe.booleanValue())
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_ARCHIVI_ARCHIVI_JAR +" (" + numeroArchivi + ")");
- else
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_ARCHIVI_ARCHIVI_JAR);
- dati.add(de);
-
- }
-
- // applicabilita
- dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_APPLICABILITA);
- dataElement.setType(DataElementType.SUBTITLE);
- dati.add(dataElement);
-
- // classi plugin
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN);
- de.setType(DataElementType.SELECT);
- de.setLabels(ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN);
- de.setValues(ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN);
- de.setSelected(classiPlugin);
- de.setPostBack(true);
- dati.add(de);
-
- // tipo plugin
- if(classiPlugin.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN_SELEZIONATE)) {
- de = new DataElement();
- de.setLabel("");
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_TIPO_PLUGIN);
- de.setType(DataElementType.MULTI_SELECT);
- de.setLabels(ConfigurazionePluginsTipoPluginUtils.getLabelsTipoPlugin(this.confCore.isConfigurazioneAllarmiEnabled()));
- de.setValues(ConfigurazionePluginsTipoPluginUtils.getValuesTipoPlugin(this.confCore.isConfigurazioneAllarmiEnabled()));
- de.setSelezionati(tipoPlugin);
- dati.add(de);
- }
-
- return dati;
- }
-
- public List<DataElement> addRegistroPluginJarToDati(TipoOperazione tipoOp, List<DataElement> dati, boolean addTitle, String nomePlugin, String sorgente, BinaryParameter jarArchivio, String dirArchivio,
- String urlArchivio) {
- DataElement de;
-
- if(addTitle) {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_ARCHIVIO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- de.setValue(nomePlugin);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME);
- de.setSize( getSize());
- dati.add(de);
- }
-
- // sorgente
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE);
- de.setType(DataElementType.SELECT);
- de.setLabels(ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE);
- de.setValues(ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE);
- de.setSelected(sorgente);
- de.setPostBack(true);
- dati.add(de);
-
- if(sorgente.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE_JAR)) {
- // jar
- DataElement deJarArchivio = jarArchivio.getFileDataElement(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVIO, "", getSize());
- deJarArchivio.setRequired(true);
- dati.add(deJarArchivio);
- dati.addAll(jarArchivio.getFileNameDataElement());
- dati.add(jarArchivio.getFileIdDataElement());
- } else if(sorgente.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE_DIR)) {
- // dir
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO);
- de.setValue(dirArchivio);
- de.setType(DataElementType.TEXT_AREA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO);
- de.setSize(this.getSize());
- de.setRequired(true);
- dati.add(de);
- } else {
- // url
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO);
- de.setValue(urlArchivio);
- de.setType(DataElementType.TEXT_AREA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO);
- de.setSize(this.getSize());
- de.setRequired(true);
- dati.add(de);
- }
-
- return dati;
- }
-
- public boolean registroPluginCheckData(TipoOperazione tipoOp, String oldNome, String idArchivioS,
- String nome, String descrizione, String stato, String sorgente, BinaryParameter jarArchivio,
- String dirArchivio, String urlArchivio, String classiPlugin, String[] tipoPlugin) throws Exception {
-
- try {
- if(nome==null || "".equals(nome)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME+"'");
- return false;
- }
- if(nome.contains(" ")) {
- this.pd.setMessage("No indicare spazi nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME+"'");
- return false;
- }
- if(!this.checkLength255(nome, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME)) {
- return false;
- }
-
- // Se tipoOp = add, controllo che l'archivio non sia gia' stato registrato
- boolean existsArchivio = this.confCore.existsRegistroPlugin(nome);
-
- if (tipoOp.equals(TipoOperazione.ADD)) {
- if (existsArchivio) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_ARCHIVIO_DUPLICATO);
- return false;
- }
- } else {
- // controllo che le modifiche ai parametri non coincidano con altre regole gia' presenti
- // TrasformazioneRegola trasformazione = this.porteApplicativeCore.getTrasformazione(idPorta, azioniDBCheck, patternDBCheck, contentTypeDBCheck);
- if(!nome.equals(oldNome) && existsArchivio) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_ARCHIVIO_NUOVO_NOME_DUPLICATO);
- return false;
- }
- }
-
- if(!this.checkLength255(descrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DESCRIZIONE)) {
- return false;
- }
-
- boolean valArchivio = this.registroPluginArchivioCheckData(tipoOp, sorgente, nome, jarArchivio, dirArchivio, urlArchivio, false);
-
- if(!valArchivio)
- return valArchivio;
-
- if(classiPlugin.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN_SELEZIONATE)) {
- // compatibilita'
- if(tipoPlugin == null || tipoPlugin.length == 0){
- this.pd.setMessage("Indicare almeno un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_CLASSI_PLUGIN+"'");
- return false;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public boolean registroPluginArchivioCheckData(TipoOperazione tipoOp, String sorgente, String nomePlugin, BinaryParameter jarArchivio,
- String dirArchivio, String urlArchivio, boolean addJar) throws Exception {
-
- try {
- if (tipoOp.equals(TipoOperazione.ADD)) {
- if(sorgente==null || "".equals(sorgente)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE+"'");
- return false;
- }
-
- PluginSorgenteArchivio pluginSorgenteArchivio = DriverConfigurazioneDBLib.getEnumPluginSorgenteArchivio(sorgente);
-
- if(pluginSorgenteArchivio == null) {
- this.pd.setMessage("Il valore indicato nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE+"' non è valido.");
- return false;
- }
-
- switch (pluginSorgenteArchivio) {
- case JAR:
- // jar
- if(jarArchivio.getValue() == null || jarArchivio.getValue().length == 0){
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVIO+"'");
- return false;
- }
-
- String nomeFile = jarArchivio.getFilename();
- if(addJar && this.confCore.existsRegistroPluginArchivio(nomePlugin, nomeFile)) {
- this.pd.setMessage("Un '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVIO+"' con lo stesso nome è già stato assegnato al plugin");
- return false;
- }
- break;
- case URL:
- // url
- if(urlArchivio==null || "".equals(urlArchivio)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO+"'");
- return false;
- }
- if(urlArchivio.contains(" ")) {
- this.pd.setMessage("Non indicare spazi nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO+"'");
- return false;
- }
- if(!this.checkLength4000(urlArchivio, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO)) {
- return false;
- }
-
- try {
- new URL(urlArchivio);
- }catch(Exception e) {
- this.pd.setMessage("Il valore indicato nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO+"' non rappresenta una URL valida.");
- return false;
- }
-
- if(addJar && this.confCore.existsRegistroPluginArchivio(nomePlugin, pluginSorgenteArchivio, urlArchivio)) {
- this.pd.setMessage("Un '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVIO+"', riferito con la stessa URL, è già stato assegnato al plugin");
- return false;
- }
-
- break;
- case DIR:
- // dir
- if(dirArchivio==null || "".equals(dirArchivio)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO+"'");
- return false;
- }
- if(dirArchivio.contains(" ")) {
- this.pd.setMessage("Non indicare spazi nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO+"'");
- return false;
- }
- if(!this.checkLength4000(dirArchivio, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO)) {
- return false;
- }
- try {
- Paths.get(dirArchivio);
- } catch (InvalidPathException ex) {
- this.pd.setMessage("Il valore indicato nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO+"' non rappresenta un path valido.");
- return false;
- } catch (NullPointerException ex) {
- this.pd.setMessage("Il valore indicato nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO+"' non rappresenta un path valido.");
- return false;
- }
-
- if(addJar && this.confCore.existsRegistroPluginArchivio(nomePlugin, pluginSorgenteArchivio, dirArchivio)) {
- this.pd.setMessage("Un repository di '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVI+"', riferito con la directory indicata, è già stato assegnato al plugin");
- return false;
- }
-
- break;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- // Prepara la lista degli archivi di un plugin
- public void preparePluginsArchiviJarList(String nome, ISearch ricerca, List<RegistroPluginArchivio> lista) throws Exception {
- try {
-
- Parameter pNomeRegistro = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME, nome);
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR, pNomeRegistro);
- int idLista = Liste.CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
-
- Map<String, String> campiHidden = new HashMap<>();
- campiHidden.put(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_NOME, nome);
- this.pd.setHidden(campiHidden);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_REGISTRO_ARCHIVI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_LIST));
- lstParam.add(new Parameter(nome, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_CHANGE,
- new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_OLD_NOME, nome)));
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_NOME);
- String labelJarDi = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_ARCHIVI_ARCHIVI_JAR;
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(labelJarDi, null));
- }else{
- lstParam.add(new Parameter(labelJarDi, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_LIST, pNomeRegistro));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_NOME, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DATA_REGISTRAZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_TIPO_SORGENTE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_SORGENTE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_ARCHIVIO);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- boolean visualizzaElimina = false;
- if (lista != null) {
- Iterator<RegistroPluginArchivio> it = lista.iterator();
- visualizzaElimina = lista.size() > 1;
- while (it.hasNext()) {
- RegistroPluginArchivio registro = it.next();
- PluginSorgenteArchivio sorgente = registro.getSorgente();
-
- List<DataElement> e = new ArrayList<>();
-
- // Data Inserimento (definisce IdToRemove)
- DataElement de = new DataElement();
- de.setIdToRemove(registro.getNome());
- Date dataInserimento = registro.getData();
- String dataValue = "--";
- if(dataInserimento != null) {
- dataValue = DateUtils.getSimpleDateFormat(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_FORMATO_DATA).format(dataInserimento);
- de.setToolTip(dataValue);
- }
- de.setValue(dataValue);
- e.add(de);
-
- // Tipo Sorgente
- de = new DataElement();
- switch (sorgente) {
- case DIR:
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DIR_ARCHIVIO);
- break;
- case JAR:
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_JAR_ARCHIVIO);
- break;
- case URL:
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_URL_ARCHIVIO);
- break;
- }
- e.add(de);
-
- // Sorgente
- de = new DataElement();
- switch (sorgente) {
- case DIR:
- de.setValue(registro.getDir());
- break;
- case JAR:
- de.setValue(registro.getNome());
- break;
- case URL:
- de.setValue(registro.getUrl());
- break;
- }
- e.add(de);
-
- // Archivio
- de = new DataElement();
- switch (sorgente) {
- case DIR:
- de.setValue("-");
- break;
- case JAR:
- de.setValue(AccordiServizioParteComuneCostanti.LABEL_DOWNLOAD.toLowerCase());
- de.setUrl(ArchiviCostanti.SERVLET_NAME_DOCUMENTI_EXPORT,
- new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO_TIPO_DOCUMENTO, ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_ARCHIVIO_JAR),
- new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_ALLEGATO_TIPO_ACCORDO, ArchiviCostanti.PARAMETRO_VALORE_ARCHIVI_ALLEGATO_TIPO_ARCHIVIO_JAR),
- new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_JAR_NOME_PLUGIN, registro.getNomePlugin()),
- new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_JAR_NOME_ARCHVIO, registro.getNome()));
- de.setDisabilitaAjaxStatus();
- break;
- case URL:
- de.setValue("-");
- break;
- }
- e.add(de);
-
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- this.pd.setRemoveButton(visualizzaElimina);
- this.pd.setSelect(visualizzaElimina);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- // Prepara la lista delle classi di plugin configurate
- public void preparePluginsClassiList(ISearch ricerca, List<Plugin> lista) throws Exception {
- try {
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_PLUGINS_CLASSI);
- int idLista = Liste.CONFIGURAZIONE_PLUGINS_CLASSI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- String filterTipo = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_PLUGIN_CLASSI);
- this.addFilterTipoPlugin(filterTipo, true);
- // filtro dinamico in base al tipo plugin
- if(!filterTipo.equals("")) {
- ConfigurazionePluginsTipoPluginUtils.addFiltriSpecificiTipoPlugin(this.pd, this.log, ricerca, idLista, filterTipo, this.getSize(),
- this.confCore.isIntegrationManagerEnabled());
- }
-
- // setto la barra del titolo
- List<Parameter> lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL);
- if(search.equals("")){
- this.pd.setSearchDescription("");
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_CLASSI, null));
- }else{
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_REGISTRO_CLASSI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_CLASSI_LIST));
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_APPLICABILITA);
- lstLabels.add(CostantiControlStation.LABEL_IN_USO_COLONNA_HEADER); // inuso
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<Plugin> it = lista.iterator();
- while (it.hasNext()) {
- Plugin registro = it.next();
-
- List<DataElement> e = new ArrayList<>();
- Parameter pIdRegistro = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_ID_PLUGIN, registro.getId() + "");
-
- // Stato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(registro.getStato()){
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- // de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_ARCHIVI_CHANGE, pNomeRegola);
- e.add(de);
-
-
- // tipo plugin
- de = new DataElement();
- de.setIdToRemove(registro.getId() + "");
- TipoPlugin tipoPlugin = TipoPlugin.toEnumConstant(registro.getTipoPlugin());
- String tipoPluginLabel = ConfigurazionePluginsTipoPluginUtils.tipoPluginToLabel(tipoPlugin);
- de.setValue(tipoPluginLabel);
- if(registro.getDescrizione()!=null && !"".equals(registro.getDescrizione())) {
- de.setToolTip(registro.getDescrizione());
- }
- else {
- de.setToolTip(tipoPluginLabel);
- }
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_PLUGINS_CLASSI_CHANGE, pIdRegistro);
- e.add(de);
-
- // tipo
- de = new DataElement();
- de.setValue(registro.getTipo());
- e.add(de);
-
- // label
- de = new DataElement();
- de.setValue(registro.getLabel());
- e.add(de);
-
- // applicabilita
- de = new DataElement();
- String applicabilita = ConfigurazionePluginsTipoPluginUtils.getApplicabilitaClassePlugin(registro);
- if(applicabilita != null) {
- if(applicabilita.length() > 100) {
- de.setValue(applicabilita.substring(0, 97)+"...");
- de.setToolTip(applicabilita);
- } else {
- de.setValue(applicabilita);
- }
- }else {
- de.setValue("-");
- }
- e.add(de);
-
- // InUso
- this.addInUsoButtonVisualizzazioneClassica(e, tipoPluginLabel + " - " +registro.getLabel(), registro.getId() + "", InUsoType.PLUGIN_CLASSE);
-
- dati.add(e);
- }
- }
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport()) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.CONFIGURAZIONE_PLUGIN_CLASSE, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_PLUGIN_CLASSE_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_PLUGIN_CLASSE_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public List<DataElement> addPluginClassiToDati(TipoOperazione tipoOp, List<DataElement> dati, String idPluginS,
- TipoPlugin tipoPlugin, String tipo, String label, String className, String stato, String descrizione, String ruolo,
- String shTipo, String mhTipo, String mhRuolo,
- String applicabilita) {
-
- DataElement dataElement = new DataElement();
- dataElement.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_PLUGINS_CLASSI_PLUGIN);
- dataElement.setType(DataElementType.TITLE);
- dati.add(dataElement);
-
- boolean visualizzaAllarmi = this.confCore.isVisualizzaConfigurazioneAllarmiEnabled(); // configurazione allarmi (solo se sono stati caricati dei plugin di tipo allarme) tramite la funzionalità 'Importa'
-
- // tipoPlugin
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN);
- List<String> labels = new ArrayList<>();
- if(tipoOp.equals(TipoOperazione.ADD)) {
- labels.add(CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_LABEL_UNDEFINED);
- }
- labels.addAll(ConfigurazionePluginsTipoPluginUtils.getLabelsTipoPlugin(visualizzaAllarmi));
- List<String> values = new ArrayList<>();
- if(tipoOp.equals(TipoOperazione.ADD)) {
- values.add(CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED);
- }
- values.addAll(ConfigurazionePluginsTipoPluginUtils.getValuesTipoPlugin(visualizzaAllarmi));
- de.setLabels(labels);
- de.setValues(values);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN);
- if(tipoPlugin!=null) {
- de.setSelected(tipoPlugin.toString());
- }
- if(tipoOp.equals(TipoOperazione.ADD)) {
- de.setRequired(true);
- }
- de.setPostBack(true);
- dati.add(de);
-
- if(tipoOp.equals(TipoOperazione.ADD)) {
-
- } else {
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_ID_PLUGIN);
- de.setValue(idPluginS);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_ID_PLUGIN);
- de.setSize(getSize());
- dati.add(de);
- }
-
- // sezione dinamica
- if(tipoPlugin!=null) {
- dati = ConfigurazionePluginsTipoPluginUtils.getSezioneDinamicaClassePlugin(dati, tipoPlugin, ruolo, shTipo, mhTipo, mhRuolo, applicabilita,
- this.confCore.isIntegrationManagerEnabled());
- }
-
- // tipo
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO);
- de.setValue(tipo);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO);
- de.setSize(this.getSize());
- de.setRequired(true);
- dati.add(de);
-
- // class name
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_CLASS_NAME);
- de.setValue(className);
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(2);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_CLASS_NAME);
- de.setSize(this.getSize());
- de.setRequired(true);
- if(tipoPlugin!=null) {
- ConfigurazionePluginsTipoPluginUtils.addInfoClassePlugin(de, tipoPlugin, ruolo, shTipo, mhTipo, mhRuolo,
- this.confCore.isIntegrationManagerEnabled());
- }
- dati.add(de);
-
- // label
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL);
- de.setValue(label);
- de.setType(DataElementType.TEXT_EDIT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL);
- de.setSize(this.getSize());
- de.setRequired(true);
- dati.add(de);
-
- // stato
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_STATO);
- String [] labelsStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
- String [] valuesStato = {StatoFunzionalita.ABILITATO.toString(), StatoFunzionalita.DISABILITATO.toString()};
- de.setLabels(labelsStato);
- de.setValues(valuesStato);
- de.setType(DataElementType.SELECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_STATO);
- de.setSelected(stato);
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_DESCRIZIONE);
- de.setValue(descrizione);
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(3);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_DESCRIZIONE);
- de.setSize(this.getSize());
- dati.add(de);
-
- return dati;
- }
-
- public boolean pluginClassiCheckData(TipoOperazione tipoOp, Plugin oldPlugin, String idPluginS, TipoPlugin tipoPlugin, String tipo,
- String label, String className, String stato, String descrizione, String ruolo, String shTipo, String mhTipo, String mhRuolo, String applicabilita) throws Exception {
-
- try {
-
- // tipo plugin
- if(tipoPlugin==null) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN+"'");
- return false;
- }
-
- // sezione dinamica
-
-
- // tipo
- if(tipo==null || "".equals(tipo)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO+"'");
- return false;
- }
- if(tipo.contains(" ")) {
- this.pd.setMessage("Non indicare spazi nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO+"'");
- return false;
- }
- if(!this.checkSimpleName(tipo, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO)) {
- return false;
- }
- if(TipoPlugin.AUTENTICAZIONE.equals(tipoPlugin)){
- int lenghtMax = 20 - (TipoCredenzialeMittente.TRASPORTO.getRawValue()+"_").length();
- if(!this.checkLength(tipo, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO, 1, lenghtMax)) { // finisce poi nei log delle transazioni
- return false;
- }
- }
- else if(!this.checkLength255(tipo, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO)) {
- return false;
- }
-
- // label
- if(label==null || "".equals(label)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL+"'");
- return false;
- }
-
- if(!this.checkLength255(label, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_LABEL)) {
- return false;
- }
-
- // classname
- if(className==null || "".equals(className)) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_CLASS_NAME+"'");
- return false;
- }
- if(className.contains(" ")) {
- this.pd.setMessage("Non indicare spazi nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_CLASS_NAME+"'");
- return false;
- }
- if(!this.checkLength255(className, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_CLASS_NAME)) {
- return false;
- }
-
- if(!this.checkLength255(descrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DESCRIZIONE)) {
- return false;
- }
-
-
- // Non posso modificare, negli elementi riferiti, un plugin in uso
- if (tipoOp.equals(TipoOperazione.CHANGE)) {
-
- TipoPlugin oldTipoPlugin = TipoPlugin.toEnumConstant(oldPlugin.getTipoPlugin());
- boolean oldStatoEnabled = ServletUtils.isCheckBoxEnabled(stato);
- boolean modificatiElementiRiferiti = (!tipoPlugin.equals(oldTipoPlugin)) || (!tipo.equals(oldPlugin.getTipo())) || (oldStatoEnabled != oldPlugin.getStato());
-
- if(modificatiElementiRiferiti) {
-
- HashMap<ErrorsHandlerCostant, List<String>> whereIsInUso = new HashMap<ErrorsHandlerCostant, List<String>>();
- boolean normalizeObjectIds = !this.isModalitaCompleta();
- boolean pluginInUso = this.confCore.isPluginInUso(oldPlugin.getClassName(),
- oldPlugin.getLabel(), oldPlugin.getTipoPlugin(), oldPlugin.getTipo(),whereIsInUso,normalizeObjectIds);
-
- if (pluginInUso) {
- if((oldStatoEnabled != oldPlugin.getStato())) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_PLUGIN_INUSO_MODIFICA_STATO);
- }
- else {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_PLUGIN_INUSO_MODIFICA_TIPO);
- }
- return false;
- }
- }
-
- }
-
-
- // Se tipoOp = add, controllo che l'archivio non sia gia' stato registrato
- boolean existsPluginConTipo = this.confCore.existsPluginConTipo(tipoPlugin, tipo);
- boolean existsPluginConLabel = this.confCore.existsPluginConLabel(tipoPlugin, label);
- boolean existsPluginConClassName = this.confCore.existsPluginConClassName(tipoPlugin, className);
- boolean errorExists = false;
-
- if (tipoOp.equals(TipoOperazione.ADD)) {
- errorExists = existsPluginConTipo || existsPluginConLabel || existsPluginConClassName;
- } else {
- // controllo che le modifiche ai parametri non coincidano con altre regole gia' presenti
- TipoPlugin oldTipoPlugin = TipoPlugin.toEnumConstant(oldPlugin.getTipoPlugin());
-
- // controllare se e' variato uno dei tipi della unique
- if(!tipoPlugin.equals(oldTipoPlugin)) {
- errorExists = existsPluginConTipo || existsPluginConLabel || existsPluginConClassName;
- }
- else if(!tipo.equals(oldPlugin.getTipo()) && existsPluginConTipo) {
- errorExists = true;
- }
- else if(!label.equals(oldPlugin.getLabel()) && existsPluginConLabel) {
- errorExists = true;
- }
- else if(!className.equals(oldPlugin.getClassName()) && existsPluginConClassName) {
- errorExists = true;
- }
- }
-
- if(errorExists) {
-
- String descrizioneTipoPlugin = ConfigurazionePluginsTipoPluginUtils.tipoPluginToLabel(tipoPlugin);
-
- if (existsPluginConTipo) {
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_PLUGIN_DUPLICATO_TIPO, descrizioneTipoPlugin, tipo));
- return false;
- }
- if (existsPluginConLabel) {
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_PLUGIN_DUPLICATO_LABEL, descrizioneTipoPlugin, label));
- return false;
- }
- if (existsPluginConClassName) {
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_PLUGINS_PLUGIN_DUPLICATO_CLASSNAME, descrizioneTipoPlugin, className));
- return false;
- }
- }
-
- if(!this.checkLength255(descrizione, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_DESCRIZIONE)) {
- return false;
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public void addFilterTipoPlugin(String tipoPlugin, boolean postBack) throws Exception{
- try {
-
- boolean visualizzaAllarmi = this.confCore.isVisualizzaConfigurazioneAllarmiEnabled(); // configurazione allarmi (solo se sono stati caricati dei plugin di tipo allarme) tramite la funzionalità 'Importa'
- List<String> valuesTipoPlugin = ConfigurazionePluginsTipoPluginUtils.getValuesTipoPlugin(visualizzaAllarmi);
- List<String> labelsTipoPlugin = ConfigurazionePluginsTipoPluginUtils.getLabelsTipoPlugin(visualizzaAllarmi);
-
- int length = 1;
- if(valuesTipoPlugin!=null && valuesTipoPlugin.size()>0) {
- length+=valuesTipoPlugin.size();
- }
- String [] values = new String[length];
- String [] labels = new String[length];
- labels[0] = CostantiControlStation.LABEL_PARAMETRO_RUOLO_QUALSIASI;
- values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_QUALSIASI;
- if(valuesTipoPlugin!=null && valuesTipoPlugin.size()>0) {
- for (int i =0; i < valuesTipoPlugin.size() ; i ++) {
- labels[i+1] = labelsTipoPlugin.get(i);
- values[i+1] = valuesTipoPlugin.get(i);
- }
- }
-
- this.pd.addFilter(Filtri.FILTRO_TIPO_PLUGIN_CLASSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN, tipoPlugin, values, labels, postBack, this.getSize());
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public void addFiltriSpecificiTipoPlugin(String tipoPlugin, boolean postBack) throws Exception{
- try {
-
- List<String> valuesTipoPlugin = ConfigurazionePluginsTipoPluginUtils.getValuesTipoPlugin(this.confCore.isConfigurazioneAllarmiEnabled());
- List<String> labelsTipoPlugin = ConfigurazionePluginsTipoPluginUtils.getLabelsTipoPlugin(this.confCore.isConfigurazioneAllarmiEnabled());
-
- int length = 1;
- if(valuesTipoPlugin!=null && valuesTipoPlugin.size()>0) {
- length+=valuesTipoPlugin.size();
- }
- String [] values = new String[length];
- String [] labels = new String[length];
- labels[0] = CostantiControlStation.LABEL_PARAMETRO_RUOLO_QUALSIASI;
- values[0] = CostantiControlStation.DEFAULT_VALUE_PARAMETRO_RUOLO_QUALSIASI;
- if(valuesTipoPlugin!=null && valuesTipoPlugin.size()>0) {
- for (int i =0; i < valuesTipoPlugin.size() ; i ++) {
- labels[i+1] = labelsTipoPlugin.get(i);
- values[i+1] = valuesTipoPlugin.get(i);
- }
- }
-
- this.pd.addFilter(Filtri.FILTRO_TIPO_PLUGIN_CLASSI, ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_CLASSI_TIPO_PLUGIN, tipoPlugin, values, labels, postBack, this.getSize());
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public void prepareAllarmiList(ConsoleSearch ricerca, List<ConfigurazioneAllarmeBean> lista,
- RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding) throws Exception{
- try {
- List<Parameter> lstParamSession = new ArrayList<>();
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
- lstParamSession.add(parRuoloPorta);
- }
- Parameter parNomePorta = null;
- if(nomePorta!=null) {
- parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
- lstParamSession.add(parNomePorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
- lstParamSession.add(parServiceBinding);
- }
-
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI, lstParamSession);
- int idLista = Liste.CONFIGURAZIONE_ALLARMI;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- String filterStato = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_STATO);
- boolean addStatiAllarme = this.confCore.isShowAllarmiSearchStatiAllarmi();
- this.addFilterStato(filterStato, addStatiAllarme, false);
-
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
- this.pd.setCustomListViewName(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARMI_NOME_VISTA_CUSTOM_LISTA);
-
-
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- lstParamPorta = getTitleListAllarmi(ruoloPorta, nomePorta, serviceBinding, null);
- }
-
-
- this.pd.setSearchLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS);
-
- if(search.equals("")){
- this.pd.setSearchDescription("");
- }
- // setto la barra del titolo
- List<Parameter> lstParam = null;
- if(lstParamPorta!=null) {
- lstParam = lstParamPorta;
- } else {
- lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI, null));
- }
-
- if(!search.equals("")){
- if(lstParamSession.size() > 0) {
- lstParam.set((lstParam.size() -1), new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST, lstParamSession.toArray(new Parameter[lstParamSession.size()])));
- } else {
- lstParam.set((lstParam.size() -1), new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
- ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST));
- }
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
-
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- if(ruoloPorta!=null) {
- this.impostaComandiMenuContestualeAllarmi(ruoloPorta, nomePorta);
- }
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI, search);
- }
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- //lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO);
- // lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STATO);
- // lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- //lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO);
- // lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS);
- // lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DESCRIZIONE);
- // lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUNTIME);
-
- // label vista custom
- lstLabels.add("");//ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STATO); // colonna stato
- lstLabels.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI);
-
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<ConfigurazioneAllarmeBean> it = lista.iterator();
- while (it.hasNext()) {
- List<DataElement> e = creaEntryAllarmeCustom(lstParamSession, it);
-
- dati.add(e);
- }
- }
-
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
-
- // preparo bottoni
- if(lista!=null && lista.size()>0){
- if (this.core.isShowPulsantiImportExport() && (nomePorta==null || StringUtils.isEmpty(nomePorta))) {
- ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
- if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.ALLARME, this.request, this.session)){
- List<AreaBottoni> bottoni = new ArrayList<>();
- AreaBottoni ab = new AreaBottoni();
- List<DataElement> otherbott = new ArrayList<>();
- DataElement de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_ALLARMI_ESPORTA_SELEZIONATI);
- de.setOnClick(ConfigurazioneCostanti.LABEL_ALLARMI_ESPORTA_SELEZIONATI_ONCLICK);
- de.setDisabilitaAjaxStatus();
- otherbott.add(de);
- ab.setBottoni(otherbott);
- bottoni.add(ab);
- this.pd.setAreaBottoni(bottoni);
- }
- }
- }
-
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public void impostaComandiMenuContestualeAllarmi(RuoloPorta ruoloPorta, String nomePorta) throws Exception{
- if(ruoloPorta!=null) {
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- IDPortaDelegata idPortaDelegata = new IDPortaDelegata();
- idPortaDelegata.setNome(nomePorta);
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPortaDelegata);
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- porteDelegateHelper.impostaComandiMenuContestualePD(idSoggetto +"", idAsps+"", idFruizione+"");
- }
- else {
- IDPortaApplicativa idPortaApplicativa = new IDPortaApplicativa();
- idPortaApplicativa.setNome(nomePorta);
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPortaApplicativa);
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- porteApplicativeHelper.impostaComandiMenuContestualePA(idSoggetto+"", idAsps+"");
- }
- }
- }
-
- public List<DataElement> creaEntryAllarme(List<Parameter> lstParamSession, Iterator<ConfigurazioneAllarmeBean> it)
- throws UtilsException {
- ConfigurazioneAllarmeBean allarme = it.next();
-
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- List<Parameter> lstParamEntry = new ArrayList<>();
- lstParamEntry.add(pId);
- if(lstParamSession.size() > 0) {
- lstParamEntry.addAll(lstParamSession);
- }
-
- List<DataElement> e = new ArrayList<>();
-
- // Abilitato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(allarme.getEnabled() == 1){
- if(this.confCore.isShowAllarmiElenchiStatiAllarmi()) {
- if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_OK.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- } else if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_ERROR.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- de.setSelected(CheckboxStatusType.CONFIG_ERROR);
- } else if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_WARNING.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- de.setSelected(CheckboxStatusType.CONFIG_WARNING);
- }
- }
- else {
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- e.add(de);
-
- // Stato
- // de = new DataElement();
- //
- // if(allarme.getEnabled() == 1) {
- // if(allarme.getStato() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_OK) {
- // de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- // de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- // } else if(allarme.getStato() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_ERROR) {
- // de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- // de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- // } else if(allarme.getStato() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_WARNING) {
- // de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- // de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- // }
- // } else {
- // de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- // }
- //
- // e.add(de);
-
- // // Tipo
- // de = new DataElement();
- // de.setValue(allarme.getTipo());
- // e.add(de);
-
- // TipoAllarme
-
- de = new DataElement();
- de.setWidthPx(24);
- de.setType(DataElementType.IMAGE);
- DataElementImage imageUp = new DataElementImage();
- String mode = TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme()) ? ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_ATTIVA : ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_PASSIVA;
- if(TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme())) {
- imageUp.setImage(CostantiControlStation.ICONA_ALARM_ACTIVE);
- imageUp.setToolTip(mode);
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_ALARM_PASSIVE);
- imageUp.setToolTip(mode);
- }
- de.addImage(imageUp);
- de.allineaTdAlCentro();
- de.setValue(mode);
- e.add(de);
-
- // Nome
- de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- de.setValue(allarme.getAlias());
- de.setIdToRemove(""+allarme.getId());
- //de.setToolTip(allarme.getNome());
- de.setToolTip(allarme.getAlias());
- e.add(de);
-
- // Descrizione
- de = new DataElement();
- de.setValue(allarme.getDescrizioneAbbr());
- de.setToolTip(allarme.getDescrizione());
- e.add(de);
-
- // Runtime
- boolean isActive = allarme.getEnabled() == 1 && TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme());
- de = new DataElement();
- if(isActive){
- de.setValue("Visualizza");
- }
- else{
- de.setValue("-");
- }
- de.allineaTdAlCentro();
- de.setWidthPx(60);
- if(isActive){
- Parameter pState = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE, true+"");
- List<Parameter> lstParamEntryState = new ArrayList<>();
- lstParamEntryState.addAll(lstParamEntry);
- lstParamEntryState.add(pState);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryState.toArray(new Parameter[lstParamEntryState.size()]));
- }
- e.add(de);
- return e;
- }
-
- private List<DataElement> creaEntryAllarmeCustom(List<Parameter> lstParamSession, Iterator<ConfigurazioneAllarmeBean> it) throws UtilsException {
- ConfigurazioneAllarmeBean allarme = it.next();
-
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- List<Parameter> lstParamEntry = new ArrayList<>();
- lstParamEntry.add(pId);
- if(lstParamSession.size() > 0) {
- lstParamEntry.addAll(lstParamSession);
- }
-
- List<DataElement> e = new ArrayList<>();
-
- // Riga 1 Titolo
- DataElement de = new DataElement();
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- de.setValue(allarme.getAlias());
- de.setIdToRemove(""+allarme.getId());
- de.setType(DataElementType.TITLE);
- e.add(de);
-
- // Riga2 : Modalita' + descrizione
- de = new DataElement();
- String mode = TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme()) ? ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_ATTIVA : ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_PASSIVA;
- String descrAbbr = allarme.getDescrizioneAbbr();
- if(StringUtils.isNotBlank(descrAbbr)) {
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_ALLARMI_LIST_MODALITA_DESCRIZIONE, mode, descrAbbr));
- } else {
- de.setValue(MessageFormat.format(ConfigurazioneCostanti.MESSAGE_METADATI_ALLARMI_LIST_MODALITA, mode));
- }
- de.setType(DataElementType.SUBTITLE);
- e.add(de);
-
- // Abilitato
- de = new DataElement();
- de.setWidthPx(16);
- de.setType(DataElementType.CHECKBOX);
- if(allarme.getEnabled() == 1){
- if(this.confCore.isShowAllarmiElenchiStatiAllarmi()) {
- if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_OK.intValue())) {
- de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
- de.setStatusToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- } else if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_ERROR.intValue())) {
- de.setStatusType(CheckboxStatusType.CONFIG_ERROR);
- de.setStatusToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- } else if(allarme.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_WARNING.intValue())) {
- de.setStatusType(CheckboxStatusType.CONFIG_WARNING);
- de.setStatusToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- }
- }
- else {
- de.setStatusType(CheckboxStatusType.CONFIG_ENABLE);
- de.setStatusToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- }
- }
- else{
- de.setStatusType(CheckboxStatusType.CONFIG_DISABLE);
- de.setStatusToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- e.add(de);
-
- // Runtime
- boolean isActive = allarme.getEnabled() == 1 && TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme());
- de = new DataElement();
- if(isActive){
- Parameter pState = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE, true+"");
- List<Parameter> lstParamEntryState = new ArrayList<>();
- lstParamEntryState.addAll(lstParamEntry);
- lstParamEntryState.add(pState);
- this.addVisualizzaRuntimeButton(e, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryState);
- }
-
- return e;
- }
-
- public List<Parameter> getTitleListAllarmi(RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding, String nomeOggetto) throws Exception{
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- String labelPerPorta = null;
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
- Integer parentPD = ServletUtils.getIntegerAttributeFromSession(PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT, this.session, this.request);
- if(parentPD == null) parentPD = PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_NONE;
-
- IDPortaDelegata idPortaDelegata = new IDPortaDelegata();
- idPortaDelegata.setNome(nomePorta);
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPortaDelegata);
- String idporta = myPD.getNome();
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- lstParamPorta = porteDelegateHelper.getTitoloPD(parentPD,idSoggetto +"", idAsps+"", idFruizione+"");
-
- if(parentPD!=null && (parentPD.intValue() == PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_CONFIGURAZIONE)) {
- labelPerPorta = this.porteDelegateCore.getLabelRegolaMappingFruizionePortaDelegata(
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_DI,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
- myPD);
- }
- else {
- labelPerPorta = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_DI+idporta;
- }
-
- }
- else {
- Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
-
- IDPortaApplicativa idPortaApplicativa = new IDPortaApplicativa();
- idPortaApplicativa.setNome(nomePorta);
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPortaApplicativa);
- String idporta = myPA.getNome();
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- lstParamPorta = porteApplicativeHelper.getTitoloPA(parentPA, idSoggetto+"", idAsps+"");
-
- if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
- labelPerPorta = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_DI,
- ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI,
- myPA);
- }
- else {
- labelPerPorta = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_DI+idporta;
- }
-
- }
-
- if(nomeOggetto==null) {
- lstParamPorta.add(new Parameter(labelPerPorta,null));
- }
- else {
- List<Parameter> list = new ArrayList<>();
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue()));
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta));
- if(serviceBinding!=null) {
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING,serviceBinding.name()));
- }
- lstParamPorta.add(new Parameter(labelPerPorta, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST, list));
- lstParamPorta.add(new Parameter(nomeOggetto,null));
- }
- }
-
- return lstParamPorta;
- }
-
-
-
- public boolean allarmeCheckData(StringBuilder sbParsingError, TipoOperazione tipoOp, ConfigurazioneAllarmeBean oldAllarme, ConfigurazioneAllarmeBean allarme, int numeroPluginRegistrati
- , List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters) throws Exception {
-
- try {
-
- // errori di parsing letti durante la read della richiesta
- if(sbParsingError.length() >0){
- this.pd.setMessage(sbParsingError.toString());
- return false;
- }
-
- /* ******** CONTROLLO PLUGIN *************** */
-
- if(allarme.getPlugin()==null){
- if(numeroPluginRegistrati<=0){
- this.log.debug("Non risultano registrati plugins di allarmi");
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_FILTRO_PLUGIN_NON_TROVATI);
- }
- else{
- this.log.debug("Non è stato selezionato un plugin");
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN+"'");
- return false;
- }
- return false;
- }
-
- /* ******** ELEMENTI OBBLIGATORI *************** */
-
- if(allarme.getTipoAllarme()==null){
- this.log.debug("Non è stato indicato il tipo di allarme (è stato selezionato un plugin?)");
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_TIPO_NON_INDICATO);
- return false;
- }
-
- if(allarme.getNome()==null || "".equals(allarme.getNome())){
- this.log.debug("Non è stato indicato un nome identificativo dell'allarme");
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME+"'");
- return false;
- }
- if (!this.checkNCNameAndSerial(allarme.getNome(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME)) {
- return false;
- }
-
- if(allarme.getAlias()==null || "".equals(allarme.getAlias())){
- this.log.debug("Non è stato indicato un nome per l'allarme");
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS+"'");
- return false;
- }
- if (!this.checkNCName(allarme.getAlias(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS)) {
- return false;
- }
-
- if(allarme.getTipoAllarme().equals(TipoAllarme.ATTIVO)){
- if(allarme.getPeriodo()==null){
- this.log.debug("Non è stata indicata la frequenza di attivazione per il controllo dello stato dell'allarme");
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_FREQUENZA_NON_INDICATA);
- return false;
- }
- if(allarme.getPeriodo()<=0){
- this.log.debug("Indicare una frequenza di attivazione (maggiore di 0) per il controllo dello stato dell'allarme");
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_FREQUENZA_NON_VALIDA);
- return false;
- }
- }
-
- if(allarme.getFiltro().isEnabled()){
-
- if( (allarme.getFiltro().getRuoloPorta()==null || RuoloPorta.ENTRAMBI.equals(allarme.getFiltro().getRuoloPorta()))
- &&
- allarme.getFiltro().getProtocollo()==null &&
- allarme.getFiltro().getRuoloFruitore()==null &&
- allarme.getFiltro().getTipoFruitore()==null &&
- allarme.getFiltro().getNomeFruitore()==null &&
- allarme.getFiltro().getServizioApplicativoFruitore()==null &&
- allarme.getFiltro().getRuoloErogatore()==null &&
- allarme.getFiltro().getTipoErogatore()==null &&
- allarme.getFiltro().getNomeErogatore()==null &&
- allarme.getFiltro().getTag()==null &&
- allarme.getFiltro().getTipoServizio()==null &&
- allarme.getFiltro().getNomeServizio()==null &&
- allarme.getFiltro().getAzione()==null){
- String messaggio = "Se si abilita il filtro deve essere selezionato almeno un criterio";
- this.pd.setMessage(messaggio);
- return false;
- }
-
- }
-
- if(allarme.getGroupBy().isEnabled()){
-
- if( !allarme.getGroupBy().isRuoloPorta() &&
- !allarme.getGroupBy().getProtocollo() &&
- !allarme.getGroupBy().getFruitore() &&
- !allarme.getGroupBy().getServizioApplicativoFruitore() &&
- !allarme.getGroupBy().getIdentificativoAutenticato() &&
- (allarme.getGroupBy().getToken()==null || "".equals(allarme.getGroupBy().getToken())) &&
- !allarme.getGroupBy().getErogatore() &&
- !allarme.getGroupBy().getServizio() &&
- !allarme.getGroupBy().getAzione()){
- String messaggio = "Se si abilita il collezionamento dei dati deve essere selezionato almeno un criterio di raggruppamento";
- this.pd.setMessage(messaggio);
- return false;
- }
- }
-
- /* ******** VALIDAZIONE E SALVATAGGIO PARAMETRI *************** */
-
- IDynamicValidator v = DynamicFactory.getInstance().newDynamicValidator(TipoPlugin.ALLARME, allarme.getTipo(), allarme.getPlugin().getClassName(),this.log);
-
- Context context = this.createAlarmContext(allarme, parameters);
- try {
- // validazione parametri
- v.validate(context);
- } catch (ValidationException e) {
- StringBuilder sb = new StringBuilder();
-
- sb.append(e.getMessage());
- Map<String, String> errors = e.getErrors();
- if (errors != null) {
- Set<String> keys = errors.keySet();
-
- StringBuilder sbInner = new StringBuilder();
- for (String key : keys) {
- if(sbInner.length() >0) {
- sbInner.append("\n");
- }
- org.openspcoop2.monitor.sdk.parameters.Parameter<?> sp = context.getParameter(key);
- String errorMsg = errors.get(key);
- // recupero il label del parametro
- String label = sp != null ? sp.getRendering().getLabel() : key;
- sbInner.append(label).append(": ").append(errorMsg);
- }
-
- sb.append("\n").append(sbInner.toString());
- }
- this.pd.setMessage(sb.toString());
- return false;
- }
-
-
- /* ******** VALIDAZIONE NOTIFICA MAIL *************** */
-
- if(allarme.getMail()!=null && allarme.getMail().getInvia()!=null && allarme.getMail().getInvia()==1){
- if(allarme.getMail().getDestinatari()==null || "".equals(allarme.getMail().getDestinatari())){
- this.log.debug("Almeno un indirizzo e-mail è obbligatorio");
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_EMAIL_VUOTA);
- return false;
- }
- String [] tmp = allarme.getMail().getDestinatari().split(",");
- for (int i = 0; i < tmp.length; i++) {
- if(this.checkEmail(tmp[i].trim(), ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_EMAIL)==false){
- this.log.debug("L'indirizzo e-mail fornito ["+tmp[i].trim()+"] non risulta valido");
- return false;
- }
- }
- }
-
- boolean porta = allarme.getFiltro()!=null && allarme.getFiltro().isEnabled() && allarme.getFiltro().getRuoloPorta()!=null && allarme.getFiltro().getNomePorta()!=null;
-
-
- // Controllo alias
- boolean existsAlias = false;
- ConsoleSearch search = new ConsoleSearch(true);
- List<ConfigurazioneAllarmeBean> allarmiConAlias = this.confCore.allarmiList(search, porta ? allarme.getFiltro().getRuoloPorta(): null,
- porta ? allarme.getFiltro().getNomePorta() : null);
- if(allarmiConAlias!=null && !allarmiConAlias.isEmpty()) {
- for (ConfigurazioneAllarmeBean allarmeCheck : allarmiConAlias) {
- if(allarmeCheck.getAlias().equals(allarme.getAlias())) {
- if (tipoOp.equals(TipoOperazione.ADD)) {
- existsAlias = true;
- }
- else {
- if(allarmeCheck.getId().longValue() != allarme.getId().longValue()) {
- existsAlias = true;
- }
- }
- }
- }
- }
- if(existsAlias) {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_ALIAS_DUPLICATO);
- return false;
- }
-
- // Controllo nome (si può solo modificare in ADD)
- if(tipoOp.equals(TipoOperazione.ADD)) {
- boolean existsAllarme = this.confCore.existsAllarme(allarme.getNome());
- if (existsAllarme) {
-
- ConfigurazioneAllarmeBean existsAllarmeBean = this.confCore.getAllarme(allarme.getNome());
- if(existsAllarmeBean.getFiltro()!=null && existsAllarmeBean.getFiltro().isEnabled() &&
- existsAllarmeBean.getFiltro().getRuoloPorta()!=null &&
- StringUtils.isNotEmpty(existsAllarmeBean.getFiltro().getNomePorta())) {
- if(org.openspcoop2.core.allarmi.constants.RuoloPorta.APPLICATIVA.equals(existsAllarmeBean.getFiltro().getRuoloPorta())) {
- String descrPorta = null;
- try {
- IDPortaApplicativa idPA = new IDPortaApplicativa();
- idPA.setNome(existsAllarmeBean.getFiltro().getNomePorta());
-
- PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idPA);
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(pa);
-
- String suffixGruppo = "";
- if(!mappingPA.isDefault()) {
- suffixGruppo = " (Gruppo: "+mappingPA.getDescrizione()+")";
- }
- String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(pa.getTipoSoggettoProprietario());
- descrPorta="["+NamingUtils.getLabelProtocollo(protocollo)+"] "+
- NamingUtils.getLabelAccordoServizioParteSpecifica(protocollo, mappingPA.getIdServizio())+
- suffixGruppo;
- }catch(Exception e) {
- this.logError("Identificazione erogazione che possiede l'allarme '"+allarme.getNome()+"' non riuscita: "+e.getMessage(),e);
- descrPorta = existsAllarmeBean.getFiltro().getNomePorta();
- }
-
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_DUPLICATO_EXISTS_IN_EROGAZIONE, descrPorta));
- }
- else if(org.openspcoop2.core.allarmi.constants.RuoloPorta.DELEGATA.equals(existsAllarmeBean.getFiltro().getRuoloPorta())) {
- String descrPorta = null;
- try {
- IDPortaDelegata idPD = new IDPortaDelegata();
- idPD.setNome(existsAllarmeBean.getFiltro().getNomePorta());
-
- PortaDelegata pd = this.porteDelegateCore.getPortaDelegata(idPD);
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(pd);
-
- String suffixGruppo = "";
- if(!mappingPD.isDefault()) {
- suffixGruppo = " (Gruppo: "+mappingPD.getDescrizione()+")";
- }
- String protocollo = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(pd.getTipoSoggettoProprietario());
- descrPorta="["+NamingUtils.getLabelProtocollo(protocollo)+"] "+
- NamingUtils.getLabelAccordoServizioParteSpecifica(protocollo, mappingPD.getIdServizio())+
- " (Fruitore:"+NamingUtils.getLabelSoggetto(protocollo, new IDSoggetto(pd.getTipoSoggettoProprietario(), pd.getNomeSoggettoProprietario()))+")"+
- suffixGruppo;
- }catch(Exception e) {
- this.logError("Identificazione fruizione che possiede l'allarme '"+allarme.getNome()+"' non riuscita: "+e.getMessage(),e);
- descrPorta = existsAllarmeBean.getFiltro().getNomePorta();
- }
-
- this.pd.setMessage(MessageFormat.format(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_DUPLICATO_EXISTS_IN_FRUIZIONE, descrPorta));
- }
- else {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_DUPLICATO_EXISTS_IN_CONFIGURAZIONE_GENERALE);
- }
- }
- else {
- this.pd.setMessage(ConfigurazioneCostanti.MESSAGGIO_ERRORE_ALLARME_DUPLICATO_EXISTS_IN_CONFIGURAZIONE_GENERALE);
- }
- return false;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public Context createAlarmContext(ConfigurazioneAllarmeBean allarme, List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters) throws DAOFactoryException {
- Context context = new AlarmContext(allarme, this.log, DAOConsoleFactory.getInstance(this.log), parameters );
-
- return context;
- }
-
- public void sendToAllarmi(List<String> urls) throws Exception{
- if(urls!=null && urls.size()>0){
- for (String url : urls) {
- this.log.debug("Invoke ["+url+"] ...");
- HttpResponse response = HttpUtilities.getHTTPResponse(url);
- if(response.getContent()!=null){
- this.log.debug("Invoked ["+url+"] Status["+response.getResultHTTPOperation()+"] Message["+new String(response.getContent())+"]");
- }
- else{
- this.log.debug("Invoked ["+url+"] Status["+response.getResultHTTPOperation()+"]");
- }
- if(response.getResultHTTPOperation()>202){
- throw new DriverControlStationException("Error occurs during invoke url["+url+"] Status["+response.getResultHTTPOperation()+"] Message["+new String(response.getContent())+"]");
- }
- }
- }
- }
-
- public String readAllarmeFromRequest(TipoOperazione tipoOp, boolean first,
- ConfigurazioneAllarmeBean allarme, AlarmEngineConfig alarmEngineConfig, Plugin plugin, List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters ) throws Exception {
- StringBuilder sbParsingError = new StringBuilder();
-
- if(first) {
- // if(tipoOp.equals(TipoOperazione.ADD)) {
- // allarme.setEnabled(1);
- // allarme.setTipoAllarme(null);
- // allarme.setMail(new AllarmeMail());
- // allarme.getMail().setInviaAlert(0);
- // allarme.getMail().setInviaWarning(0);
- // if(alarmEngineConfig.isMailAckMode()){
- // allarme.getMail().setAckMode(1);
- // }else{
- // allarme.getMail().setAckMode(0);
- // }
- // allarme.setScript(new AllarmeScript());
- // allarme.getScript().setInvocaAlert(0);
- // allarme.getScript().setInvocaWarning(0);
- // if(alarmEngineConfig.isScriptAckMode()){
- // allarme.getScript().setAckMode(1);
- // }else{
- // allarme.getScript().setAckMode(0);
- // }
- // }
- } else {
- // ricostruisco lo stato a partire dai parametri
- String idAllarmeS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME);
- if(tipoOp.equals(TipoOperazione.ADD)) {
- allarme.setId(null);
- } else {
- allarme.setId(Long.parseLong(idAllarmeS));
- }
-
- String nome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME);
- allarme.setNome(nome);
-
- String alias = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS);
- allarme.setAlias(alias);
-
- String descrizione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_DESCRIZIONE);
- allarme.setDescrizione(descrizione);
-
- String tipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO);
- allarme.setTipo(tipo);
-
- String modalitaS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- TipoAllarme tipoAllarme = null;
- if(StringUtils.isNotBlank(modalitaS)) {
- tipoAllarme = TipoAllarme.toEnumConstant(modalitaS);
- }
- allarme.setTipoAllarme(tipoAllarme);
-
- // String descrizione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_DESCRIZIONE);
-
- if(allarme.getTipoAllarme() != null && (allarme.getTipoAllarme().equals(TipoAllarme.ATTIVO))) {
- String periodoS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PERIODO);
- String tipoPeriodoS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO);
-
- if(StringUtils.isNotBlank(periodoS)) {
- try {
- allarme.setPeriodo(Integer.parseInt(periodoS));
- }catch(Throwable t) {
- this.logError("Periodo indicato non è un intero ["+periodoS+"]: "+t.getMessage(),t);
- }
- }
-
- if(StringUtils.isNotBlank(tipoPeriodoS)) {
- if(ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO_MINUTI.equals(tipoPeriodoS)){
- allarme.setTipoPeriodo(AllarmiConverterUtils.toValue(TipoPeriodo.M));
- }
- else if(ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO_GIORNI.equals(tipoPeriodoS)){
- allarme.setTipoPeriodo(AllarmiConverterUtils.toValue(TipoPeriodo.G));
- }
- else{
- allarme.setTipoPeriodo(AllarmiConverterUtils.toValue(TipoPeriodo.H));
- }
- }
- }
-
- String abilitatoS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO);
- if(StringUtils.isNotBlank(abilitatoS)) {
- allarme.setEnabled(Integer.parseInt(abilitatoS));
- }
-
-
- // Sezione filtro/ groupby
- this.readDatiAllarmeFiltroFromHttpParameters(allarme, first);
-
- // sezione parametri
- if(plugin != null) {
- if(parameters != null&& parameters.size() > 0) {
- for (org.openspcoop2.monitor.sdk.parameters.Parameter<?> par : parameters) {
- String value = this.getParameter(par.getId());
- if(ParameterType.CHECK_BOX.equals(par.getType())){
- if(Costanti.CHECK_BOX_ENABLED.equals(value) || Costanti.CHECK_BOX_ENABLED_ABILITATO.equals(value) || Costanti.CHECK_BOX_ENABLED_TRUE.equals(value)) {
- value = Costanti.CHECK_BOX_ENABLED_TRUE;
- }
- else {
- value = Costanti.CHECK_BOX_DISABLED_FALSE;
- }
- }
- par.setValueAsString(value);
- //
- // boolean found = false;
- // for (AllarmeParametro parDB : allarme.getAllarmeParametroList()) {
- // if(parDB.getIdParametro().equals(par.getId())){
- // parDB.setValore(par.getValueAsString());
- // found = true;
- // break;
- // }
- // }
- // if(!found){
- // AllarmeParametro parDB = new AllarmeParametro();
- // parDB.setIdParametro(par.getId());
- // parDB.setValore(par.getValueAsString());
- // allarme.addAllarmeParametro(parDB);
- // }
- }
- }
- }
-
- // sezione mail
- String inviaEmailAlertS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_ALERT);
- if(StringUtils.isNotBlank(inviaEmailAlertS)) {
- allarme.getMail().setInvia(Integer.parseInt(inviaEmailAlertS));
- }
-
- if(allarme.getMail().getInvia() == 1) {
- String destinatariEmail = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_DESTINATARI_EMAIL);
- allarme.getMail().setDestinatari(destinatariEmail);
-
- // notifica warning
- String notificaWarningEmailS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING);
- if(StringUtils.isNotBlank(notificaWarningEmailS)) {
- allarme.getMail().setInviaWarning(Integer.parseInt(notificaWarningEmailS));
- }
-
- if(this.confCore.getAllarmiConfig().isMailShowAllOptions()) {
- // Subject
- String subject = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_SUBJECT);
- allarme.getMail().setSubject(subject);
-
- // Body
- String body = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_BODY);
- allarme.getMail().setBody(body);
- }
- }
-
- // sezione script
- String invocaScriptAlertS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVOCA_SCRIPT_ALERT);
- if(StringUtils.isNotBlank(invocaScriptAlertS)) {
- allarme.getScript().setInvoca(Integer.parseInt(invocaScriptAlertS));
- }
-
- if(allarme.getScript().getInvoca() == 1) {
- // notifica warning
- String notificaWarningScriptS = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING_SCRIPT);
- if(StringUtils.isNotBlank(notificaWarningScriptS)) {
- allarme.getScript().setInvocaWarning(Integer.parseInt(notificaWarningScriptS));
- }
-
- if(this.confCore.getAllarmiConfig().isScriptShowAllOptions()) {
- // Subject
- String path = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_PATH);
- allarme.getScript().setCommand(path);
-
- // Body
- String args = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_ARGUMENTS);
- allarme.getScript().setArgs(args);
- }
- }
- }
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
-
- return null;
- }
-
-
- public String readDatiAllarmeFiltroFromHttpParameters(ConfigurazioneAllarmeBean policy, boolean first) throws Exception {
-
- StringBuilder sbParsingError = new StringBuilder();
-
- // Filtro - stato
- String stato = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED);
- if(stato!=null && !"".equals(stato)){
- policy.getFiltro().setEnabled(ServletUtils.isCheckBoxEnabled(stato));
- }
-
- // Filtro
- if(policy.getFiltro().isEnabled()){
-
- // ruolo della PdD
- String ruoloPdD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD);
- if(ruoloPdD!=null && !"".equals(ruoloPdD)){
- try{
- policy.getFiltro().setRuoloPorta(RuoloPorta.toEnumConstant(ruoloPdD, true));
- }catch(Exception e){
- String messaggio = "Il valore ("+ruoloPdD+") indicato in '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD+"' non è tra i ruoli gestiti";
- this.logError(messaggio,e);
- this.addParsingError(sbParsingError,messaggio);
- }
- }
-
- // protocollo
- String protocollo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- if(protocollo!=null && !"".equals(protocollo) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(protocollo)){
- policy.getFiltro().setProtocollo(protocollo);
- }
- else{
- if(!first){
- policy.getFiltro().setProtocollo(null);
- }
- }
-
- // ruolo erogatore
- String ruoloErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE);
- if(ruoloErogatore!=null && !"".equals(ruoloErogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(ruoloErogatore) ){
- policy.getFiltro().setRuoloErogatore(ruoloErogatore);
- }
- else{
- if(!first){
- policy.getFiltro().setRuoloErogatore(null);
- }
- }
-
- // erogatore
- String erogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE);
- boolean erogatoreSelected = false;
- if(erogatore!=null && !"".equals(erogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(erogatore) && erogatore.contains("/") ){
- String [] tmp = erogatore.split("/");
- policy.getFiltro().setTipoErogatore(tmp[0]);
- policy.getFiltro().setNomeErogatore(tmp[1]);
- erogatoreSelected = true;
- }
- else{
- if(!first){
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- }
- }
-
- // servizio applicativo erogatore
- // String servizioApplicativoErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_EROGATORE);
- // if(servizioApplicativoErogatore!=null && !"".equals(servizioApplicativoErogatore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizioApplicativoErogatore) ){
- // policy.getFiltro().setServizioApplicativoErogatore(servizioApplicativoErogatore);
- // }
- // else{
- // if(!first){
- // policy.getFiltro().setServizioApplicativoErogatore(null);
- // }
- // }
-
- // tag
- String tag = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_TAG);
- if(tag!=null && !"".equals(tag) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(tag)){
- policy.getFiltro().setTag(tag);
- }
- else{
- if(!first){
- policy.getFiltro().setTag(null);
- }
- }
-
- // servizio
- String servizio = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO);
- if(servizio!=null && !"".equals(servizio) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizio) && servizio.contains("/") ){
- String [] tmp = servizio.split("/");
- policy.getFiltro().setTipoServizio(tmp[0]);
- policy.getFiltro().setNomeServizio(tmp[1]);
- policy.getFiltro().setVersioneServizio(Integer.parseInt(tmp[2]));
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()) {
- policy.getFiltro().setTipoErogatore(tmp[3]);
- policy.getFiltro().setNomeErogatore(tmp[4]);
- }
- }
- else{
- if(!first){
- policy.getFiltro().setTipoServizio(null);
- policy.getFiltro().setNomeServizio(null);
- policy.getFiltro().setVersioneServizio(null);
- if(this.core.isControlloTrafficoPolicyGlobaleFiltroApiSoggettoErogatore()&& !erogatoreSelected) {
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- }
- }
- }
-
- // azione
- String [] azione = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE);
- if(azione!=null && azione.length>0) {
- StringBuilder bf = new StringBuilder();
- for (String az : azione) {
- if(bf.length()>0) {
- bf.append(",");
- }
- bf.append(az);
- }
- policy.getFiltro().setAzione(bf.toString());
- }
- else{
- if(!first){
- policy.getFiltro().setAzione(null);
- }
- }
-
- // ruolo fruitore
- String ruoloFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE);
- if(ruoloFruitore!=null && !"".equals(ruoloFruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(ruoloFruitore) ){
- policy.getFiltro().setRuoloFruitore(ruoloFruitore);
- }
- else{
- if(!first){
- policy.getFiltro().setRuoloFruitore(null);
- }
- }
-
- // fruitore
- String fruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE);
- if(fruitore!=null && !"".equals(fruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(fruitore) && fruitore.contains("/") ){
- String [] tmp = fruitore.split("/");
- policy.getFiltro().setTipoFruitore(tmp[0]);
- policy.getFiltro().setNomeFruitore(tmp[1]);
- }
- else{
- if(!first){
- policy.getFiltro().setTipoFruitore(null);
- policy.getFiltro().setNomeFruitore(null);
- }
- }
-
- // servizio applicativo fruitore
- String servizioApplicativoFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE);
- if(servizioApplicativoFruitore!=null && !"".equals(servizioApplicativoFruitore) && !ConfigurazioneCostanti.VALUE_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI.equals(servizioApplicativoFruitore) ){
- policy.getFiltro().setServizioApplicativoFruitore(servizioApplicativoFruitore);
- }
- else{
- if(!first){
- policy.getFiltro().setServizioApplicativoFruitore(null);
- }
- }
-
- // per Chiave
- // String perChiave = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PER_CHIAVE_ENABLED);
- // if(first==false){
- // policy.getFiltro().setInformazioneApplicativaEnabled(ServletUtils.isCheckBoxEnabled(perChiave));
- // }
-
- // if(policy.getFiltro().isInformazioneApplicativaEnabled()){
- //
- // // Per Chiave - Tipo
- // String perChiaveTipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PER_CHIAVE_TIPO);
- // if(perChiaveTipo!=null && !"".equals(perChiaveTipo) ){
- // policy.getFiltro().setInformazioneApplicativaTipo(perChiaveTipo);
- // }
- // else{
- // if(!first){
- // policy.getFiltro().setInformazioneApplicativaTipo(ConfigurazioneCostanti.ALLARMI_FILTRO_PER_CHIAVE_TIPO_DEFAULT); // default
- // }
- // }
- //
- // // Per Chiave - Nome
- // String perChiaveNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PER_CHIAVE_NOME);
- // if(perChiaveNome!=null && !"".equals(perChiaveNome) ){
- // policy.getFiltro().setInformazioneApplicativaNome(perChiaveNome);
- // }
- // else{
- // if(!first){
- // policy.getFiltro().setInformazioneApplicativaNome(null);
- // }
- // }
- //
- // // Per Chiave - Valore
- // String perChiaveValore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PER_CHIAVE_VALORE);
- // if(perChiaveValore!=null && !"".equals(perChiaveValore) ){
- // policy.getFiltro().setInformazioneApplicativaValore(StringEscapeUtils.unescapeHtml(perChiaveValore)); // il valore viene "escaped" perchè può conteenere ""
- // }
- // else{
- // if(!first){
- // policy.getFiltro().setInformazioneApplicativaValore(null);
- // }
- // }
- //
- // }
- // else{
- // policy.getFiltro().setInformazioneApplicativaTipo(null);
- // policy.getFiltro().setInformazioneApplicativaNome(null);
- // policy.getFiltro().setInformazioneApplicativaValore(null);
- // }
- }
- else{
- policy.getFiltro().setRuoloPorta(RuoloPorta.ENTRAMBI);
- policy.getFiltro().setTipoFruitore(null);
- policy.getFiltro().setNomeFruitore(null);
- policy.getFiltro().setServizioApplicativoFruitore(null);
- policy.getFiltro().setTipoErogatore(null);
- policy.getFiltro().setNomeErogatore(null);
- // policy.getFiltro().setServizioApplicativoErogatore(null);
- policy.getFiltro().setTipoServizio(null);
- policy.getFiltro().setNomeServizio(null);
- policy.getFiltro().setAzione(null);
- // policy.getFiltro().setInformazioneApplicativaEnabled(false);
- // policy.getFiltro().setInformazioneApplicativaTipo(null);
- // policy.getFiltro().setInformazioneApplicativaNome(null);
- // policy.getFiltro().setInformazioneApplicativaValore(null);
- }
-
- // GroupBy - stato
- String statoGroupBy = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_ENABLED);
- if(statoGroupBy!=null && !"".equals(statoGroupBy)){
- policy.getGroupBy().setEnabled(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO.equals(statoGroupBy) ||
- ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO.equals(statoGroupBy));
- }
-
- // GroupBy
- if(policy.getGroupBy().isEnabled()){
-
- // ruolo della PdD
- String ruoloPdD = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RUOLO_PDD);
- if(first==false){
- policy.getGroupBy().setRuoloPorta(ServletUtils.isCheckBoxEnabled(ruoloPdD));
- }
-
- // protocollo
- String protocollo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PROTOCOLLO);
- if(first==false){
- policy.getGroupBy().setProtocollo(ServletUtils.isCheckBoxEnabled(protocollo));
- }
-
- // erogatore
- String erogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_EROGATORE);
- if(first==false){
- policy.getGroupBy().setErogatore(ServletUtils.isCheckBoxEnabled(erogatore));
- }
-
- // servizio applicativo erogatore
- // String servizioApplicativoErogatore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_EROGATORE);
- // if(first==false){
- // policy.getGroupBy().setServizioApplicativoErogatore(ServletUtils.isCheckBoxEnabled(servizioApplicativoErogatore));
- // }
-
- // servizio
- String servizio = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SERVIZIO);
- if(first==false){
- policy.getGroupBy().setServizio(ServletUtils.isCheckBoxEnabled(servizio));
- policy.getGroupBy().setErogatore(ServletUtils.isCheckBoxEnabled(servizio)); // imposto anche l'erogatore poiche' identifica API differenti
- }
-
- // azione
- String azione = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_AZIONE);
- if(first==false){
- policy.getGroupBy().setAzione(ServletUtils.isCheckBoxEnabled(azione));
- }
-
- // fruitore
- String fruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_FRUITORE);
- if(first==false){
- policy.getGroupBy().setFruitore(ServletUtils.isCheckBoxEnabled(fruitore));
- }
-
- // servizio applicativo fruitore
- String servizioApplicativoFruitore = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_FRUITORE);
- if(first==false){
- policy.getGroupBy().setServizioApplicativoFruitore(ServletUtils.isCheckBoxEnabled(servizioApplicativoFruitore));
- }
-
- // richiedente
- String richiedente = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RICHIEDENTE);
- if(first==false){
- policy.getGroupBy().setServizioApplicativoFruitore(ServletUtils.isCheckBoxEnabled(richiedente));
- policy.getGroupBy().setFruitore(ServletUtils.isCheckBoxEnabled(richiedente));
- policy.getGroupBy().setIdentificativoAutenticato(ServletUtils.isCheckBoxEnabled(richiedente));
- }
-
- // token
- String token = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN);
- if(first==false){
- if(ServletUtils.isCheckBoxEnabled(token)) {
- String [] tokenSelezionati = this.getParameterValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN_CLAIMS);
- if(tokenSelezionati!=null && tokenSelezionati.length>0) {
- StringBuilder bf = new StringBuilder();
- for (int i = 0; i < tokenSelezionati.length; i++) {
- TipoCredenzialeMittente tipo = TipoCredenzialeMittente.toEnumConstant(tokenSelezionati[i],true);
- if(TipoCredenzialeMittente.TOKEN_ISSUER.equals(tipo)) {
- continue;
- }
- else if(TipoCredenzialeMittente.TOKEN_SUBJECT.equals(tipo)) {
- if(!bf.toString().endsWith(",") && bf.length()>0) {
- bf.append(",");
- }
- bf.append(TipoCredenzialeMittente.TOKEN_ISSUER.name());
- if(i==0) {
- bf.append(",");
- }
- }
- if(i>0) {
- bf.append(",");
- }
- bf.append(tokenSelezionati[i]);
- }
- if(bf.length()>0) {
- policy.getGroupBy().setToken(bf.toString());
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- else {
- policy.getGroupBy().setToken(null);
- }
- }
- // per Chiave
- // String perChiave = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED);
- // if(first==false){
- // policy.getGroupBy().setInformazioneApplicativaEnabled(ServletUtils.isCheckBoxEnabled(perChiave));
- // }
- //
- // if(policy.getGroupBy().isInformazioneApplicativaEnabled()){
- //
- // // Per Chiave - Tipo
- // String perChiaveTipo = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_TIPO);
- // if(perChiaveTipo!=null && !"".equals(perChiaveTipo) ){
- // policy.getGroupBy().setInformazioneApplicativaTipo(perChiaveTipo);
- // }
- // else{
- // if(!first){
- // policy.getGroupBy().setInformazioneApplicativaTipo(ConfigurazioneCostanti.ALLARMI_GROUPBY_PER_CHIAVE_TIPO_DEFAULT); // default
- // }
- // }
- //
- // // Per Chiave - Nome
- // String perChiaveNome = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_NOME);
- // if(perChiaveNome!=null && !"".equals(perChiaveNome) ){
- // policy.getGroupBy().setInformazioneApplicativaNome(perChiaveNome);
- // }
- // else{
- // if(!first){
- // policy.getGroupBy().setInformazioneApplicativaNome(null);
- // }
- // }
- //
- //
- // }
- // else{
- // policy.getGroupBy().setInformazioneApplicativaTipo(null);
- // policy.getGroupBy().setInformazioneApplicativaNome(null);
- // }
- }
- else{
- policy.getGroupBy().setRuoloPorta(false);
- policy.getGroupBy().setFruitore(false);
- policy.getGroupBy().setServizioApplicativoFruitore(false);
- policy.getGroupBy().setIdentificativoAutenticato(false);
- policy.getGroupBy().setToken(null);
- policy.getGroupBy().setErogatore(false);
- // policy.getGroupBy().setServizioApplicativoErogatore(false);
- policy.getGroupBy().setServizio(false);
- policy.getGroupBy().setAzione(false);
- // policy.getGroupBy().setInformazioneApplicativaEnabled(false);
- // policy.getGroupBy().setInformazioneApplicativaTipo(null);
- // policy.getGroupBy().setInformazioneApplicativaNome(null);
- }
-
-
- if(sbParsingError.length() > 0){
- return sbParsingError.toString();
- }
- return null;
- }
-
- public void addAllarmeToDati(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazioneAllarmeBean allarme, AlarmEngineConfig alarmEngineConfig, List<Plugin> listaPlugin,
- List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters, RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding
- ) throws Exception {
-
- String stateParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE);
- boolean state = stateParam!=null && "true".equals(stateParam);
-
- if(TipoOperazione.CHANGE.equals(tipoOperazione)){
-
- // Runtime
- if(!state) {
- boolean isActive = allarme.getEnabled() == 1 && TipoAllarme.ATTIVO.equals(allarme.getTipoAllarme());
- if(isActive){
- List<Parameter> lstParamSession = new ArrayList<>();
-
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
- lstParamSession.add(parRuoloPorta);
- }
- Parameter parNomePorta = null;
- if(nomePorta!=null) {
- parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
- lstParamSession.add(parNomePorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
- lstParamSession.add(parServiceBinding);
- }
-
- Parameter pState = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE, true+"");
-
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- List<Parameter> lstParamEntry = new ArrayList<>();
- lstParamEntry.add(pId);
- if(lstParamSession.size() > 0) {
- lstParamEntry.addAll(lstParamSession);
- }
-
- List<Parameter> lstParamEntryState = new ArrayList<>();
- lstParamEntryState.addAll(lstParamEntry);
- lstParamEntryState.add(pState);
-
- this.pd.addComandoVisualizzaRuntimeElementoButton(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryState);
-
- }
- }
-
- }
-
- boolean allarmeAttivo = allarme.getTipoAllarme() != null && (allarme.getTipoAllarme().equals(TipoAllarme.ATTIVO));
-
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
- DataElement de;
-
- Parameter pIdAllarme = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId()+"");
- // id
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME);
- de.setType(DataElementType.HIDDEN);
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- de.setValue("");
- } else {
- de.setValue(allarme.getId()+"");
- }
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA);
- de.setValue(ruoloPorta!=null ? ruoloPorta.getValue() : null);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA);
- de.setValue(nomePorta);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(serviceBinding!=null) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING);
- de.setValue(serviceBinding.name());
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(state) {
-
- String refreshParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_REFRESH);
- boolean refresh = refreshParam!=null && "true".equals(refreshParam);
-
- String stopParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_STOP);
- boolean stop = stopParam!=null && "true".equals(stopParam);
-
- String startParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_START);
- boolean start = startParam!=null && "true".equals(startParam);
-
- String restartParam = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_RESTART);
- boolean restart = restartParam!=null && "true".equals(restartParam);
-
- if(refresh || stop || start || restart) {
- try {
- String label = "";
- if(refresh) {
- AllarmiUtils.refreshActiveThreadState(allarme, this.log, alarmEngineConfig);
- label = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_AGGIORNA_STATO_REFRESH;
- }
- else if(stop) {
- AllarmiUtils.stopActiveThread(allarme, this.log, alarmEngineConfig);
- label = "Stop allarme";
- }
- else if(start) {
- AllarmiUtils.startActiveThread(allarme, this.log, alarmEngineConfig);
- label = "Start allarme";
- }
- else if(restart) {
- AllarmiUtils.restartActiveThread(allarme, this.log, alarmEngineConfig);
- label = "Restart allarme";
- }
-
- // Dormo qualche secondo per dare il tempo di fare il recheck o stop/start dell'allarme
- Utilities.sleep(3000);
-
- if(refresh) {
- this.pd.setMessage(label+" avviato con successo", MessageType.INFO);
- }
- else {
- this.pd.setMessage(label+" effettuato con successo", MessageType.INFO);
- }
-
- } catch(Exception e) {
- String errorMsg = "Richiesta di aggiornamento dello stato dell'allarme '"+allarme.getAlias()+"' fallita: "+e.getMessage();
- ControlStationCore.getLog().error(errorMsg, e);
- this.pd.setMessage(errorMsg, MessageType.ERROR);
- }
- }
-
-
-
- List<Parameter> lstParamEntry = new ArrayList<>();
- if(ruoloPorta!=null) {
- Parameter parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
- lstParamEntry.add(parRuoloPorta);
- }
- if(nomePorta!=null) {
- Parameter parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
- lstParamEntry.add(parNomePorta);
- }
- if(serviceBinding!=null) {
- Parameter parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
- lstParamEntry.add(parServiceBinding);
- }
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- lstParamEntry.add(pId);
- Parameter pState = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE, true+"");
- lstParamEntry.add(pState);
-
- boolean existsActiveThread = false;
- try {
- existsActiveThread = AllarmiUtils.existsActiveThread(allarme, this.log, alarmEngineConfig);
- } catch(Exception e) {
- String errorMsg = "Lettura stato del thread dell'allarme '"+allarme.getAlias()+"' fallita: "+e.getMessage();
- ControlStationCore.getLog().error(errorMsg, e);
- }
-
-
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_INFORMAZIONI_RUNTIME);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- // Link refresh
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_VISUALIZZA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_VISUALIZZA_STATO_REFRESH);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_VISUALIZZA_STATO_REFRESH);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- de.setType(DataElementType.LINK);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE);
- de.setLabelAffiancata(false);
- de.setType(DataElementType.TEXT_AREA_NO_EDIT);
- de.setRows(20);
- de.setCols(100);
- String result = null;
- try {
- if(existsActiveThread) {
- result = AllarmiUtils.getActiveThreadImage(allarme, this.log, alarmEngineConfig);
- }
- else {
- result = "Il thread di gestione dell'allarme non è attivo";
- }
- } catch(Exception e) {
- String errorMsg = "Lettura stato dell'allarme '"+allarme.getAlias()+"' fallita: "+e.getMessage();
- ControlStationCore.getLog().error(errorMsg, e);
- result = errorMsg;
- }
- de.setValue(result);
- dati.add(de);
-
-
- de = new DataElement();
- de.setType(DataElementType.SUBTITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GESTIONE_THREAD);
- dati.add(de);
-
- // Link ricalcola stato
-
- if(existsActiveThread) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_AGGIORNA_STATO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_AGGIORNA_STATO_REFRESH);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_AGGIORNA_STATO_REFRESH);
- List<Parameter> lstParamEntryRecheck = new ArrayList<>();
- lstParamEntryRecheck.addAll(lstParamEntry);
- Parameter pRecheck = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_REFRESH, true+"");
- lstParamEntryRecheck.add(pRecheck);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryRecheck.toArray(new Parameter[lstParamEntryRecheck.size()]));
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- // Link restart
-
- if(existsActiveThread) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RESTART_ALLARME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_RESTART_ALLARME);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_RESTART_ALLARME);
- List<Parameter> lstParamEntryRestart = new ArrayList<>();
- lstParamEntryRestart.addAll(lstParamEntry);
- Parameter pRestart = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_RESTART, true+"");
- lstParamEntryRestart.add(pRestart);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryRestart.toArray(new Parameter[lstParamEntryRestart.size()]));
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- // Link stop
-
- if(existsActiveThread) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STOP_ALLARME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STOP_ALLARME);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STOP_ALLARME);
- List<Parameter> lstParamEntryStop = new ArrayList<>();
- lstParamEntryStop.addAll(lstParamEntry);
- Parameter pStop = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_STOP, true+"");
- lstParamEntryStop.add(pStop);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryStop.toArray(new Parameter[lstParamEntryStop.size()]));
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
- // Link start
-
- if(!existsActiveThread) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_START_ALLARME);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_START_ALLARME);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_START_ALLARME);
- List<Parameter> lstParamEntryStart = new ArrayList<>();
- lstParamEntryStart.addAll(lstParamEntry);
- Parameter pStart = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_OP_START, true+"");
- lstParamEntryStart.add(pStart);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntryStart.toArray(new Parameter[lstParamEntryStart.size()]));
- de.setType(DataElementType.LINK);
- dati.add(de);
- }
-
-
- this.pd.disableEditMode();
-
- return;
- }
-
- // Informazioni Generali
- de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_INFORMAZIONI_GENERALI);
- dati.add(de);
-
- // plugin select
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- de.setType(DataElementType.SELECT);
- List<String> pluginValues = new ArrayList<>();
- List<String> pluginLabels = new ArrayList<>();
-
- for (Plugin pluginBean : listaPlugin) {
- String key = pluginBean.getLabel() + ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN_NOME_SEP + pluginBean.getClassName();
-
- pluginValues.add(key);
- pluginLabels.add(pluginBean.getLabel());
- }
-
- pluginValues.add(0, ConfigurazioneCostanti.DEFAULT_VALUE_NESSUNO);
- pluginLabels.add(0, ConfigurazioneCostanti.LABEL_DEFAULT_VALUE_NESSUNO);
-
- de.setValues(pluginValues);
- de.setLabels(pluginLabels);
- if(first) {
- de.setSelected(ConfigurazioneCostanti.DEFAULT_VALUE_NESSUNO);
- } else {
- if(allarme.getPlugin() != null)
- de.setSelected(allarme.getPlugin().getLabel() + ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PLUGIN_NOME_SEP + allarme.getPlugin().getClassName());
- }
-
- de.setPostBack_viaPOST(true);
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT);
- de.setValue(allarme.getPlugin().getLabel());
- }
- dati.add(de);
-
- // tipo
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO);
- de.setValue(allarme.getTipo() != null ? allarme.getTipo() : "");
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- // nome
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first || allarme.getPlugin() == null) {
- de.setType(DataElementType.HIDDEN);
- de.setValue("");
- } else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(allarme.getNome());
- }
- de.setRequired(true);
- }
- else{
- if(!this.isModalitaStandard() && this.confCore.isShowAllarmiIdentificativoRuntime()) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getNome());
- }
- dati.add(de);
-
- // alias
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ALIAS);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first || allarme.getPlugin() == null) {
- de.setType(DataElementType.HIDDEN);
- de.setValue("");
- } else {
- de.setType(DataElementType.TEXT_EDIT);
- de.setValue(allarme.getAlias());
- }
- de.setRequired(true);
- }
- else{
- de.setType(DataElementType.TEXT_EDIT);
- de.setValue(allarme.getAlias());
- }
- dati.add(de);
-
- // abilitato
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO);
-
- de.setType(DataElementType.SELECT);
- String [] abilitatoValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- String [] abilitatoLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
-
- de.setValues(abilitatoValues);
- de.setLabels(abilitatoLabels);
-
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first || allarme.getPlugin() == null) {
- de.setType(DataElementType.HIDDEN);
- de.setValue(ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO_SI);
- } else {
- de.setSelected(allarme.getEnabled()+"");
- }
- }else{
- de.setSelected(allarme.getEnabled()+"");
- }
- dati.add(de);
-
- // descrizione
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DESCRIZIONE);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_DESCRIZIONE);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first || allarme.getPlugin() == null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(2);
- }
- }
- else {
- de.setType(DataElementType.TEXT_AREA);
- de.setRows(2);
- }
- de.setValue(allarme.getDescrizione());
- dati.add(de);
-
- // frequenza
- if(allarmeAttivo) {
- de = new DataElement();
- de.setType(DataElementType.SUBTITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_INFORMAZIONI_GENERALI_FREQUENZA);
- dati.add(de);
- }
-
- // modalita
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- de.setValue(allarme.getTipoAllarme() != null ? allarme.getTipoAllarme().getValue() : "");
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_LABEL);
- if(allarme.getTipoAllarme() != null &&
- (allarme.getTipoAllarme().equals(TipoAllarme.ATTIVO) || allarme.getTipoAllarme().equals(TipoAllarme.PASSIVO))) {
- de.setType(DataElementType.TEXT);
- de.setValue(allarme.getTipoAllarme().equals(TipoAllarme.ATTIVO) ? ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_ATTIVA : ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_MODALITA_PASSIVA );
- } else {
- de.setType(DataElementType.HIDDEN);
- de.setValue("");
- }
- dati.add(de);
-
- // frequenza
- if(allarmeAttivo) {
-
- // number periodo
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_PERIODO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_PERIODO);
- de.setType(DataElementType.NUMBER);
- de.setRequired(true);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first) {
- de.setValue("");
- } else {
- de.setValue(allarme.getPeriodo()+"");
- }
- }else{
- de.setValue(allarme.getPeriodo()+"");
- }
- dati.add(de);
-
- // select tipo periodo
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO);
- de.setType(DataElementType.SELECT);
- String [] tipoPeriodoValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO;
- String [] tipoPeriodoLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO;
-
- de.setRequired(true);
- de.setValues(tipoPeriodoValues);
- de.setLabels(tipoPeriodoLabels);
- if(tipoOperazione.equals(TipoOperazione.ADD)){
- if(first || allarme.getTipoPeriodo()==null || StringUtils.isEmpty(allarme.getTipoPeriodo())) {
- de.setSelected(ConfigurazioneCostanti.VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_TIPO_PERIODO_ORE);
- } else {
- de.setSelected(allarme.getTipoPeriodo());
- }
- }else{
- de.setSelected(allarme.getTipoPeriodo());
- }
- dati.add(de);
-
- }
-
- // field da visualizzare in modifica
- if(tipoOperazione.equals(TipoOperazione.CHANGE) && this.confCore.isShowAllarmiFormStatoAllarme()) {
-
- de = new DataElement();
- de.setType(DataElementType.SUBTITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_STATO_ALLARME);
- dati.add(de);
-
- // stato
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATO);
- de.setType(DataElementType.TEXT);
- if(allarme.getEnabled() == 1) { // allarme abilitato
- de.setValue(ConfigurazioneCostanti.getLabelStato(AllarmiConverterUtils.toStatoAllarme(allarme.getStato())));
- }
-
- if(allarme.getEnabled() == 0) { // allarme disabilitato
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
- dati.add(de);
-
- // Acknowledge
- if(this.confCore.getAllarmiConfig().isOptionsAcknowledgedStatusAssociation() ||
- ( allarme.getMail().getInvia() == 1 && this.confCore.getAllarmiConfig().isMailCheckAcknowledgedStatus()) ||
- ( allarme.getScript().getInvoca() == 1 && this.confCore.getAllarmiConfig().isScriptCheckAcknowledgedStatus()) ) {
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGED);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGED);
- if(allarme.getEnabled() == 1 &&
- (
- allarme.getStato().intValue() == org.openspcoop2.core.allarmi.utils.AllarmiConverterUtils.toIntegerValue(StatoAllarme.WARNING)
- ||
- allarme.getStato().intValue() == org.openspcoop2.core.allarmi.utils.AllarmiConverterUtils.toIntegerValue(StatoAllarme.ERROR)
- )
- ) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- if(allarme.getAcknowledged() == 1) {
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_SI);
- }
-
- if(allarme.getAcknowledged() == 0) {
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_NO);
- }
- dati.add(de);
- }
-
- // Archivio Stati
- if(this.confCore.isShowAllarmiFormStatoAllarmeHistory() && this.confCore.getAllarmiConfig().isHistoryEnabled()) {
- de = new DataElement();
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ARCHIVIO_STATI);
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_HISTORY_LIST, pIdAllarme);
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ARCHIVIO_STATI);
- dati.add(de);
- }
- }
-
- if(tipoOperazione.equals(TipoOperazione.CHANGE) && allarmeAttivo) {
-
- de = new DataElement();
- de.setType(DataElementType.SUBTITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUNTIME);
- dati.add(de);
-
- List<Parameter> lstParamEntry = new ArrayList<>();
- if(ruoloPorta!=null) {
- Parameter parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
- lstParamEntry.add(parRuoloPorta);
- }
- if(nomePorta!=null) {
- Parameter parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
- lstParamEntry.add(parNomePorta);
- }
- if(serviceBinding!=null) {
- Parameter parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
- lstParamEntry.add(parServiceBinding);
- }
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- lstParamEntry.add(pId);
- Parameter pState = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_STATE, true+"");
- lstParamEntry.add(pState);
-
- de = new DataElement();
- de.setType(DataElementType.LINK);
- de.setUrl(ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_VISUALIZZA_STATO_EDIT);
- dati.add(de);
-
- }
-
-
- boolean delegata = false;
- boolean applicativa = false;
- @SuppressWarnings("unused")
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPorta.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- boolean multitenant = this.confCore.isMultitenant();
-
- boolean tokenAbilitato = true;
-
- PddTipologia pddTipologiaSoggettoAutenticati = null;
- boolean gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore = false;
- PortaDelegata portaDelegata = null;
- PortaApplicativa portaApplicativa = null;
- CredenzialeTipo tipoAutenticazione = null;
- Boolean appId = null;
- String tokenPolicy = null;
- IDSoggetto idSoggettoProprietario = null;
- if(ruoloPorta!=null) {
- if(applicativa) {
-
- if(multitenant && this.confCore.getMultitenantSoggettiErogazioni()!=null) {
- switch (this.confCore.getMultitenantSoggettiErogazioni()) {
- case SOLO_SOGGETTI_ESTERNI:
- pddTipologiaSoggettoAutenticati = PddTipologia.ESTERNO;
- break;
- case ESCLUDI_SOGGETTO_EROGATORE:
- gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore = true;
- break;
- case TUTTI:
- break;
- }
- }
-
- IDPortaApplicativa idPA = new IDPortaApplicativa();
- idPA.setNome(nomePorta);
- portaApplicativa = this.porteApplicativeCore.getPortaApplicativa(idPA);
- tipoAutenticazione = CredenzialeTipo.toEnumConstant(portaApplicativa.getAutenticazione());
- if(CredenzialeTipo.APIKEY.equals(tipoAutenticazione)) {
- ApiKeyState apiKeyState = new ApiKeyState(this.porteApplicativeCore.getParametroAutenticazione(portaApplicativa.getAutenticazione(), portaApplicativa.getProprietaAutenticazioneList()));
- appId = apiKeyState.appIdSelected;
- }
- if(portaApplicativa.getGestioneToken()!=null && portaApplicativa.getGestioneToken().getPolicy()!=null) {
- tokenPolicy = portaApplicativa.getGestioneToken().getPolicy();
- }
- idSoggettoProprietario = new IDSoggetto(portaApplicativa.getTipoSoggettoProprietario(), portaApplicativa.getNomeSoggettoProprietario());
-
- if(portaApplicativa.getGestioneToken()!=null) {
- String gestioneTokenPolicy = portaApplicativa.getGestioneToken().getPolicy();
- if( gestioneTokenPolicy == null ||
- gestioneTokenPolicy.equals("") ||
- gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
- tokenAbilitato = false;
- }
- }
- else {
- tokenAbilitato = false;
- }
- }
- if(delegata) {
- IDPortaDelegata idPD = new IDPortaDelegata();
- idPD.setNome(nomePorta);
- portaDelegata = this.porteDelegateCore.getPortaDelegata(idPD);
- tipoAutenticazione = CredenzialeTipo.toEnumConstant(portaDelegata.getAutenticazione());
- if(CredenzialeTipo.APIKEY.equals(tipoAutenticazione)) {
- ApiKeyState apiKeyState = new ApiKeyState(this.porteDelegateCore.getParametroAutenticazione(portaDelegata.getAutenticazione(), portaDelegata.getProprietaAutenticazioneList()));
- appId = apiKeyState.appIdSelected;
- }
- if(portaDelegata.getGestioneToken()!=null && portaDelegata.getGestioneToken().getPolicy()!=null) {
- tokenPolicy = portaDelegata.getGestioneToken().getPolicy();
- }
- idSoggettoProprietario = new IDSoggetto(portaDelegata.getTipoSoggettoProprietario(), portaDelegata.getNomeSoggettoProprietario());
-
- if(portaDelegata.getGestioneToken()!=null) {
- String gestioneTokenPolicy = portaDelegata.getGestioneToken().getPolicy();
- if( gestioneTokenPolicy == null ||
- gestioneTokenPolicy.equals("") ||
- gestioneTokenPolicy.equals(CostantiControlStation.DEFAULT_VALUE_NON_SELEZIONATO)) {
- tokenAbilitato = false;
- }
- }
- else {
- tokenAbilitato = false;
- }
- }
- }
- Context context = this.createAlarmContext(allarme, parameters);
- boolean groupByAllarme = this.isShowGroupBy(allarme, context);
-
- if( (parameters != null && parameters.size() > 0) || groupByAllarme) {
- de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(getParameterSectionTitle(allarme, groupByAllarme));
- dati.add(de);
- }
-
- // sezione dinamica parametri
- if(parameters != null && parameters.size() > 0) {
-
- for (org.openspcoop2.monitor.sdk.parameters.Parameter<?> parameter : parameters) {
- BaseComponent<?> component = (BaseComponent<?>) parameter;
-
- component.updateRendering();
-
- String postBack = this.getPostBackElementName();
- if(StringUtils.isNotEmpty(postBack)) {
- if(postBack.equals(parameter.getId())) {
- component.valueSelectedListener();
- }
- }
-
- if(component.getRendered()) { // nella versione originale non sono consentiti gli hidden
- dati.add(component.toDataElement());
- }
- else {
- Hidden<?> hidden = new Hidden<>(parameter, component.getLoader());
- dati.add(hidden.toDataElement());
- }
-
- }
- }
-
- // sezione group by
- if(groupByAllarme) {
- this.addToDatiAllarmeGroupBy(dati, tipoOperazione, allarme, context,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_RAGGRUPPAMENTO,
- ruoloPorta, nomePorta, serviceBinding, tokenAbilitato);
- }
-
- // Sezione filtro
- if(this.isShowFilter(allarme, context)) {
- this.addToDatiAllarmeFiltro(dati, tipoOperazione, allarme, context,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO,
- ruoloPorta, nomePorta, serviceBinding, idSoggettoProprietario, tokenAbilitato ,
- tipoAutenticazione, appId, tokenPolicy,
- pddTipologiaSoggettoAutenticati, gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore);
- }
-
- // Notifiche Email
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_NOTIFICA_EMAIL);
- dati.add(de);
- }
-
- // abilitato inviaEmailAlert
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_ALERT_ABILITATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_ALERT);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.SELECT);
- String [] inviaEmailAlertValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- String [] inviaEmailAlertLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- de.setValues(inviaEmailAlertValues);
- de.setLabels(inviaEmailAlertLabels);
- de.setSelected(allarme.getMail().getInvia()+"");
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(allarme.getMail().getInvia()+"");
- }
- dati.add(de);
-
- if(allarme.getMail().getInvia() == 1) {
- // destinatari
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DESTINATARI_EMAIL);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_DESTINATARI_EMAIL);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.TEXT_EDIT);
- de.setNote(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DESTINATARI_EMAIL_NOTE);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getMail().getDestinatari());
- dati.add(de);
-
- // notifica warning
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.SELECT);
- String [] notificaWarningValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- String [] notificaWarinigLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- de.setValues(notificaWarningValues);
- de.setLabels(notificaWarinigLabels);
- de.setSelected(allarme.getMail().getInviaWarning()+"");
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(allarme.getMail().getInviaWarning()+"");
- }
- dati.add(de);
-
- if(this.confCore.getAllarmiConfig().isMailShowAllOptions()) {
- // Subject
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_SUBJECT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_SUBJECT);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.TEXT_EDIT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getMail().getSubject());
- dati.add(de);
-
- // Body
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_BODY);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVIA_EMAIL_BODY);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.TEXT_AREA);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getMail().getBody());
- dati.add(de);
- }
- }
-
-
- // Notifiche monitoraggio esterno
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_NOTIFICA_MONITORAGGIO_ESTERNO);
- dati.add(de);
- }
-
- // abilitato invocaScriptAlert
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_INVOCA_SCRIPT_ALERT_ABILITATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_INVOCA_SCRIPT_ALERT);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.SELECT);
- String [] invocaScriptAlertValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- String [] invocaScriptAlertLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- de.setValues(invocaScriptAlertValues);
- de.setLabels(invocaScriptAlertLabels);
- de.setSelected(allarme.getScript().getInvoca()+"");
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(allarme.getScript().getInvoca()+"");
- }
- dati.add(de);
-
- if(allarme.getScript().getInvoca() == 1) {
- // notifica warning
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING_SCRIPT);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_WARNING_SCRIPT);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.SELECT);
- String [] notificaWarningValues = ConfigurazioneCostanti.VALUES_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- String [] notificaWarinigLabels = ConfigurazioneCostanti.LABELS_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO;
- de.setValues(notificaWarningValues);
- de.setLabels(notificaWarinigLabels);
- de.setSelected(allarme.getScript().getInvocaWarning()+"");
- }
- else {
- de.setType(DataElementType.HIDDEN);
- de.setValue(allarme.getScript().getInvocaWarning()+"");
- }
- dati.add(de);
-
- if(this.confCore.getAllarmiConfig().isScriptShowAllOptions()) {
-
- // Subject
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_PATH);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_PATH);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.TEXT_EDIT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getScript().getCommand());
- dati.add(de);
-
- // Body
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_ARGUMENTS);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOTIFICA_SCRIPT_ARGUMENTS);
- if(tipoOperazione.equals(TipoOperazione.CHANGE) || (!first && allarme.getPlugin() != null) ){
- de.setType(DataElementType.TEXT_EDIT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getScript().getArgs());
- dati.add(de);
- }
- }
-
- }
-
- public boolean isShowFilter(ConfigurazioneAllarmeBean allarme, Context context) throws Exception {
- if(allarme==null || allarme.getPlugin() == null){
- return false; // all'inizio deve prima essere scelto il plugin
- }
-
- return this.confCore.isUsableFilter(allarme, context);
- }
-
- public FiltersConfiguration getFiltersConfiguration(ConfigurazioneAllarmeBean allarme, Context context) throws Exception {
- if(allarme==null || allarme.getPlugin() == null){
- return null;
- }
- return this.confCore.getFiltersConfiguration(allarme, context);
- }
-
-
- public boolean isShowGroupBy(ConfigurazioneAllarmeBean allarme, Context context) throws Exception {
- if(allarme==null || allarme.getPlugin() == null){
- return false; // all'inizio deve prima essere scelto il plugin
- }
-
- return this.confCore.isUsableGroupBy(allarme, context);
- }
-
- public GroupByConfiguration getGroupByConfiguration(ConfigurazioneAllarmeBean allarme, Context context) throws Exception {
- if(allarme==null || allarme.getPlugin() == null){
- return null;
- }
- return this.confCore.getGroupByConfiguration(allarme, context);
- }
-
- public String getParameterSectionTitle(ConfigurazioneAllarmeBean allarme, boolean groupByAllarme) throws Exception {
- if(allarme==null || allarme.getPlugin() == null){
- return ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_PARAMETRI; // all'inizio deve prima essere scelto il plugin
- }
- return this.confCore.getParameterSectionTitle(allarme, groupByAllarme);
- }
-
- private void addToDatiAllarmeFiltro(List<DataElement> dati, TipoOperazione tipoOperazione, ConfigurazioneAllarmeBean allarme, Context context, String nomeSezione,
- RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding,
- IDSoggetto idSoggettoProprietario, boolean tokenAbilitato,
- CredenzialeTipo tipoAutenticazione, Boolean appId, String tokenPolicy,
- PddTipologia pddTipologiaSoggettoAutenticati, boolean gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPorta.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- org.openspcoop2.core.config.constants.CredenzialeTipo tipoAutenticazioneConfig = null;
- if(tipoAutenticazione!=null) {
- tipoAutenticazioneConfig = org.openspcoop2.core.config.constants.CredenzialeTipo.toEnumConstant(tipoAutenticazione.getValue(), true);
- }
-
- boolean tokenPolicyOR = false;
- if(tokenPolicy!=null && !"".equals(tokenPolicy)) {
- if(tipoAutenticazione!=null && !org.openspcoop2.core.config.constants.CredenzialeTipo.TOKEN.equals(tipoAutenticazioneConfig)) {
- tokenPolicyOR = true;
- }
- else {
- tipoAutenticazioneConfig = org.openspcoop2.core.config.constants.CredenzialeTipo.TOKEN;
- }
- }
-
- boolean multitenant = this.confCore.isMultitenant();
-
- FiltersConfiguration filterConfig = this.confCore.getFiltersConfiguration(allarme, context);
-
- // Ruolo Gateway
- RuoloPorta ruoloPortaFiltro = null;
- if(allarme!=null && allarme.getFiltro()!=null) {
- ruoloPortaFiltro = allarme.getFiltro().getRuoloPorta();
- }
- if(configurazione && filterConfig!=null && !filterConfig.isHideGatewayRole() &&
- (filterConfig.isForceInGatewayRole() || filterConfig.isForceOutGatewayRole())) {
- if(filterConfig.isForceInGatewayRole()) {
- ruoloPortaFiltro = RuoloPorta.APPLICATIVA;
- }
- else if(filterConfig.isForceOutGatewayRole()) {
- ruoloPortaFiltro = RuoloPorta.DELEGATA;
- }
- }
-
- // Elaboro valori con dipendenze
-
- List<String> protocolliLabel = null;
- List<String> protocolliValue = null;
- String protocolloSelezionatoLabel = null;
- String protocolloSelezionatoValue = null;
-
- List<String> ruoliErogatoreLabel = null;
- List<String> ruoliErogatoreValue = null;
- String ruoloErogatoreSelezionatoLabel = null;
- String ruoloErogatoreSelezionatoValue = null;
-
- List<String> erogatoriLabel = null;
- List<String> erogatoriValue = null;
- String datiIdentificativiErogatoreSelezionatoLabel = null;
- String datiIdentificativiErogatoreSelezionatoValue = null;
-
- List<String> tagLabel = null;
- List<String> tagValue = null;
- @SuppressWarnings("unused")
- String datiIdentificativiTagSelezionatoLabel = null;
- String datiIdentificativiTagSelezionatoValue = null;
-
- List<String> serviziLabel = null;
- List<String> serviziValue = null;
- String datiIdentificativiServizioSelezionatoLabel = null;
- String datiIdentificativiServizioSelezionatoValue = null;
-
- List<String> azioniLabel = null;
- List<String> azioniValue = null;
- List<String> azioniSelezionataLabel = null;
- List<String> azioniSelezionataValue = null;
-
- // List<String> serviziApplicativiErogatoreLabel = null;
- // List<String> serviziApplicativiErogatoreValue = null;
- // String servizioApplicativoErogatoreSelezionatoLabel = null;
- // String servizioApplicativoErogatoreSelezionatoValue = null;
-
- List<String> ruoliFruitoreLabel = null;
- List<String> ruoliFruitoreValue = null;
- String ruoloFruitoreSelezionatoLabel = null;
- String ruoloFruitoreSelezionatoValue = null;
-
- List<String> fruitoriLabel = null;
- List<String> fruitoriValue = null;
- String datiIdentificativiFruitoreSelezionatoLabel = null;
- String datiIdentificativiFruitoreSelezionatoValue = null;
-
- List<String> serviziApplicativiFruitoreLabel = null;
- List<String> serviziApplicativiFruitoreValue = null;
- String servizioApplicativoFruitoreSelezionatoLabel = null;
- String servizioApplicativoFruitoreSelezionatoValue = null;
-
- // Cerco Ruoli con queste caratteristiche
- FiltroRicercaRuoli filtroRuoli = new FiltroRicercaRuoli();
- filtroRuoli.setTipologia(RuoloTipologia.INTERNO);
-
- boolean protocolloAssociatoFiltroNonSelezionatoUtente = false;
- if(allarme!=null && allarme.getFiltro()!=null && allarme.getFiltro().isEnabled()){
- protocolliValue = this.confCore.getProtocolli(this.request, this.session);
- if(allarme.getFiltro().getProtocollo()!=null) {
- // sara' sempre impostato, a meno della prima volta (create policy)
- if(protocolliValue.contains(allarme.getFiltro().getProtocollo())==false) {
- protocolloAssociatoFiltroNonSelezionatoUtente = true;
- }
- }
- }
-
- if(allarme!=null && allarme.getFiltro()!=null && allarme.getFiltro().isEnabled()){
-
- // protocollo
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- protocolloSelezionatoValue = allarme.getFiltro().getProtocollo();
- }
- else {
- if(!protocolliValue.contains(allarme.getFiltro().getProtocollo())){
- allarme.getFiltro().setProtocollo(null);
- }
- protocolloSelezionatoValue = allarme.getFiltro().getProtocollo();
- if(protocolloSelezionatoValue==null || protocolloSelezionatoValue.equals("")) {
- if(protocolliValue.size()==1) {
- protocolloSelezionatoValue = protocolliValue.get(0);
- }
- else {
- protocolloSelezionatoValue = this.confCore.getProtocolloDefault(this.request, this.session, protocolliValue);
- }
- }
- //protocolli = enrichListConQualsiasi(protocolli); NOTA: In questa versione un protocollo deve essere per forza selezionato.
- protocolliLabel = new ArrayList<>();
- for (String protocollo : protocolliValue) {
- protocolliLabel.add(this.getLabelProtocollo(protocollo));
- }
- }
- protocolloSelezionatoLabel = this.getLabelProtocollo(protocolloSelezionatoValue);
- }
- else {
- protocolloSelezionatoValue = allarme.getFiltro().getProtocollo();
- if(protocolloSelezionatoValue==null) {
- protocolloSelezionatoValue = this.soggettiCore.getProtocolloAssociatoTipoSoggetto(idSoggettoProprietario.getTipo());
- }
- }
-
- // ruolo erogatore
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- ruoloErogatoreSelezionatoValue = allarme.getFiltro().getRuoloErogatore();
- ruoloErogatoreSelezionatoLabel = ruoloErogatoreSelezionatoValue!=null ? ruoloErogatoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<String> ruoliErogatore = this.core.getAllRuoli(filtroRuoli);
-
- if(allarme.getFiltro().getRuoloErogatore()!=null) {
- ruoloErogatoreSelezionatoValue = allarme.getFiltro().getRuoloErogatore();
- }
- if(!ruoliErogatore.contains(ruoloErogatoreSelezionatoValue)){
- allarme.getFiltro().setRuoloErogatore(null);
- ruoloErogatoreSelezionatoValue = null;
- }
- ruoliErogatoreLabel = enrichListConLabelQualsiasi(ruoliErogatore);
- ruoliErogatoreValue = enrichListConValueQualsiasi(ruoliErogatore);
- }
- }
-
- // erogatore
- if(configurazione) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDSoggetto idSoggetto = null;
- if(allarme.getFiltro().getTipoErogatore()!=null && allarme.getFiltro().getNomeErogatore()!=null){
- datiIdentificativiErogatoreSelezionatoValue = allarme.getFiltro().getTipoErogatore() + "/" + allarme.getFiltro().getNomeErogatore();
- idSoggetto = new IDSoggetto(allarme.getFiltro().getTipoErogatore() , allarme.getFiltro().getNomeErogatore());
- }
- datiIdentificativiErogatoreSelezionatoLabel = idSoggetto!=null ? this.getLabelNomeSoggetto(idSoggetto) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<IDSoggetto> listErogatori = new ArrayList<>();
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggettiErogatori(protocolloSelezionatoValue, protocolliValue);
- if(ruoloPortaFiltro!=null && !RuoloPorta.ENTRAMBI.equals(ruoloPortaFiltro)) {
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(RuoloPorta.DELEGATA.equals(ruoloPortaFiltro)) {
- if(isPddEsterna) {
- listErogatori.add(idSoggetto);
- }
- else {
- if(!PddTipologia.ESTERNO.equals(pddTipologiaSoggettoAutenticati)) {
- // multitenant abilitato
- listErogatori.add(idSoggetto);
- }
- }
- }
- else {
- if(!isPddEsterna) {
- listErogatori.add(idSoggetto);
- }
- }
- }
- }
- else {
- listErogatori.addAll(listSoggettiPreFilterMultitenant);
- }
-
- erogatoriLabel = new ArrayList<>();
- erogatoriValue = new ArrayList<>();
- for (IDSoggetto idSoggetto : listErogatori) {
- erogatoriLabel.add(this.getLabelNomeSoggetto(idSoggetto));
- erogatoriValue.add(idSoggetto.getTipo()+"/"+idSoggetto.getNome());
- }
- if(allarme.getFiltro().getTipoErogatore()!=null && allarme.getFiltro().getNomeErogatore()!=null){
- datiIdentificativiErogatoreSelezionatoValue = allarme.getFiltro().getTipoErogatore() + "/" + allarme.getFiltro().getNomeErogatore();
- }
- if(!erogatoriValue.contains(datiIdentificativiErogatoreSelezionatoValue)){
- allarme.getFiltro().setTipoErogatore(null);
- allarme.getFiltro().setNomeErogatore(null);
- datiIdentificativiErogatoreSelezionatoValue = null;
- }
- erogatoriLabel = enrichListConLabelQualsiasi(erogatoriLabel);
- erogatoriValue = enrichListConValueQualsiasi(erogatoriValue);
- }
- }
-
- // tag
- if(configurazione) {
- FiltroRicercaGruppi filtroRicerca = new FiltroRicercaGruppi();
- List<String> elencoGruppi = this.gruppiCore.getAllGruppi(filtroRicerca);
- tagLabel = enrichListConLabelQualsiasi(elencoGruppi);
- tagValue = enrichListConValueQualsiasi(elencoGruppi);
- datiIdentificativiTagSelezionatoValue=allarme.getFiltro().getTag();
- datiIdentificativiTagSelezionatoLabel=allarme.getFiltro().getTag();
- }
-
- // servizio
- if(configurazione) {
- boolean controlloAllarmiFiltroApiSoggettoErogatore = this.core.getAllarmiConfig().isOptionsFilterApiOrganization();
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDServizio idServizio = null;
- if(allarme.getFiltro().getTipoServizio()!=null && allarme.getFiltro().getNomeServizio()!=null && allarme.getFiltro().getVersioneServizio()!=null &&
- allarme.getFiltro().getTipoErogatore()!=null && allarme.getFiltro().getNomeErogatore()!=null
- ){
- datiIdentificativiServizioSelezionatoValue = allarme.getFiltro().getTipoServizio()+"/"+allarme.getFiltro().getNomeServizio()+"/"+allarme.getFiltro().getVersioneServizio().intValue();
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- datiIdentificativiServizioSelezionatoValue = datiIdentificativiServizioSelezionatoValue+"/"+allarme.getFiltro().getTipoErogatore()+"/"+allarme.getFiltro().getNomeErogatore();
- idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(allarme.getFiltro().getTipoServizio(),
- allarme.getFiltro().getNomeServizio(),
- allarme.getFiltro().getTipoErogatore(),
- allarme.getFiltro().getNomeErogatore(),
- allarme.getFiltro().getVersioneServizio());
- }
- else {
- idServizio = IDServizioFactory.getInstance().getIDServizioFromValuesWithoutCheck(allarme.getFiltro().getTipoServizio(),
- allarme.getFiltro().getNomeServizio(),
- null,
- null,
- allarme.getFiltro().getVersioneServizio());
- }
- }
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- datiIdentificativiServizioSelezionatoLabel = idServizio!=null ? this.getLabelIdServizio(idServizio) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- datiIdentificativiServizioSelezionatoLabel = idServizio!=null ? this.getLabelIdServizioSenzaErogatore(idServizio) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- }
- else {
- List<IDServizio> listServizi = this.confCore.getServizi(protocolloSelezionatoValue, protocolliValue,
- allarme.getFiltro().getTipoErogatore(), allarme.getFiltro().getNomeErogatore(), allarme.getFiltro().getTag());
- serviziLabel = new ArrayList<>();
- serviziValue = new ArrayList<>();
- for (IDServizio idServizio : listServizi) {
-
- String valueAPI = idServizio.getTipo()+"/"+idServizio.getNome()+"/"+idServizio.getVersione().intValue();
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- valueAPI = valueAPI +"/"+ idServizio.getSoggettoErogatore().getTipo()+"/"+idServizio.getSoggettoErogatore().getNome();
- }
- if(serviziValue.contains(valueAPI)) {
- continue;
- }
- serviziValue.add(valueAPI);
-
- String labelAPI = null;
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- labelAPI = this.getLabelIdServizio(idServizio);
- }
- else {
- labelAPI = this.getLabelIdServizioSenzaErogatore(idServizio);
- }
- serviziLabel.add(labelAPI);
- }
- boolean definedApi = allarme.getFiltro().getTipoServizio()!=null && allarme.getFiltro().getNomeServizio()!=null && allarme.getFiltro().getVersioneServizio()!=null;
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- definedApi = definedApi && allarme.getFiltro().getTipoErogatore()!=null && allarme.getFiltro().getNomeErogatore()!=null;
- }
- if( definedApi ){
- datiIdentificativiServizioSelezionatoValue = allarme.getFiltro().getTipoServizio()+"/"+allarme.getFiltro().getNomeServizio()+"/"+allarme.getFiltro().getVersioneServizio().intValue();
- if(controlloAllarmiFiltroApiSoggettoErogatore) {
- datiIdentificativiServizioSelezionatoValue = datiIdentificativiServizioSelezionatoValue +"/"+allarme.getFiltro().getTipoErogatore()+"/"+allarme.getFiltro().getNomeErogatore();
- }
- }
- if(!serviziValue.contains(datiIdentificativiServizioSelezionatoValue)){
- allarme.getFiltro().setTipoServizio(null);
- allarme.getFiltro().setNomeServizio(null);
- allarme.getFiltro().setVersioneServizio(null);
- datiIdentificativiServizioSelezionatoValue = null;
- }
- serviziLabel = enrichListConLabelQualsiasi(serviziLabel);
- serviziValue = enrichListConValueQualsiasi(serviziValue);
- }
- }
-
- // azioni
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(allarme.getFiltro().getAzione()!=null && !"".equals(allarme.getFiltro().getAzione())){
- azioniSelezionataValue = new ArrayList<>();
- if(allarme.getFiltro().getAzione().contains(",")) {
- String [] tmp = allarme.getFiltro().getAzione().split(",");
- for (String az : tmp) {
- azioniSelezionataValue.add(az);
- }
- }
- else {
- azioniSelezionataValue.add(allarme.getFiltro().getAzione());
- }
- if(!azioniSelezionataValue.isEmpty()) {
- azioniSelezionataLabel = new ArrayList<>();
- for (String az : azioniSelezionataValue) {
- azioniSelezionataLabel.add(az);
- }
- }
- }
- if(azioniSelezionataLabel==null) {
- azioniSelezionataLabel = new ArrayList<>();
- azioniSelezionataLabel.add(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- }
- }
- else {
- List<String> azioni = null;
- Map<String,String> azioniConLabel = null;
- if(configurazione && datiIdentificativiServizioSelezionatoValue!=null) {
- if(StringUtils.isNotEmpty(allarme.getFiltro().getTipoServizio()) &&
- StringUtils.isNotEmpty(allarme.getFiltro().getNomeServizio()) &&
- allarme.getFiltro().getVersioneServizio()!=null && allarme.getFiltro().getVersioneServizio()>0) {
- if(StringUtils.isNotEmpty(allarme.getFiltro().getTipoErogatore()) &&
- StringUtils.isNotEmpty(allarme.getFiltro().getNomeErogatore())) {
- IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(allarme.getFiltro().getTipoServizio(), allarme.getFiltro().getNomeServizio(),
- allarme.getFiltro().getTipoErogatore(), allarme.getFiltro().getNomeErogatore(),
- allarme.getFiltro().getVersioneServizio());
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else {
- List<IDServizio> listServizi = this.confCore.getServizi(protocolloSelezionatoValue, protocolliValue,
- allarme.getFiltro().getTipoServizio(), allarme.getFiltro().getNomeServizio(), allarme.getFiltro().getVersioneServizio(), null);
- List<String> uris = new ArrayList<>();
- AccordoServizioParteSpecifica aspsRiferimento = null;
- if(listServizi!=null && !listServizi.isEmpty()) {
- for (IDServizio idS : listServizi) {
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idS,false);
- if(!uris.contains(asps.getAccordoServizioParteComune())) {
- uris.add(asps.getAccordoServizioParteComune());
- if(aspsRiferimento==null) {
- aspsRiferimento = asps;
- }
- }
- if(uris.size()>1) {
- break;
- }
- }
- }
- if(uris.size()==1) {
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(uris.get(0)));
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(aspsRiferimento, aspc, false, true, null);
- }
- }
- }
- azioni = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- allarme.getFiltro().getTipoErogatore(), allarme.getFiltro().getNomeErogatore(),
- allarme.getFiltro().getTipoServizio(), allarme.getFiltro().getNomeServizio(), allarme.getFiltro().getVersioneServizio());
- }
- else if(delegata) {
- IDPortaDelegata idPD = new IDPortaDelegata();
- idPD.setNome(allarme.getFiltro().getNomePorta());
- PortaDelegata pd = this.porteDelegateCore.getPortaDelegata(idPD);
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(pd);
- IDServizio idServizio = mappingPD.getIdServizio();
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
-
- if(pd.getAzione()!=null && pd.getAzione().sizeAzioneDelegataList()>0) {
- azioni = pd.getAzione().getAzioneDelegataList();
- }
- else {
- List<String> azioniAll = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- pd.getSoggettoErogatore().getTipo(), pd.getSoggettoErogatore().getNome(),
- pd.getServizio().getTipo(), pd.getServizio().getNome(), pd.getServizio().getVersione());
-
- IDSoggetto idSoggettoFruitore = mappingPD.getIdFruitore();
- List<MappingFruizionePortaDelegata> listaMappingFruizione = this.apsCore.serviziFruitoriMappingList(idSoggettoFruitore, idServizio, null);
- List<String> azioniOccupate = new ArrayList<>();
- int listaMappingFruizioneSize = listaMappingFruizione != null ? listaMappingFruizione.size() : 0;
- if(listaMappingFruizioneSize > 0) {
- for (int i = 0; i < listaMappingFruizione.size(); i++) {
- MappingFruizionePortaDelegata mappingFruizionePortaDelegata = listaMappingFruizione.get(i);
- // colleziono le azioni gia' configurate
- PortaDelegata portaDelegataTmp = this.porteDelegateCore.getPortaDelegata(mappingFruizionePortaDelegata.getIdPortaDelegata());
- if(portaDelegataTmp.getAzione() != null && portaDelegataTmp.getAzione().getAzioneDelegataList() != null)
- azioniOccupate.addAll(portaDelegataTmp.getAzione().getAzioneDelegataList());
- }
- }
-
- azioni = new ArrayList<>();
- for (int i = 0; i < azioniAll.size(); i++) {
- String az = azioniAll.get(i);
- if(azioniOccupate.contains(az)==false) {
- azioni.add(az);
- }
- }
- }
-
- azioniConLabel = this.porteDelegateCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else if(applicativa) {
- IDPortaApplicativa idPA = new IDPortaApplicativa();
- idPA.setNome(allarme.getFiltro().getNomePorta());
- PortaApplicativa pa = this.porteApplicativeCore.getPortaApplicativa(idPA);
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(pa);
- IDServizio idServizio = mappingPA.getIdServizio();
- AccordoServizioParteSpecifica asps = this.apsCore.getServizio(idServizio,false);
- AccordoServizioParteComuneSintetico aspc = this.apcCore.getAccordoServizioSintetico(this.idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
-
- if(pa.getAzione()!=null && pa.getAzione().sizeAzioneDelegataList()>0) {
- azioni = pa.getAzione().getAzioneDelegataList();
- }
- else {
- List<String> azioniAll = this.confCore.getAzioni(protocolloSelezionatoValue, protocolliValue,
- pa.getTipoSoggettoProprietario(), pa.getNomeSoggettoProprietario(),
- pa.getServizio().getTipo(), pa.getServizio().getNome(), pa.getServizio().getVersione());
-
- List<MappingErogazionePortaApplicativa> listaMappingErogazione = this.apsCore.mappingServiziPorteAppList(idServizio, null);
- List<String> azioniOccupate = new ArrayList<>();
- int listaMappingErogazioneSize = listaMappingErogazione != null ? listaMappingErogazione.size() : 0;
- if(listaMappingErogazioneSize > 0) {
- for (int i = 0; i < listaMappingErogazione.size(); i++) {
- MappingErogazionePortaApplicativa mappingErogazionePortaApplicativa = listaMappingErogazione.get(i);
- // colleziono le azioni gia' configurate
- PortaApplicativa portaApplicativaTmp = this.porteApplicativeCore.getPortaApplicativa(mappingErogazionePortaApplicativa.getIdPortaApplicativa());
- if(portaApplicativaTmp.getAzione() != null && portaApplicativaTmp.getAzione().getAzioneDelegataList() != null)
- azioniOccupate.addAll(portaApplicativaTmp.getAzione().getAzioneDelegataList());
- }
- }
-
- azioni = new ArrayList<>();
- for (int i = 0; i < azioniAll.size(); i++) {
- String az = azioniAll.get(i);
- if(azioniOccupate.contains(az)==false) {
- azioni.add(az);
- }
- }
- }
-
- azioniConLabel = this.porteApplicativeCore.getAzioniConLabel(asps, aspc, false, true, null);
- }
- else {
- azioni = new ArrayList<>();
- }
- if(allarme.getFiltro().getAzione()!=null && !"".equals(allarme.getFiltro().getAzione())){
- azioniSelezionataValue = new ArrayList<>();
- if(allarme.getFiltro().getAzione().contains(",")) {
- String [] tmp = allarme.getFiltro().getAzione().split(",");
- for (String az : tmp) {
- if(azioni.contains(az)){
- azioniSelezionataValue.add(az);
- }
- }
- }
- else {
- if(azioni.contains(allarme.getFiltro().getAzione())){
- azioniSelezionataValue.add(allarme.getFiltro().getAzione());
- }
- }
- }
- if(azioniSelezionataValue==null || azioniSelezionataValue.isEmpty()) {
- azioniSelezionataValue = null;
- }
- if(azioniConLabel!=null && azioniConLabel.size()>0) {
- azioniLabel = new ArrayList<>();
- azioniValue = new ArrayList<>();
- for (String idAzione : azioniConLabel.keySet()) {
- if(azioni.contains(idAzione)) {
- azioniValue.add(idAzione);
- azioniLabel.add(azioniConLabel.get(idAzione));
- }
- }
-
- // azioniLabel = enrichListConLabelQualsiasi(azioniLabel);
- // azioniValue = enrichListConValueQualsiasi(azioniValue);
- }
- else {
- // azioniLabel = enrichListConLabelQualsiasi(azioni);
- // azioniValue = enrichListConValueQualsiasi(azioni);
- azioniLabel = azioni;
- azioniValue = azioni;
- }
- }
-
- // // servizi applicativi erogatore
- // if(configurazione) {
- // if(ruoloPortaFiltro==null ||
- // RuoloPorta.ENTRAMBI.equals(ruoloPortaFiltro) ||
- // RuoloPorta.APPLICATIVA.equals(ruoloPortaFiltro)){
- // if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- // if(allarme.getFiltro().getServizioApplicativoErogatore()!=null){
- // servizioApplicativoErogatoreSelezionatoValue = allarme.getFiltro().getServizioApplicativoErogatore();
- // }
- // servizioApplicativoErogatoreSelezionatoLabel = servizioApplicativoErogatoreSelezionatoValue!=null ? servizioApplicativoErogatoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- // }
- // else {
- // serviziApplicativiErogatoreLabel = new ArrayList<>();
- // serviziApplicativiErogatoreValue = new ArrayList<>();
- // if(datiIdentificativiErogatoreSelezionatoValue!=null) {
- // List<IDServizioApplicativo> listSA = this.confCore.getServiziApplicativiErogatori(protocolloSelezionatoValue, protocolliValue,
- // allarme.getFiltro().getTipoErogatore(), allarme.getFiltro().getNomeErogatore(),
- // allarme.getFiltro().getTipoServizio(), allarme.getFiltro().getNomeServizio(), allarme.getFiltro().getVersioneServizio(),
- // null);
- // for (IDServizioApplicativo idServizioApplicativo : listSA) {
- // serviziApplicativiErogatoreLabel.add(idServizioApplicativo.getNome());
- // serviziApplicativiErogatoreValue.add(idServizioApplicativo.getNome());
- // }
- // }
- //
- // if(allarme.getFiltro().getServizioApplicativoErogatore()!=null){
- // servizioApplicativoErogatoreSelezionatoValue = allarme.getFiltro().getServizioApplicativoErogatore();
- // }
- // if(!serviziApplicativiErogatoreValue.contains(servizioApplicativoErogatoreSelezionatoValue)){
- // allarme.getFiltro().setServizioApplicativoErogatore(null);
- // servizioApplicativoErogatoreSelezionatoValue = null;
- // }
- // serviziApplicativiErogatoreLabel = enrichListConLabelQualsiasi(serviziApplicativiErogatoreLabel);
- // serviziApplicativiErogatoreValue = enrichListConValueQualsiasi(serviziApplicativiErogatoreValue);
- // }
- // }
- // }
-
- // ruolo fruitore (diventa ruolo richiedente nel caso di porta)
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(allarme.getFiltro().getRuoloFruitore()!=null) {
- ruoloFruitoreSelezionatoValue = allarme.getFiltro().getRuoloFruitore();
- }
- ruoloFruitoreSelezionatoLabel = ruoloFruitoreSelezionatoValue!=null ? ruoloFruitoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- List<String> ruoliFruitore = this.core.getAllRuoli(filtroRuoli);
- if(allarme.getFiltro().getRuoloFruitore()!=null) {
- ruoloFruitoreSelezionatoValue = allarme.getFiltro().getRuoloFruitore();
- }
- if(!ruoliFruitore.contains(ruoloFruitoreSelezionatoValue)){
- allarme.getFiltro().setRuoloFruitore(null);
- ruoloFruitoreSelezionatoValue = null;
- }
- ruoliFruitoreLabel = enrichListConLabelQualsiasi(ruoliFruitore);
- ruoliFruitoreValue = enrichListConValueQualsiasi(ruoliFruitore);
- }
-
- // fruitore
- if(configurazione || applicativa) {
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- IDSoggetto idSoggetto = null;
- if(allarme.getFiltro().getTipoFruitore()!=null && allarme.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = allarme.getFiltro().getTipoFruitore() + "/" + allarme.getFiltro().getNomeFruitore();
- idSoggetto = new IDSoggetto(allarme.getFiltro().getTipoFruitore() , allarme.getFiltro().getNomeFruitore());
- }
- datiIdentificativiFruitoreSelezionatoLabel = idSoggetto!=null ? this.getLabelNomeSoggetto(idSoggetto) : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
- // List<IDSoggetto> listFruitori = this.confCore.getSoggettiFruitori(protocolloSelezionatoValue, protocolliValue,
- // policy.getFiltro().getTipoErogatore(), policy.getFiltro().getNomeErogatore(),
- // policy.getFiltro().getTipoServizio(), policy.getFiltro().getNomeServizio(), policy.getFiltro().getVersioneServizio());
-
- List<IDSoggetto> listSoggetti = new ArrayList<>();
- if(configurazione) {
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggetti(protocolloSelezionatoValue, protocolliValue);
- if(ruoloPortaFiltro!=null && !RuoloPorta.ENTRAMBI.equals(ruoloPortaFiltro)) {
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(RuoloPorta.APPLICATIVA.equals(ruoloPortaFiltro)) {
- if(isPddEsterna) {
- listSoggetti.add(idSoggetto);
- }
- else {
- if(!PddTipologia.ESTERNO.equals(pddTipologiaSoggettoAutenticati)) {
- // multitenant abilitato
- listSoggetti.add(idSoggetto);
- }
- }
- }
- else {
- if(!isPddEsterna) {
- listSoggetti.add(idSoggetto);
- }
- }
- }
- }
- else {
- listSoggetti.addAll(listSoggettiPreFilterMultitenant);
- }
- }
- else {
-
- User user = ServletUtils.getUserFromSession(this.request, this.session);
- String userLogin = user.getLogin();
-
- List<String> tipiSoggettiGestitiProtocollo = this.soggettiCore.getTipiSoggettiGestitiProtocollo(protocolloSelezionatoValue);
-
- List<IDSoggettoDB> list = null;
- if(this.core.isVisioneOggettiGlobale(userLogin)){
- list = this.soggettiCore.getSoggettiFromTipoAutenticazione(tipiSoggettiGestitiProtocollo, null, tipoAutenticazione, appId, pddTipologiaSoggettoAutenticati);
- }else{
- list = this.soggettiCore.getSoggettiFromTipoAutenticazione(tipiSoggettiGestitiProtocollo, userLogin, tipoAutenticazione, appId, pddTipologiaSoggettoAutenticati);
- }
- if(list!=null && !list.isEmpty() && gestioneErogatori_soggettiAutenticati_escludiSoggettoErogatore) {
- for (int i = 0; i < list.size(); i++) {
- IDSoggettoDB soggettoCheck = list.get(i);
- if(soggettoCheck.getTipo().equals(idSoggettoProprietario.getTipo()) && soggettoCheck.getNome().equals(idSoggettoProprietario.getNome())) {
- list.remove(i);
- break;
- }
- }
- }
-
- if(list==null) {
- list = new ArrayList<>();
- }
-
- // soggetti esterni
- boolean isSupportatoAutenticazioneApplicativiEsterni = false;
- if(protocolloSelezionatoValue!=null && !"".equals(protocolloSelezionatoValue)) {
- isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocolloSelezionatoValue);
- }
-
- // multitenant: aggiungo soggetti operativi per poi poter selezionare un applicativo
- // isSupportatoAutenticazioneApplicativiEsterni: aggiungo i soggettti che possiedono applicativi esterno
- if(isSupportatoAutenticazioneApplicativiEsterni || multitenant) {
- List<IDSoggetto> listSoggettiPreFilterMultitenant = this.confCore.getSoggetti(protocolloSelezionatoValue, protocolliValue);
- for (IDSoggetto idSoggetto : listSoggettiPreFilterMultitenant) {
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggetto);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
-
- boolean found = false;
- if( (multitenant && !isPddEsterna)
- ||
- (isSupportatoAutenticazioneApplicativiEsterni && isPddEsterna)) {
- for (IDSoggettoDB sogg : list) {
- if(sogg.getTipo().equals(s.getTipo()) && sogg.getNome().equals(s.getNome())) {
- found = true;
- break;
- }
- }
- }
-
- boolean bothSslAndToken = false;
-
- if(!found && multitenant && !isPddEsterna) {
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggetto,userLogin,tipoAutenticazioneConfig, appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- IDSoggettoDB idSoggettoDB = new IDSoggettoDB();
- idSoggettoDB.setTipo(s.getTipo());
- idSoggettoDB.setNome(s.getNome());
- idSoggettoDB.setCodicePorta(s.getIdentificativoPorta());
- idSoggettoDB.setId(s.getId());
- list.add(idSoggettoDB);
- }
- }
-
- if(!found && isSupportatoAutenticazioneApplicativiEsterni && isPddEsterna) {
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggetto,userLogin,tipoAutenticazioneConfig, appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- IDSoggettoDB idSoggettoDB = new IDSoggettoDB();
- idSoggettoDB.setTipo(s.getTipo());
- idSoggettoDB.setNome(s.getNome());
- idSoggettoDB.setCodicePorta(s.getIdentificativoPorta());
- idSoggettoDB.setId(s.getId());
- list.add(idSoggettoDB);
- }
- }
-
- }
- }
-
- if(!list.isEmpty()) {
- for (IDSoggettoDB soggetto : list) {
- listSoggetti.add(new IDSoggetto(soggetto.getTipo(), soggetto.getNome()));
- }
- }
-
- }
-
- fruitoriLabel = new ArrayList<>();
- fruitoriValue = new ArrayList<>();
- for (IDSoggetto idSoggetto : listSoggetti) {
- fruitoriLabel.add(this.getLabelNomeSoggetto(idSoggetto));
- fruitoriValue.add(idSoggetto.getTipo()+"/"+idSoggetto.getNome());
- }
- if(allarme.getFiltro().getTipoFruitore()!=null && allarme.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = allarme.getFiltro().getTipoFruitore() + "/" + allarme.getFiltro().getNomeFruitore();
- }
- if(!fruitoriValue.contains(datiIdentificativiFruitoreSelezionatoValue)){
- allarme.getFiltro().setTipoFruitore(null);
- allarme.getFiltro().setNomeFruitore(null);
- datiIdentificativiFruitoreSelezionatoValue = null;
- }
- fruitoriLabel = enrichListConLabelQualsiasi(fruitoriLabel);
- fruitoriValue = enrichListConValueQualsiasi(fruitoriValue);
- }
- }
- else {
- if(delegata) {
- if(allarme.getFiltro().getTipoFruitore()!=null && allarme.getFiltro().getNomeFruitore()!=null){
- datiIdentificativiFruitoreSelezionatoValue = allarme.getFiltro().getTipoFruitore() + "/" + allarme.getFiltro().getNomeFruitore();
- }
- }
- }
-
- // servizi applicativi fruitore
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(allarme.getFiltro().getServizioApplicativoFruitore()!=null){
- servizioApplicativoFruitoreSelezionatoValue = allarme.getFiltro().getServizioApplicativoFruitore();
- }
- servizioApplicativoFruitoreSelezionatoLabel = servizioApplicativoFruitoreSelezionatoValue!=null ? servizioApplicativoFruitoreSelezionatoValue : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI;
- }
- else {
-
- IDSoggetto soggettoProprietarioServiziApplicativi = null;
- if(datiIdentificativiFruitoreSelezionatoValue!=null || !configurazione) {
- String tipoFruitore = null;
- String nomeFruitore = null;
- if(datiIdentificativiFruitoreSelezionatoValue!=null) {
- tipoFruitore = allarme.getFiltro().getTipoFruitore();
- nomeFruitore = allarme.getFiltro().getNomeFruitore();
- }
- else {
- tipoFruitore = idSoggettoProprietario.getTipo();
- nomeFruitore = idSoggettoProprietario.getNome();
- }
- soggettoProprietarioServiziApplicativi = new IDSoggetto(tipoFruitore, nomeFruitore);
- }
-
- if(soggettoProprietarioServiziApplicativi!=null) {
- serviziApplicativiFruitoreLabel = new ArrayList<>();
- serviziApplicativiFruitoreValue = new ArrayList<>();
- List<IDServizioApplicativo> listSA =null;
- if(configurazione) {
- listSA = this.confCore.getServiziApplicativiFruitore(protocolloSelezionatoValue, protocolliValue,
- soggettoProprietarioServiziApplicativi.getTipo(), soggettoProprietarioServiziApplicativi.getNome());
- }
- else {
-
- listSA = new ArrayList<>();
-
- User user = ServletUtils.getUserFromSession(this.request, this.session);
- String userLogin = user.getLogin();
-
- // soggetti esterni
- boolean isSupportatoAutenticazioneApplicativiEsterni = false;
- if(protocolloSelezionatoValue!=null && !"".equals(protocolloSelezionatoValue)) {
- isSupportatoAutenticazioneApplicativiEsterni = this.saCore.isSupportatoAutenticazioneApplicativiEsterniErogazione(protocolloSelezionatoValue);
- }
-
- boolean bothSslAndToken = false;
-
- List<IDServizioApplicativoDB> listServiziApplicativiTmp = null;
- if(delegata || !multitenant) {
- listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggettoProprietario,userLogin,tipoAutenticazioneConfig,appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- }
- else {
- // sull'applicativa con multitenant deve essere stata selezionato un soggetto operativo.
- if(allarme.getFiltro().getTipoFruitore()!=null && allarme.getFiltro().getNomeFruitore()!=null) {
- IDSoggetto idSoggettoSelezionato = new IDSoggetto(allarme.getFiltro().getTipoFruitore(), allarme.getFiltro().getNomeFruitore());
- Soggetto s = this.soggettiCore.getSoggettoRegistro(idSoggettoSelezionato);
- boolean isPddEsterna = this.pddCore.isPddEsterna(s.getPortaDominio());
- if(!isPddEsterna || isSupportatoAutenticazioneApplicativiEsterni) {
- listServiziApplicativiTmp = this.saCore.soggettiServizioApplicativoList(idSoggettoSelezionato,userLogin,tipoAutenticazioneConfig,appId,
- CostantiConfigurazione.CLIENT,
- bothSslAndToken, tokenPolicy, tokenPolicyOR);
- }
- }
- }
-
- if(listServiziApplicativiTmp!=null && !listServiziApplicativiTmp.isEmpty()) {
- for (IDServizioApplicativoDB servizioApplicativo : listServiziApplicativiTmp) {
- IDServizioApplicativo idSA = new IDServizioApplicativo();
- idSA.setIdSoggettoProprietario(idSoggettoProprietario);
- idSA.setNome(servizioApplicativo.getNome());
- listSA.add(idSA);
- }
- }
-
- }
- for (IDServizioApplicativo idServizioApplicativo : listSA) {
- serviziApplicativiFruitoreLabel.add(idServizioApplicativo.getNome());
- serviziApplicativiFruitoreValue.add(idServizioApplicativo.getNome());
- }
-
- if(allarme.getFiltro().getServizioApplicativoFruitore()!=null){
- servizioApplicativoFruitoreSelezionatoValue = allarme.getFiltro().getServizioApplicativoFruitore();
- }
- if(!serviziApplicativiFruitoreValue.contains(servizioApplicativoFruitoreSelezionatoValue)){
- allarme.getFiltro().setServizioApplicativoFruitore(null);
- servizioApplicativoFruitoreSelezionatoValue = null;
- }
- serviziApplicativiFruitoreLabel = enrichListConLabelQualsiasi(serviziApplicativiFruitoreLabel);
- serviziApplicativiFruitoreValue = enrichListConValueQualsiasi(serviziApplicativiFruitoreValue);
- }
- }
-
- }
-
-
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_FILTRO);
- de.setType(DataElementType.TITLE);
- dati.add(de);
-
- boolean filtroAbilitatoAPI = false;
- if(ruoloPorta!=null) {
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
- if(first) {
- String filtro = this.toStringCompactAllarmeFilter(allarme.getFiltro(),ruoloPorta,nomePorta,serviceBinding);
- filtroAbilitatoAPI = filtro!=null && !"".equals(filtro) && !CostantiControlStation.LABEL_STATO_DISABILITATO.equals(filtro);
- }
- else {
- String filtro = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED_CONSOLE_ONLY);
- filtroAbilitatoAPI = ServletUtils.isCheckBoxEnabled(filtro);
- }
- }
-
- // stato
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
-
- addToDatiDataElementStatoReadOnly(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED, allarme.getFiltro().isEnabled(), true,
- false, false);
-
- if(allarme.getFiltro().isEnabled()){
- de = new DataElement();
- de.setType(DataElementType.NOTE);
- de.setValue("Filtro non modificabile poichè definito per un "+CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_DI.toLowerCase()+" non attivo nella console");
- dati.add(de);
- }
- }
- else {
- boolean hidden = ruoloPorta!=null;
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED, (allarme!=null && allarme.getFiltro()!=null && allarme.getFiltro().isEnabled()), true,
- false, false, hidden);
-
- if(ruoloPorta!=null) {
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED_CONSOLE_ONLY,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED, filtroAbilitatoAPI, true,
- false, false, false);
- }
-
- }
-
- boolean filtroEnabled = allarme!=null && allarme.getFiltro()!=null && allarme.getFiltro().isEnabled();
- if(ruoloPorta!=null) {
- filtroEnabled = filtroAbilitatoAPI;
- }
-
- if(!filtroEnabled && ruoloPorta!=null) {
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoValue); // un protocollo e' sempre selezionato
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- if(filtroEnabled){
-
- // Ruolo PdD
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD);
- if(ruoloPortaFiltro!=null){
- de.setValue(ruoloPortaFiltro.getValue());
- }
- if(filterConfig!=null && filterConfig.isHideGatewayRole()) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else if(configurazione && filterConfig!=null &&
- (filterConfig.isForceInGatewayRole() || filterConfig.isForceOutGatewayRole())) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD);
- if(ruoloPortaFiltro!=null){
- de.setValue(ruoloPortaFiltro.getValue());
- }
- else {
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RATE_LIMITING_QUALSIASI);
- }
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setValues(ConfigurazioneCostanti.TIPI_RUOLO_PDD);
- de.setLabels(ConfigurazioneCostanti.LABEL_TIPI_RUOLO_PDD);
- if(ruoloPortaFiltro!=null){
- de.setSelected(ruoloPortaFiltro.getValue());
- }
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- dati.add(de);
-
-
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoValue); // un protocollo e' sempre selezionato
- if(filterConfig!=null && filterConfig.isHideProtocol()) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setValue(protocolloSelezionatoLabel); // un protocollo e' sempre selezionato
- de.setType(DataElementType.TEXT);
- }
- }
- else if(protocolliValue!=null && protocolliValue.size()>1){
- de.setValues(protocolliValue);
- de.setLabels(protocolliLabel);
- de.setSelected(protocolloSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else{
- de.setType(DataElementType.HIDDEN);
- if(protocolliValue!=null && protocolliValue.size()>0) {
- dati.add(de);
-
- // Si è deciso cmq di farlo vedere
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PROTOCOLLO);
- de.setValue(this.getLabelProtocollo(protocolliValue.get(0))); // un protocollo e' sempre selezionato
- de.setType(DataElementType.TEXT);
- }
- }
- dati.add(de);
-
- // Ruolo Erogatore
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE);
- if(filterConfig!=null && filterConfig.isHideProviderRole()) {
- de.setType(DataElementType.HIDDEN);
- }
- else if(datiIdentificativiErogatoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(ruoloErogatoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE);
- de.setValue(ruoloErogatoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(ruoliErogatoreLabel);
- de.setValues(ruoliErogatoreValue);
- de.setSelected(ruoloErogatoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Erogatore
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE);
- if(filterConfig!=null && filterConfig.isHideProvider()) {
- de.setType(DataElementType.HIDDEN);
- }
- else if(ruoloErogatoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(datiIdentificativiErogatoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE);
- de.setValue(datiIdentificativiErogatoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(erogatoriLabel);
- de.setValues(erogatoriValue);
- de.setSelected(datiIdentificativiErogatoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Tag
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_TAG);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_TAG);
- de.setValue(datiIdentificativiTagSelezionatoValue);
- boolean allarmiFiltroApi = this.core.getAllarmiConfig().isOptionsFilterApi();
- if(filterConfig!=null && filterConfig.isHideTag()) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else if(!configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else {
- de.setValue(datiIdentificativiTagSelezionatoValue);
- if(allarmiFiltroApi && datiIdentificativiServizioSelezionatoValue==null ) {
- de.setLabels(tagLabel);
- de.setValues(tagValue);
- de.setSelected(datiIdentificativiTagSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
-
- // Servizio
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO);
- de.setValue(datiIdentificativiServizioSelezionatoValue);
- if(filterConfig!=null && filterConfig.isHideService()) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
- else if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO);
- de.setValue(datiIdentificativiServizioSelezionatoLabel);
- if(allarmiFiltroApi) {
- de.setType(DataElementType.TEXT);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- }
- else {
- de.setValue(datiIdentificativiServizioSelezionatoValue);
- if(allarmiFiltroApi) {
- de.setLabels(serviziLabel);
- de.setValues(serviziValue);
- de.setSelected(datiIdentificativiServizioSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
-
- // Azione
- boolean showAzione = true;
- if(configurazione) {
- if(filterConfig!=null && filterConfig.isHideAction()) {
- showAzione = false;
- }
- else if(datiIdentificativiServizioSelezionatoValue==null) {
- showAzione = false;
- }
- }
- else {
- if(filterConfig!=null && filterConfig.isHideAction()) {
- showAzione = false;
- }
- }
- if(showAzione) {
-
- boolean azioniAll = false;
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
- if(first) {
- azioniAll = azioniSelezionataValue==null || azioniSelezionataValue.isEmpty();
- }
- else if(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO.equals(this.getPostBackElementName()) ||
- ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_ENABLED_CONSOLE_ONLY.equals(this.getPostBackElementName())) {
- azioniAll = true;
- }
- else {
- String azioniAllPart = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE);
- azioniAll = ServletUtils.isCheckBoxEnabled(azioniAllPart);
- }
-
- if(!protocolloAssociatoFiltroNonSelezionatoUtente) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE);
- de.setPostBack_viaPOST(true);
- de.setValues(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE_ALL_VALUES);
- if(ServiceBinding.REST.equals(serviceBinding)) {
- de.setLabels(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE_RISORSE_ALL_VALUES);
- }
- else {
- de.setLabels(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE_ALL_VALUES);
- }
- if(azioniAll) {
- de.setSelected(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE_ALL_VALUE_TRUE);
- }
- else {
- de.setSelected(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE_PUNTUALE_ALL_VALUE_FALSE);
- }
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE);
- }
- de.setType(DataElementType.SELECT);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE);
- }
- }
- else {
- de.setLabel("");
- }
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setValue(allarme.getFiltro().getAzione());
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE+"___LABEL");
- if(serviceBinding!=null) {
- de.setLabel(this.getLabelAzioni(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_AZIONE);
- }
- if(azioniSelezionataLabel!=null && !azioniSelezionataLabel.isEmpty()) {
- if(azioniSelezionataLabel.size()==1) {
- de.setValue(azioniSelezionataLabel.get(0));
- }
- else {
- de.setValue(azioniSelezionataLabel.toString());
- }
- }
- de.setType(DataElementType.TEXT);
- }
- else {
- if(!azioniAll) {
- de.setLabels(azioniLabel);
- de.setValues(azioniValue);
- de.setSelezionati(azioniSelezionataValue);
- de.setType(DataElementType.MULTI_SELECT);
- if(azioniValue!=null && azioniValue.size()<=10) {
- if(azioniValue.size()<=3) {
- de.setRows(3);
- }
- else {
- de.setRows(azioniValue.size());
- }
- }
- else {
- de.setRows(10);
- }
- de.setPostBack_viaPOST(true);
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- }
- dati.add(de);
- }
-
- // // Servizio Applicativo Erogatore
- // if(serviziApplicativiErogatoreValue!=null){
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_EROGATORE);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_EROGATORE);
- // de.setValue(servizioApplicativoErogatoreSelezionatoValue);
- // if(protocolloAssociatoFiltroNonSelezionatoUtente || !configurazione) {
- // de.setType(DataElementType.HIDDEN);
- // dati.add(de);
- //
- // if(configurazione) {
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_EROGATORE+"___LABEL");
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_EROGATORE);
- // de.setValue(servizioApplicativoErogatoreSelezionatoLabel);
- // //de.setType(DataElementType.TEXT);
- // de.setType(DataElementType.HIDDEN);
- // }
- // }
- // else {
- // de.setLabels(serviziApplicativiErogatoreLabel);
- // de.setValues(serviziApplicativiErogatoreValue);
- // de.setSelected(servizioApplicativoErogatoreSelezionatoValue);
- // de.setValue(servizioApplicativoErogatoreSelezionatoValue);
- // //de.setType(DataElementType.SELECT);
- // de.setType(DataElementType.HIDDEN);
- // de.setPostBack_viaPOST(true);
- // }
- // dati.add(de);
- // }
-
- // Ruolo Fruitore
- boolean showRuoloRichiedente = false;
- if(configurazione) {
- showRuoloRichiedente = true;
- }
- else {
- if(serviziApplicativiFruitoreValue!=null && serviziApplicativiFruitoreValue.size()>1){
- showRuoloRichiedente = true;
- }
- else if(fruitoriValue!=null && fruitoriValue.size()>1){
- showRuoloRichiedente = true;
- }
- }
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE);
- // if(configurazione) {
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE);
- // }
- // else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_RICHIEDENTE);
- //}
- if(filterConfig!=null && filterConfig.isHideSubscriberRole()) {
- de.setType(DataElementType.HIDDEN);
- }
- else if((datiIdentificativiFruitoreSelezionatoValue!=null && !delegata) || servizioApplicativoFruitoreSelezionatoValue!=null || !showRuoloRichiedente) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(ruoloFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE+"___LABEL");
- // if(configurazione) {
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE);
- // }
- // else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_RICHIEDENTE);
- //}
- de.setValue(ruoloFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(ruoliFruitoreLabel);
- de.setValues(ruoliFruitoreValue);
- de.setSelected(ruoloFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
-
- // Fruitore
- if(fruitoriValue!=null && fruitoriValue.size()>1){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE);
- if(filterConfig!=null && filterConfig.isHideSubscriber()) {
- de.setType(DataElementType.HIDDEN);
- }
- else if(ruoloFruitoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(datiIdentificativiFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente || delegata) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE);
- de.setValue(datiIdentificativiFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(fruitoriLabel);
- de.setValues(fruitoriValue);
- de.setSelected(datiIdentificativiFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
- }
-
- // Servizio Applicativo Fruitore
- if(serviziApplicativiFruitoreValue!=null && serviziApplicativiFruitoreValue.size()>1){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE);
- if(filterConfig!=null && filterConfig.isHideApplication()) {
- de.setType(DataElementType.HIDDEN);
- }
- else if(ruoloFruitoreSelezionatoValue!=null) {
- de.setType(DataElementType.HIDDEN);
- }
- else {
- de.setValue(servizioApplicativoFruitoreSelezionatoValue);
- if(protocolloAssociatoFiltroNonSelezionatoUtente) {
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(configurazione) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE+"___LABEL");
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE);
- de.setValue(servizioApplicativoFruitoreSelezionatoLabel);
- de.setType(DataElementType.TEXT);
- }
- }
- else {
- de.setLabels(serviziApplicativiFruitoreLabel);
- de.setValues(serviziApplicativiFruitoreValue);
- de.setSelected(servizioApplicativoFruitoreSelezionatoValue);
- de.setType(DataElementType.SELECT);
- de.setPostBack_viaPOST(true);
- }
- }
- dati.add(de);
- }
- }
- }
-
- private void addToDatiAllarmeGroupBy(List<DataElement> dati, TipoOperazione tipoOperazione,ConfigurazioneAllarmeBean allarme, Context context, String nomeSezione,
- RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding,
- boolean tokenAbilitato) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPorta.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
-
-
- List<String> protocolli = null;
- // boolean groupByKey = false;
-
- if(allarme!=null && allarme.getGroupBy()!=null && allarme.getGroupBy().isEnabled()){
-
- // protocollo
- protocolli = this.confCore.getProtocolli();
-
- // group by by key se non sono richiesti campionamenti statistici
- // if(infoPolicy!=null && infoPolicy.isIntervalloUtilizzaRisorseStatistiche()==false &&
- // infoPolicy.isDegradoPrestazionaleUtilizzaRisorseStatistiche()==false){
- // groupByKey = true;
- // }
- }
- //
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RAGGRUPPAMENTO);
- de.setType(DataElementType.SUBTITLE);
- dati.add(de);
-
- de = new DataElement();
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RAGGRUPPAMENTO_NOTE);
- de.setType(DataElementType.NOTE);
- dati.add(de);
-
- // stato
- boolean allarmeGBEnabled = allarme!=null && allarme.getGroupBy()!=null ? allarme.getGroupBy().isEnabled() : false;
- addToDatiDataElementStato_postBackViaPOST(dati, ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_ENABLED,
- ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_ENABLED_STATO, allarmeGBEnabled, true, false, false, false);
-
- /*
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_ENABLED);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_ENABLED);
- de.setType(DataElementType.SELECT);
- de.setValues(ConfigurazioneCostanti.CONFIGURAZIONE_STATI_COLLEZIONAMENTO);
- if(policy.getGroupBy().isEnabled()){
- de.setSelected(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_ABILITATO);
- }
- else{
- de.setSelected(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_COLLEZIONAMENTO_DISABILITATO);
- }
- de.setPostBack_viaPOST(true);
- dati.add(de);
- */
-
- if(allarme!=null && allarme.getGroupBy()!=null && allarme.getGroupBy().isEnabled()){
-
- GroupByConfiguration groupByConfig = this.confCore.getGroupByConfiguration(allarme, context);
-
-
- // --- GENERALI ---
-
- if(configurazione) {
-
- // Ruolo Gateway
- FiltersConfiguration filterConfig = this.confCore.getFiltersConfiguration(allarme, context);
- RuoloPorta ruoloPortaFiltro = null;
- if(allarme!=null && allarme.getFiltro()!=null && allarme.getFiltro().isEnabled()) {
- ruoloPortaFiltro = allarme.getFiltro().getRuoloPorta();
- }
- if(filterConfig!=null && !filterConfig.isHideGatewayRole() &&
- (filterConfig.isForceInGatewayRole() || filterConfig.isForceOutGatewayRole())) {
- if(filterConfig.isForceInGatewayRole()) {
- ruoloPortaFiltro = RuoloPorta.APPLICATIVA;
- }
- else if(filterConfig.isForceOutGatewayRole()) {
- ruoloPortaFiltro = RuoloPorta.DELEGATA;
- }
- }
-
- boolean showRuoloPdD = ruoloPortaFiltro==null ||
- RuoloPorta.ENTRAMBI.equals(ruoloPortaFiltro);
- if(showRuoloPdD) {
- if(groupByConfig!=null && groupByConfig.isHideGatewayRole()) {
- showRuoloPdD = false;
- }
- }
-
- boolean showProtocollo = protocolli.size()>1 && (allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getProtocollo()==null);
- if(showProtocollo) {
- if(groupByConfig!=null && groupByConfig.isHideProtocol()) {
- showProtocollo = false;
- }
- }
-
- boolean showErogatore = allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getTipoErogatore()==null ||
- allarme.getFiltro().getNomeErogatore()==null;
- if(showErogatore) {
- if(groupByConfig!=null && groupByConfig.isHideProvider()) {
- showErogatore = false;
- }
- }
-
- if(showRuoloPdD || showProtocollo || showErogatore) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_GROUPBY_DATI_GENERALI);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
-
- // Ruolo PdD
- if( showRuoloPdD ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RUOLO_PDD);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RUOLO_PDD_LABEL);
- //de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RUOLO_PDD_NOTE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isRuoloPorta());
- de.setValue(allarme.getGroupBy().isRuoloPorta()+"");
- dati.add(de);
- }
-
- // Protocollo
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PROTOCOLLO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PROTOCOLLO);
- if(showProtocollo){
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isProtocollo());
- de.setValue(allarme.getGroupBy().isProtocollo()+"");
- }
- else{
- de.setType(DataElementType.HIDDEN);
- if(protocolli.size()==1){
- de.setValue("false");
- }
- }
- dati.add(de);
-
- // Erogatore
- if( showErogatore ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_EROGATORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_EROGATORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isErogatore());
- de.setValue(allarme.getGroupBy().isErogatore()+"");
- dati.add(de);
- }
-
- }
-
- // --- API ---
-
- boolean showServizio = false;
-
- boolean showAzione = allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getAzione()==null ||
- "".equals(allarme.getFiltro().getAzione()) ||
- allarme.getFiltro().getAzione().contains(",");
- if(showAzione) {
- if(groupByConfig!=null && groupByConfig.isHideAction()) {
- showAzione = false;
- }
- }
-
- // boolean showSAErogatore = false;
-
- if(configurazione) {
-
- if(this.core.getAllarmiConfig().isOptionsGroupByApi()) {
- showServizio = allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getTipoServizio()==null ||
- allarme.getFiltro().getNomeServizio()==null;
- if(showServizio) {
- if(groupByConfig!=null && groupByConfig.isHideService()) {
- showServizio = false;
- }
- }
- }
- if(showAzione) {
- showAzione = showServizio && allarme.getGroupBy().isServizio(); // l'azione la scelgo se ho prima selezionato una API
- if(showAzione) {
- if(groupByConfig!=null && groupByConfig.isHideAction()) {
- showAzione = false;
- }
- }
- }
-
- // showSAErogatore = allarme.getFiltro()==null ||
- // allarme.getFiltro().isEnabled()==false ||
- // allarme.getFiltro().getRuoloPorta()==null ||
- // RuoloPorta.ENTRAMBI.equals(allarme.getFiltro().getRuoloPorta()) ||
- // RuoloPorta.APPLICATIVA.equals(allarme.getFiltro().getRuoloPorta());
- // if(showSAErogatore) {
- // showSAErogatore = allarme.getFiltro()==null ||
- // allarme.getFiltro().isEnabled()==false ||
- // allarme.getFiltro().getServizioApplicativoErogatore()==null;
- // }
-
- if(showServizio || showAzione) { // || showSAErogatore
- if(configurazione) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_GROUPBY_API);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
- }
-
- // Servizio
- if( showServizio ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SERVIZIO);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SERVIZIO);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isServizio());
- de.setValue(allarme.getGroupBy().isServizio()+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
- }
- }
-
- // Azione
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_AZIONE);
- if(serviceBinding!=null) {
- de.setLabel(getLabelAzione(serviceBinding));
- }
- else {
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_AZIONE);
- }
- if( showAzione ){
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isAzione());
- }
- else {
- de.setType(DataElementType.HIDDEN);
- }
- de.setValue(allarme.getGroupBy().isAzione()+"");
- dati.add(de);
-
-
- // Servizio Applicativo Erogatore
- // if(configurazione) {
- // if( showSAErogatore ){
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_EROGATORE);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_EROGATORE);
- // //de.setType(DataElementType.CHECKBOX);
- // de.setType(DataElementType.HIDDEN);
- // de.setSelected(allarme.getGroupBy().isServizioApplicativoErogatore());
- // de.setValue(allarme.getGroupBy().isServizioApplicativoErogatore()+"");
- // dati.add(de);
- // }
- // }
-
-
- // --- RICHIEDENTI ---
-
- if(configurazione) {
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI_GROUPBY_MITTENTE);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- }
-
- // Fruitore
-
- if(configurazione) {
-
- boolean showFruitore = allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getTipoFruitore()==null ||
- allarme.getFiltro().getNomeFruitore()==null;
- if(showFruitore) {
- if(groupByConfig!=null && groupByConfig.isHideSubscriber()) {
- showFruitore = false;
- }
- }
-
- // Fruitore
- if( showFruitore ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_FRUITORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isFruitore());
- de.setValue(allarme.getGroupBy().isFruitore()+"");
- dati.add(de);
- }
-
-
- boolean showRichiedenteApplicativo = allarme.getFiltro()==null ||
- allarme.getFiltro().isEnabled()==false ||
- allarme.getFiltro().getRuoloPorta()==null ||
- allarme.getFiltro().getServizioApplicativoFruitore()==null;
- if(showRichiedenteApplicativo) {
- if(groupByConfig!=null && groupByConfig.isHideApplication()) {
- showRichiedenteApplicativo = false;
- }
- }
-
- // Applicativo Fruitore
- if( showRichiedenteApplicativo ){
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_FRUITORE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_SA_FRUITORE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isServizioApplicativoFruitore());
- de.setValue(allarme.getGroupBy().isServizioApplicativoFruitore()+"");
- dati.add(de);
- }
-
- }
- else {
-
- boolean showRichiedente = true;
- if(showRichiedente) {
- if(groupByConfig!=null && groupByConfig.isHideSenderIdentity()) {
- showRichiedente = false;
- }
- }
-
- // Richiedente API (Significa SoggettoMittente per le erogazioni, Applicativo e Identificativo Autenticato sia per le erogazioni che per le fruizioni)
- if(showRichiedente) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RICHIEDENTE);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_RICHIEDENTE);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(allarme.getGroupBy().isIdentificativoAutenticato()); // uso isIdentificativoAutenticato come informazione equivalente a isServizioApplicativoFruitore e isSoggettoFruitore
- de.setValue(allarme.getGroupBy().isIdentificativoAutenticato()+"");
- dati.add(de);
- }
-
- }
-
- // Token
-
- if(tokenAbilitato) {
-
- boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_FIRST_TIME);
- String token = this.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN);
-
- String [] tokenSelezionatiDB = null;
- if(allarme.getGroupBy().getToken()!=null && !"".equals(allarme.getGroupBy().getToken())) {
- tokenSelezionatiDB = allarme.getGroupBy().getToken().split(",");
- }
- String [] tokenSelezionatiSenzaIssuer = null;
- if(tokenSelezionatiDB!=null && tokenSelezionatiDB.length>0) {
- List<String> l = new ArrayList<>();
- for (int i = 0; i < tokenSelezionatiDB.length; i++) {
- TipoCredenzialeMittente tipo = TipoCredenzialeMittente.toEnumConstant(tokenSelezionatiDB[i],true);
- if(!TipoCredenzialeMittente.TOKEN_ISSUER.equals(tipo)) {
- l.add(tokenSelezionatiDB[i]);
- }
- }
- if(!l.isEmpty()) {
- tokenSelezionatiSenzaIssuer = l.toArray(new String[1]);
- }
- }
- boolean groupByToken = false;
- if(first) {
- groupByToken = (tokenSelezionatiDB!=null && tokenSelezionatiDB.length>0);
- }
- else {
- groupByToken = ServletUtils.isCheckBoxEnabled(token);
- }
-
- boolean showToken = true;
- if(showToken) {
- if(groupByConfig!=null && groupByConfig.isHideToken()) {
- showToken = false;
- }
- }
-
- if(showToken) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN);
- de.setType(DataElementType.CHECKBOX);
- de.setSelected(groupByToken); // uso isIdentificativoAutenticato come informazione equivalente a isServizioApplicativoFruitore e isSoggettoFruitore
- de.setValue(groupByToken+"");
- de.setPostBack_viaPOST(true);
- dati.add(de);
-
- boolean showTokenClaims = true;
- if(showTokenClaims) {
- if(groupByConfig!=null && groupByConfig.isHideTokenClaims()) {
- showTokenClaims = false;
- }
- }
-
- if(showTokenClaims && groupByToken) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN_CLAIMS);
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_TOKEN_CLAIMS);
- de.setValues(CostantiControlStation.TOKEN_VALUES_WITHOUT_ISSUER);
- de.setLabels(CostantiControlStation.LABEL_TOKEN_VALUES_WITHOUT_ISSUER);
- de.setSelezionati(tokenSelezionatiSenzaIssuer);
- de.setType(DataElementType.MULTI_SELECT);
- de.setRows(4);
- de.setRequired(true);
- dati.add(de);
- }
- }
-
- }
-
- // if(groupByKey){
- //
- // // per chiave
- //
- // if(allarme.getGroupBy().isInformazioneApplicativaEnabled()){
- // de = new DataElement();
- // de.setValue(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED_NOTE);
- // de.setType(DataElementType.NOTE);
- // dati.add(de);
- // }
- //
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED);
- // if(allarme.getGroupBy().isInformazioneApplicativaEnabled()){
- // de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO);
- // }
- // else{
- // //de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED_LABEL);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED_LABEL);
- // //de.setLabelRight(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_ENABLED_NOTE);
- // }
- // de.setType(DataElementType.CHECKBOX);
- // de.setSelected(allarme.getGroupBy().isInformazioneApplicativaEnabled());
- // de.setValue(allarme.getGroupBy().isInformazioneApplicativaEnabled()+"");
- // de.setPostBack_viaPOST(true);
- // dati.add(de);
- //
- // if(allarme.getGroupBy().isInformazioneApplicativaEnabled()){
- //
- // TipoFiltroApplicativo tipoChiaveGroupBy = null;
- // if(allarme.getGroupBy().getInformazioneApplicativaTipo()!=null && !"".equals(allarme.getGroupBy().getInformazioneApplicativaTipo())){
- // tipoChiaveGroupBy = TipoFiltroApplicativo.toEnumConstant(allarme.getGroupBy().getInformazioneApplicativaTipo());
- // }
- // if(tipoChiaveGroupBy==null){
- // tipoChiaveGroupBy = TipoFiltroApplicativo.toEnumConstant(ConfigurazioneCostanti.ALLARMI_GROUPBY_PER_CHIAVE_TIPO_DEFAULT);
- // }
- //
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_TIPO);
- // de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_TIPO);
- // de.setValues(TipoFiltroApplicativo.toStringArray());
- // de.setLabels(ConfigurazioneCostanti.LABEL_RATE_LIMITING_FILTRO_APPLICATIVO);
- // de.setSelected(allarme.getGroupBy().getInformazioneApplicativaTipo());
- // de.setValue(allarme.getGroupBy().getInformazioneApplicativaTipo());
- // de.setType(DataElementType.SELECT);
- // de.setPostBack_viaPOST(true);
- // dati.add(de);
- //
- // de = new DataElement();
- // de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_GROUPBY_PER_CHIAVE_NOME);
- // de.setLabel(this.getLabelTipoInformazioneApplicativaGroupBy(allarme.getGroupBy().getInformazioneApplicativaTipo()));
- // de.setValue(allarme.getGroupBy().getInformazioneApplicativaNome());
- // if(tipoChiaveGroupBy==null ||
- // TipoFiltroApplicativo.SOAPACTION_BASED.equals(tipoChiaveGroupBy) ||
- // TipoFiltroApplicativo.INDIRIZZO_IP.equals(tipoChiaveGroupBy) ||
- // TipoFiltroApplicativo.INDIRIZZO_IP_FORWARDED.equals(tipoChiaveGroupBy)){
- // de.setType(DataElementType.HIDDEN);
- // }
- // else if(TipoFiltroApplicativo.URLBASED.equals(tipoChiaveGroupBy) ||
- // TipoFiltroApplicativo.CONTENT_BASED.equals(tipoChiaveGroupBy)) {
- // de.setRequired(true);
- // de.setType(DataElementType.TEXT_AREA);
- // }
- // else{
- // de.setRequired(true);
- // de.setType(DataElementType.TEXT_EDIT);
- // }
- // dati.add(de);
- // }
- //
- // }
- }
- }
-
- public String toStringCompactAllarmeFilter(AllarmeFiltro filtro, RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding) throws Exception {
-
- boolean delegata = false;
- boolean applicativa = false;
- boolean configurazione = false;
- if(ruoloPorta!=null) {
- if(RuoloPorta.DELEGATA.equals(ruoloPorta)) {
- delegata = (nomePorta!=null);
- }
- else if(RuoloPorta.APPLICATIVA.equals(ruoloPorta)) {
- applicativa = (nomePorta!=null);
- }
- }
- configurazione = !delegata && !applicativa;
-
- StringBuilder bf = new StringBuilder("");
- if(filtro.isEnabled()){
- if(configurazione) {
- if( (filtro.getRuoloPorta()!=null && !RuoloPorta.ENTRAMBI.equals(filtro.getRuoloPorta())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- if(RuoloPorta.DELEGATA.equals(filtro.getRuoloPorta())){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD).append(": ");
- bf.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUOLO_PORTA_DELEGATA);
- }
- else if(RuoloPorta.APPLICATIVA.equals(filtro.getRuoloPorta())){
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_PDD).append(": ");
- bf.append(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_RUOLO_PORTA_APPLICATIVA);
- }
- }
- }
- if(configurazione) {
- if( !(filtro.getProtocollo()==null || "".equals(filtro.getProtocollo())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(CostantiControlStation.LABEL_PARAMETRO_PROTOCOLLO_COMPACT+": ");
- bf.append(this.getLabelProtocollo(filtro.getProtocollo()));
- }
- }
-
- if(configurazione) {
- if( !(filtro.getNomePorta()==null || "".equals(filtro.getNomePorta())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_PORTA).append(": ");
- bf.append(filtro.getNomePorta());
- }
- }
-
- if(configurazione) {
- if(filtro.getRuoloErogatore()!=null) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_EROGATORE).append(": ");
- bf.append(filtro.getRuoloErogatore());
- }
- else if( !( (filtro.getTipoErogatore()==null || "".equals(filtro.getTipoErogatore()))
- ||
- (filtro.getNomeErogatore()==null || "".equals(filtro.getNomeErogatore())) ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_EROGATORE_COMPACT).append(": ");
- IDSoggetto idSoggetto = new IDSoggetto(filtro.getTipoErogatore(), filtro.getNomeErogatore());
- bf.append(this.getLabelNomeSoggetto(idSoggetto));
- }
- }
- if(configurazione) {
- if( !(filtro.getTag()==null || "".equals(filtro.getTag())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_TAG).append(": ");
- bf.append(filtro.getTag());
- }
- }
-
- if(configurazione) {
- if( !( (filtro.getTipoServizio()==null || "".equals(filtro.getTipoServizio()))
- ||
- (filtro.getNomeServizio()==null || "".equals(filtro.getNomeServizio()))
- ||
- (filtro.getVersioneServizio()==null)
- ||
- (filtro.getTipoErogatore()==null || "".equals(filtro.getTipoErogatore()))
- ||
- (filtro.getNomeErogatore()==null || "".equals(filtro.getNomeErogatore()))
- ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SERVIZIO).append(": ");
- IDServizio idServizio = IDServizioFactory.getInstance().getIDServizioFromValues(filtro.getTipoServizio(), filtro.getNomeServizio(),
- filtro.getTipoErogatore(), filtro.getNomeErogatore(),
- filtro.getVersioneServizio());
- bf.append(this.getLabelIdServizio(idServizio));
- }
- }
-
- if( !(filtro.getAzione()==null || "".equals(filtro.getAzione())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(this.getLabelAzione(serviceBinding)).append(": ");
- bf.append(filtro.getAzione());
- }
-
- if(configurazione || applicativa) {
- if(filtro.getRuoloFruitore()!=null) {
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_RUOLO_FRUITORE).append(": ");
- bf.append(filtro.getRuoloFruitore());
- }
- else if( !( (filtro.getTipoFruitore()==null || "".equals(filtro.getTipoFruitore()))
- ||
- (filtro.getNomeFruitore()==null || "".equals(filtro.getNomeFruitore())) ) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_FRUITORE_COMPACT).append(": ");
- IDSoggetto idSoggetto = new IDSoggetto(filtro.getTipoFruitore(), filtro.getNomeFruitore());
- bf.append(this.getLabelNomeSoggetto(idSoggetto));
- }
- }
- if(configurazione || delegata) {
- if( !(filtro.getServizioApplicativoFruitore()==null || "".equals(filtro.getServizioApplicativoFruitore())) ){
- if(bf.length()>0){
- bf.append(", ");
- }
- bf.append(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_FILTRO_SA_FRUITORE_COMPACT).append(": ");
- bf.append(filtro.getServizioApplicativoFruitore());
- }
- }
-
- }
- else{
- bf.append(CostantiControlStation.LABEL_STATO_DISABILITATO);
- }
- if(bf.length()<=0 && (delegata || applicativa)) {
- bf.append(CostantiControlStation.LABEL_STATO_DISABILITATO);
- }
-
- return bf.toString();
- }
-
- public void savePluginIntoSession(HttpServletRequest request, HttpSession session, Plugin plugin){
- ServletUtils.setObjectIntoSession(request, session, plugin, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PLUGIN);
- }
-
- public void removePluginFromSession(HttpServletRequest request, HttpSession session){
- ServletUtils.removeObjectFromSession(request, session, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PLUGIN);
- }
- public Plugin readPluginFromSession(HttpServletRequest request, HttpSession session){
- return ServletUtils.getObjectFromSession(request, session, Plugin.class, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PLUGIN);
- }
-
- public void saveParametriIntoSession(HttpServletRequest request, HttpSession session, List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> parameters){
- ServletUtils.setObjectIntoSession(request, session, parameters, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PARAMETRI );
- }
-
- public void removeParametriFromSession(HttpServletRequest request, HttpSession session){
- ServletUtils.removeObjectFromSession(request, session, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PARAMETRI);
- }
- @SuppressWarnings("unchecked")
- public List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>> readParametriFromSession(HttpServletRequest request, HttpSession session){
- Object obj = ServletUtils.getObjectFromSession(request, session, ConfigurazioneCostanti.SESSION_PARAMETRO_OLD_PARAMETRI);
- if(obj == null)
- return null;
- return (List<org.openspcoop2.monitor.sdk.parameters.Parameter<?>>) obj;
- }
-
-
- public void prepareAllarmiHistoryList(ConsoleSearch ricerca, List<ConfigurazioneAllarmeHistoryBean> lista, ConfigurazioneAllarmeBean allarme,
- RuoloPorta ruoloPorta, String nomePorta, ServiceBinding serviceBinding) throws Exception{
- try {
-
- List<Parameter> lstParAllarme = new ArrayList<>();
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_RUOLO_PORTA, ruoloPorta.getValue());
- lstParAllarme.add(parRuoloPorta);
- }
- Parameter parNomePorta = null;
- if(nomePorta!=null) {
- parNomePorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_NOME_PORTA, nomePorta);
- lstParAllarme.add(parNomePorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_SERVICE_BINDING, serviceBinding.name());
- lstParAllarme.add(parServiceBinding);
- }
-
- ServletUtils.addListElementIntoSession(this.request, this.session, ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_ALLARMI_HISTORY);
- int idLista = Liste.CONFIGURAZIONE_ALLARMI_HISTORY;
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
-
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALLARMI_ID_ALLARME, allarme.getId() + "");
- lstParAllarme.add(pId);
-
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
- ServletUtils.disabledPageDataSearch(this.pd);
-
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- lstParamPorta = getTitleListAllarmi(ruoloPorta, nomePorta, serviceBinding, allarme.getNome());
- }
-
- // setto la barra del titolo
- List<Parameter> lstParam = null;
- if(lstParamPorta!=null) {
- lstParam = lstParamPorta;
- lstParam.set((lstParam.size() -1),
- new Parameter(allarme.getNome(), ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParAllarme.toArray(new Parameter[lstParAllarme.size()])));
-
- } else {
- lstParam = new ArrayList<>();
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_ALLARMI, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_LIST));
- lstParam.add(new Parameter(allarme.getNome(), ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_ALLARMI_CHANGE, lstParAllarme.toArray(new Parameter[lstParAllarme.size()])));
- }
- lstParam.add(new Parameter(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ARCHIVIO_STATI, null));
-
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DATA_AGGIORNAMENTO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGED);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_DETTAGLIO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_ALLARMI_UTENTE);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
-
-
- if (lista != null) {
- Iterator<ConfigurazioneAllarmeHistoryBean> it = lista.iterator();
-
- while (it.hasNext()) {
- ConfigurazioneAllarmeHistoryBean entry = it.next();
-
- List<DataElement> e = new ArrayList<>();
-
- // Data Aggiornamento
- DataElement de = new DataElement();
- Date timestampUpdate = entry.getTimestampUpdate();
-
- String dataValue = DateUtils.getSimpleDateFormat(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_PLUGINS_ARCHIVI_FORMATO_DATA).format(timestampUpdate);
- de.setToolTip(dataValue);
- de.setValue(dataValue);
- e.add(de);
-
- // Abilitato
- de = new DataElement();
- de.setWidthPx(10);
- if(entry.getEnabled() == 1){
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO_SI);
- }
- else{
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ABILITATO_NO);
- }
- e.add(de);
-
- // Stato
- de = new DataElement();
-
- if(entry.getEnabled() == 1) {
- if(entry.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_OK.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_OK);
- } else if(entry.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_ERROR.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_ERROR);
- } else if(entry.getStato()!=null && (allarme.getStato().intValue() == ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_STATO_WARNING.intValue())) {
- de.setToolTip(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- de.setValue(ConfigurazioneCostanti.CONFIGURAZIONE_ALLARME_LABEL_STATO_WARNING);
- }
- } else {
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- }
-
- e.add(de);
-
- // ack
- de = new DataElement();
- // de.setWidthPx(10);
- if(entry.getAcknowledged() == 1){
- de.setToolTip(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_SI);
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_SI);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_NO);
- de.setValue(ConfigurazioneCostanti.LABEL_VALUE_PARAMETRO_CONFIGURAZIONE_ALLARMI_ACKNOWLEDGE_NO);
- }
- e.add(de);
-
- // dettaglio
- de = new DataElement();
- de.setValue(entry.getDettaglioStatoAbbr());
- de.setToolTip(entry.getDettaglioStatoHtmlEscaped());
- e.add(de);
-
- // utente
- de = new DataElement();
- de.setValue(entry.getUtente());
- de.setToolTip(entry.getUtente());
- e.add(de);
-
- dati.add(e);
- }
- }
-
- this.pd.setDati(dati);
- this.pd.setAddButton(false);
- this.pd.setRemoveButton(false);
- this.pd.setSelect(false);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
-
- public void prepareHandlersRichiestaList(ConsoleSearch ricerca, List<ConfigurazioneHandlerBean> lista, TipoPdD ruoloPorta, String idPortaS, ServiceBinding serviceBinding, String tipologia) throws Exception {
- String objectName = ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_HANDLERS_RICHIESTA;
- String servletListURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RICHIESTA_LIST;
- String servletChangeURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RICHIESTA_CHANGE;
- String labelHandler = getLabelTipologiaFromFaseMessageHandler(tipologia,true);
- String labelHandlerDi = labelHandler + " di ";
-
- int idLista = Liste.CONFIGURAZIONE_HANDLERS_RICHIESTA;
- String searchLabel = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_LABEL;
-
- prepareHandlersList(ricerca, lista, ruoloPorta, idPortaS, serviceBinding, tipologia, objectName, servletListURL, servletChangeURL, labelHandler, labelHandlerDi, idLista, searchLabel);
- }
-
- public void prepareHandlersRispostaList(ConsoleSearch ricerca, List<ConfigurazioneHandlerBean> lista, TipoPdD ruoloPorta, String idPortaS, ServiceBinding serviceBinding, String tipologia) throws Exception {
- String objectName = ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_HANDLERS_RISPOSTA;
- String servletListURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RISPOSTA_LIST;
- String servletChangeURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_RISPOSTA_CHANGE;
- String labelHandler = getLabelTipologiaFromFaseMessageHandler(tipologia,false);
- String labelHandlerDi = labelHandler + " di ";
-
- int idLista = Liste.CONFIGURAZIONE_HANDLERS_RISPOSTA;
- String searchLabel = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_LABEL;
-
- prepareHandlersList(ricerca, lista, ruoloPorta, idPortaS, serviceBinding, tipologia, objectName, servletListURL, servletChangeURL, labelHandler, labelHandlerDi, idLista, searchLabel);
- }
-
- public void prepareHandlersServizioList(ConsoleSearch ricerca, List<ConfigurazioneHandlerBean> lista, TipoPdD ruoloPorta, String idPortaS, ServiceBinding serviceBinding, String tipologia) throws Exception {
- String objectName = ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_HANDLERS_SERVIZIO;
- String servletListURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_SERVIZIO_LIST;
- String servletChangeURL = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_HANDLERS_SERVIZIO_CHANGE;
- String labelHandler = getLabelTipologiaFromFaseServiceHandler(tipologia);
- String labelHandlerDi = labelHandler + " di ";
-
- int idLista = Liste.CONFIGURAZIONE_HANDLERS_SERVIZIO;
- String searchLabel = ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_LABEL;
-
- prepareHandlersList(ricerca, lista, ruoloPorta, idPortaS, serviceBinding, tipologia, objectName, servletListURL, servletChangeURL, labelHandler, labelHandlerDi, idLista, searchLabel);
- }
-
-
- private void prepareHandlersList(ConsoleSearch ricerca, List<ConfigurazioneHandlerBean> lista, TipoPdD ruoloPorta,
- String idPortaS, ServiceBinding serviceBinding, String tipologia, String objectName, String servletListURL,
- String servletChangeURL, String labelHandler, String labelHandlerDi, int idLista, String searchLabel)
- throws Exception {
- try {
- List<Parameter> lstParamSession = new ArrayList<>();
- Parameter parRuoloPorta = null;
- if(ruoloPorta!=null) {
- parRuoloPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_RUOLO_PORTA, ruoloPorta.getTipo());
- lstParamSession.add(parRuoloPorta);
- }
- Parameter parIdPorta = null;
- if(idPortaS!=null) {
- parIdPorta = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_PORTA, idPortaS);
- lstParamSession.add(parIdPorta);
- }
- Parameter parServiceBinding = null;
- if(serviceBinding!=null) {
- parServiceBinding = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_SERVICE_BINDING, serviceBinding.name());
- lstParamSession.add(parServiceBinding);
- }
- Parameter parTipologia = null;
- if(tipologia!=null) {
- parTipologia = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, tipologia);
- lstParamSession.add(parTipologia);
- }
-
- ServletUtils.addListElementIntoSession(this.request, this.session, objectName, lstParamSession);
-
- int limit = ricerca.getPageSize(idLista);
- int offset = ricerca.getIndexIniziale(idLista);
- String search = ServletUtils.getSearchFromSession(ricerca, idLista);
- this.pd.setIndex(offset);
- this.pd.setPageSize(limit);
- this.pd.setNumEntries(ricerca.getNumEntries(idLista));
-
-
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- lstParamPorta = getTitleListHandler(tipologia, ruoloPorta, idPortaS, serviceBinding, null, servletListURL, labelHandlerDi, labelHandler);
- }
-
-
- this.pd.setSearchLabel(searchLabel);
-
- if(search.equals("")){
- this.pd.setSearchDescription("");
- }
- // setto la barra del titolo
- List<Parameter> lstParam = null;
- if(lstParamPorta!=null) {
- lstParam = lstParamPorta;
- } else {
- lstParam = new ArrayList<>();
- lstParam.add(new Parameter(labelHandler, null));
- }
-
- if(ruoloPorta == null) {
- lstParam.add(0,new Parameter(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE));
- }
-
- if(!search.equals("")){
- if(lstParamSession.size() > 0) {
- lstParam.set((lstParam.size() -1), new Parameter(labelHandler, servletListURL, lstParamSession.toArray(new Parameter[lstParamSession.size()])));
- } else {
- lstParam.set((lstParam.size() -1), new Parameter(labelHandler, servletListURL));
- }
- lstParam.add(new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
- }
-
- ServletUtils.setPageDataTitle(this.pd, lstParam);
-
- if(ruoloPorta!=null) {
- this.impostaComandiMenuContestualeHandler(ruoloPorta, idPortaS);
- }
-
- // controllo eventuali risultati ricerca
- if (!search.equals("")) {
- ServletUtils.enabledPageDataSearch(this.pd, labelHandler, search);
- }
-
- // setto le label delle colonne
- List<String> lstLabels = new ArrayList<>();
- if(lista != null && lista.size() > 1)
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_POSIZIONE);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_STATO);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_LABEL);
- lstLabels.add(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_DESCRIZIONE);
- this.pd.setLabels(lstLabels.toArray(new String [lstLabels.size()]));
- // preparo i dati
- List<List<DataElement>> dati = new ArrayList<>();
- if (lista != null) {
- Iterator<ConfigurazioneHandlerBean> it = lista.iterator();
- int numeroElementi = lista.size();
- int i = 0;
- while (it.hasNext()) {
- ConfigurazioneHandlerBean handler = it.next();
-
- Parameter pId = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_HANDLER, handler.getId() + "");
- List<Parameter> lstParamEntry = new ArrayList<>();
- lstParamEntry.add(pId);
- if(lstParamSession.size() > 0) {
- lstParamEntry.addAll(lstParamSession);
- }
-
- List<DataElement> e = new ArrayList<>();
-
- // Posizione
- if(lista.size() > 1) {
- DataElement de = new DataElement();
- de.setWidthPx(48);
- de.setType(DataElementType.IMAGE);
- DataElementImage imageUp = new DataElementImage();
- Parameter pDirezioneSu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SU);
- Parameter pDirezioneGiu = new Parameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_POSIZIONE,
- CostantiControlStation.VALUE_PARAMETRO_CONFIGURAZIONE_POSIZIONE_GIU);
-
- List<Parameter> lstParamDirezioneSu = new ArrayList<>();
- lstParamDirezioneSu.addAll(lstParamEntry);
- lstParamDirezioneSu.add(pDirezioneSu);
- List<Parameter> lstParamDirezioneGiu = new ArrayList<>();
- lstParamDirezioneGiu.addAll(lstParamEntry);
- lstParamDirezioneGiu.add(pDirezioneGiu);
-
- if(i > 0) {
- imageUp.setImage(CostantiControlStation.ICONA_FRECCIA_SU);
- imageUp.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_SU);
- imageUp.setUrl(servletListURL, lstParamDirezioneSu.toArray(new Parameter[lstParamDirezioneSu.size()]));
- }
- else {
- imageUp.setImage(CostantiControlStation.ICONA_PLACEHOLDER);
- }
- de.addImage(imageUp);
-
- if(i < numeroElementi -1) {
- DataElementImage imageDown = new DataElementImage();
- imageDown.setImage(CostantiControlStation.ICONA_FRECCIA_GIU);
- imageDown.setToolTip(CostantiControlStation.LABEL_PARAMETRO_CONFIGURAZIONE_POSIZIONE_SPOSTA_GIU);
- imageDown.setUrl(servletListURL, lstParamDirezioneGiu.toArray(new Parameter[lstParamDirezioneGiu.size()]));
- de.addImage(imageDown);
- }
- de.setValue(handler.getPosizione()+"");
- e.add(de);
- }
-
- // Stato
- DataElement de = new DataElement();
- de.setWidthPx(10);
- de.setType(DataElementType.CHECKBOX);
- if(handler.getStato()==null // backward compatibility
- ||
- StatoFunzionalita.ABILITATO.equals(handler.getStato())){
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_ABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_ENABLE);
- }
- else{
- de.setToolTip(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setValue(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_STATO_DISABILITATO);
- de.setSelected(CheckboxStatusType.CONFIG_DISABLE);
- }
- e.add(de);
-
-
- // label
- de = new DataElement();
- de.setIdToRemove(handler.getTipo());
- de.setValue(handler.getNome());
- de.setToolTip(handler.getNome());
- de.setUrl(servletChangeURL, lstParamEntry.toArray(new Parameter[lstParamEntry.size()]));
- e.add(de);
- // descrizione
- de = new DataElement();
- de.setValue(handler.getDescrizioneAbbr());
- de.setToolTip(handler.getDescrizione());
- e.add(de);
-
- dati.add(e);
- i++;
- }
- }
-
- this.pd.setDati(dati);
- this.pd.setAddButton(true);
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
-
- public List<Parameter> getTitleListHandler(String tipologia, TipoPdD ruoloPorta, String idPortaS, ServiceBinding serviceBinding, String nomeOggetto,
- String servletURL, String labelHandlerDi, String labelHandler) throws Exception{
- List<Parameter> lstParamPorta = null;
- if(ruoloPorta!=null) {
- Long idPorta = Long.parseLong(idPortaS);
- String labelPerPorta = null;
- if(TipoPdD.DELEGATA.equals(ruoloPorta)) {
- // prelevo il flag che mi dice da quale pagina ho acceduto la sezione delle porte delegate
- Integer parentPD = ServletUtils.getIntegerAttributeFromSession(PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT, this.session, this.request);
- if(parentPD == null) parentPD = PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_NONE;
-
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPorta);
- String idporta = myPD.getNome();
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- lstParamPorta = porteDelegateHelper.getTitoloPD(parentPD,idSoggetto +"", idAsps+"", idFruizione+"");
-
- String labelOpzioniAvanzate = null;
- if(parentPD!=null && (parentPD.intValue() == PorteDelegateCostanti.ATTRIBUTO_PORTE_DELEGATE_PARENT_CONFIGURAZIONE)) {
- labelOpzioniAvanzate = this.porteDelegateCore.getLabelRegolaMappingFruizionePortaDelegata(
- PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_OPZIONI_AVANZATE_DI,
- PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_OPZIONI_AVANZATE,
- myPD);
- }
- else {
- labelOpzioniAvanzate = PorteDelegateCostanti.LABEL_PARAMETRO_PORTE_DELEGATE_OPZIONI_AVANZATE_DI+idporta;
- }
-
- Parameter pIdPD = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID, "" + myPD.getId());
- Parameter pNomePD = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_NOME_PORTA, myPD.getNome());
- Parameter pIdSoggPD = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_SOGGETTO, myPD.getIdSoggetto() + "");
- Parameter pConfigurazioneAltroPorta = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_CONFIGURAZIONE_ALTRO_PORTA, Costanti.CHECK_BOX_ENABLED_TRUE);
- Parameter pIdAsps = new Parameter(PorteDelegateCostanti.PARAMETRO_PORTE_DELEGATE_ID_ASPS, idAsps+"");
- Parameter pIdFruitore = new Parameter(AccordiServizioParteSpecificaCostanti.PARAMETRO_APS_MY_ID, idFruizione+ "");
- // link alle opzioni avanzate
- lstParamPorta.add(new Parameter(labelOpzioniAvanzate, PorteDelegateCostanti.SERVLET_NAME_PORTE_DELEGATE_CHANGE,
- pIdPD,pNomePD,pIdSoggPD, pIdAsps, pIdFruitore, pConfigurazioneAltroPorta));
-
- labelPerPorta = labelHandler;
- }
- else {
- Integer parentPA = ServletUtils.getIntegerAttributeFromSession(PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT, this.session, this.request);
-
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPorta);
- String idporta = myPA.getNome();
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- lstParamPorta = porteApplicativeHelper.getTitoloPA(parentPA, idSoggetto+"", idAsps+"");
-
- String labelOpzioniAvanzate = null;
- if(parentPA!=null && (parentPA.intValue() == PorteApplicativeCostanti.ATTRIBUTO_PORTE_APPLICATIVE_PARENT_CONFIGURAZIONE)) {
- labelOpzioniAvanzate = this.porteApplicativeCore.getLabelRegolaMappingErogazionePortaApplicativa(
- PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_OPZIONI_AVANZATE_DI,
- PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_OPZIONI_AVANZATE,
- myPA);
- }
- else {
- labelOpzioniAvanzate = PorteApplicativeCostanti.LABEL_PARAMETRO_PORTE_APPLICATIVE_OPZIONI_AVANZATE_DI+idporta;
- }
-
- // link alle opzioni avanzate
- Parameter pNomePorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_NOME_PORTA, myPA.getNome());
- Parameter pIdSogg = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_SOGGETTO, idSoggetto + "");
- Parameter pIdPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID, ""+idPorta);
- Parameter pIdAsps = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_ID_ASPS, idAsps+"");
- Parameter pConfigurazioneAltroPorta = new Parameter(PorteApplicativeCostanti.PARAMETRO_PORTE_APPLICATIVE_CONFIGURAZIONE_ALTRO_PORTA, Costanti.CHECK_BOX_ENABLED_TRUE);
- lstParamPorta.add(new Parameter(labelOpzioniAvanzate, PorteApplicativeCostanti.SERVLET_NAME_PORTE_APPLICATIVE_CHANGE,
- pIdSogg, pNomePorta, pIdPorta,pIdAsps,pConfigurazioneAltroPorta));
-
- labelPerPorta = labelHandler;
- }
-
- if(nomeOggetto==null) {
- lstParamPorta.add(new Parameter(labelPerPorta,null));
- }
- else {
- List<Parameter> list = new ArrayList<>();
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE, tipologia));
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_RUOLO_PORTA, ruoloPorta.getTipo()));
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_PORTA, idPortaS));
- if(serviceBinding!=null) {
- list.add(new Parameter( ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_SERVICE_BINDING,serviceBinding.name()));
- }
- lstParamPorta.add(new Parameter(labelPerPorta, servletURL, list));
- lstParamPorta.add(new Parameter(nomeOggetto,null));
- }
- }
-
- return lstParamPorta;
- }
-
- public void impostaComandiMenuContestualeHandler(TipoPdD ruoloPorta, String idPortaS) throws Exception{
-
- if(ruoloPorta!=null) {
- Long idPorta = Long.parseLong(idPortaS);
- if(TipoPdD.DELEGATA.equals(ruoloPorta)) {
- PortaDelegata myPD = this.porteDelegateCore.getPortaDelegata(idPorta);
-
- MappingFruizionePortaDelegata mappingPD = this.porteDelegateCore.getMappingFruizionePortaDelegata(myPD);
- long idSoggetto = myPD.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPD.getIdServizio());
- long idFruizione = this.apsCore.getIdFruizioneAccordoServizioParteSpecifica(mappingPD.getIdFruitore(),mappingPD.getIdServizio());
-
- PorteDelegateHelper porteDelegateHelper = new PorteDelegateHelper(this.request, this.pd, this.session);
- porteDelegateHelper.impostaComandiMenuContestualePD(idSoggetto +"", idAsps+"", idFruizione+"");
- }
- else {
- PortaApplicativa myPA = this.porteApplicativeCore.getPortaApplicativa(idPorta);
-
- MappingErogazionePortaApplicativa mappingPA = this.porteApplicativeCore.getMappingErogazionePortaApplicativa(myPA);
- long idSoggetto = myPA.getIdSoggetto().longValue();
- long idAsps = this.apsCore.getIdAccordoServizioParteSpecifica(mappingPA.getIdServizio());
-
- PorteApplicativeHelper porteApplicativeHelper = new PorteApplicativeHelper(this.request, this.pd, this.session);
- porteApplicativeHelper.impostaComandiMenuContestualePA(idSoggetto+"", idAsps+"");
- }
- }
- }
-
- public String getLabelTipologiaFromFaseMessageHandler(String fase, boolean request) {
- if(fase != null) {
- return getLabelTipologiaFromFaseMessageHandler(FaseMessageHandler.toEnumConstant(fase), request);
- }
- return null;
- }
- public String getLabelTipologiaFromFaseMessageHandler(FaseMessageHandler fase, boolean request) {
- if(fase != null) {
- String prefix = request ? ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_RICHIESTA_TITOLO : ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_RISPOSTA_TITOLO;
-
- switch (fase) {
- case IN:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_SHORT);
- case IN_PROTOCOL_INFO:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_IN_PROTOCOL_INFO_SHORT);
- case OUT:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_OUT_SHORT);
- case POST_OUT:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_POST_OUT_SHORT);
- case PRE_IN:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_LABEL_PRE_IN_SHORT);
- }
- }
-
- return null;
- }
-
- public String getLabelTipologiaFromFaseServiceHandler(String fase) {
- if(fase != null) {
- return getLabelTipologiaFromFaseServiceHandler(FaseServiceHandler.toEnumConstant(fase));
- }
- return null;
- }
- public String getLabelTipologiaFromFaseServiceHandler(FaseServiceHandler fase) {
- if(fase != null) {
- String prefix = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_SERVIZIO_TITOLO;
- switch (fase) {
- case EXIT:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_EXIT);
- case INIT:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_INIT);
- case INTEGRATION_MANAGER_REQUEST:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_INTEGRATION_MANAGER_REQUEST);
- case INTEGRATION_MANAGER_RESPONSE:
- return MessageFormat.format(prefix, PluginCostanti.FILTRO_SERVICE_HANDLER_LABEL_INTEGRATION_MANAGER_RESPONSE);
- }
- }
-
- return null;
- }
- public void addHandlerRichiestaToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String idHandlerS, String nomePlugin,
- String stato,TipoPdD ruoloPorta, String idPortaS,
- ServiceBinding serviceBinding, String fase, List<String> tipiPluginGiaUtilizzati, String messaggioValoriNonDisponibili) throws Exception{
- this.addHandlerToDati(dati, tipoOperazione, idHandlerS, nomePlugin, stato, ruoloPorta, idPortaS,
- serviceBinding, fase, PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_VALORE_RICHIESTA, TipoPlugin.MESSAGE_HANDLER, tipiPluginGiaUtilizzati, messaggioValoriNonDisponibili);
- }
-
- public void addHandlerRispostaToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String idHandlerS, String nomePlugin,
- String stato, TipoPdD ruoloPorta, String idPortaS,
- ServiceBinding serviceBinding, String fase, List<String> tipiPluginGiaUtilizzati, String messaggioValoriNonDisponibili) throws Exception{
- this.addHandlerToDati(dati, tipoOperazione, idHandlerS, nomePlugin, stato, ruoloPorta, idPortaS,
- serviceBinding, fase, PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_VALORE_RISPOSTA, TipoPlugin.MESSAGE_HANDLER, tipiPluginGiaUtilizzati, messaggioValoriNonDisponibili);
- }
-
- public void addHandlerServizioToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String idHandlerS, String nomePlugin,
- String stato, TipoPdD ruoloPorta, String idPortaS,
- ServiceBinding serviceBinding, String fase, List<String> tipiPluginGiaUtilizzati, String messaggioValoriNonDisponibili) throws Exception{
- this.addHandlerToDati(dati, tipoOperazione, idHandlerS, nomePlugin, stato, ruoloPorta, idPortaS,
- serviceBinding, fase, null, TipoPlugin.SERVICE_HANDLER, tipiPluginGiaUtilizzati, messaggioValoriNonDisponibili);
- }
- public void addHandlerToDati(List<DataElement> dati, TipoOperazione tipoOperazione, String idHandlerS, String nomePlugin,
- String stato, TipoPdD ruoloPorta, String idPortaS,
- ServiceBinding serviceBinding, String fase, String ruoloHandler, TipoPlugin tipoPlugin, List<String> tipiPluginGiaUtilizzati, String messaggioValoriNonDisponibili) throws Exception{
-
- // boolean first = this.isFirstTimeFromHttpParameters(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FIRST_TIME);
- DataElement de;
-
- // id
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_HANDLER);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_HANDLER);
- de.setType(DataElementType.HIDDEN);
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- de.setValue("");
- } else {
- de.setValue(idHandlerS);
- }
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_RUOLO_PORTA);
- de.setValue(ruoloPorta!=null ? ruoloPorta.getTipo() : null);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_ID_PORTA);
- de.setValue(idPortaS);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- if(serviceBinding!=null) {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_SERVICE_BINDING);
- de.setValue(serviceBinding.name());
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
- }
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_FASE);
- de.setValue(fase);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- // Informazioni Generali
- de = new DataElement();
- de.setType(DataElementType.TITLE);
- de.setLabel(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_HANDLERS_INFORMAZIONI_GENERALI);
- dati.add(de);
-
- if(tipoOperazione.equals(TipoOperazione.ADD)) {
- // plugin select
- this.addCustomFieldConValoriDaEscludere(tipoPlugin, ruoloHandler, fase, "", ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_PLUGIN, GruppoIntegrazione.PLUGIN.getCompactLabel(),
- nomePlugin, false, dati, false, tipiPluginGiaUtilizzati, messaggioValoriNonDisponibili);
- } else {
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_PLUGIN);
- de.setValue(nomePlugin);
- de.setType(DataElementType.HIDDEN);
- dati.add(de);
-
- de = new DataElement();
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_PLUGIN + "txt");
- de.setValue(nomePlugin);
- de.setType(DataElementType.TEXT);
- de.setLabel(GruppoIntegrazione.PLUGIN.getCompactLabel());
- dati.add(de);
-
- }
- // stato
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_STATO);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_HANDLERS_STATO);
- de.setType(DataElementType.SELECT);
- String [] statoValues = CostantiControlStation.SELECT_VALUES_STATO_FUNZIONALITA;
- de.setSelected(stato);
- de.setLabels(statoValues);
- de.setValues(statoValues);
- dati.add(de);
-
- }
- public boolean handlerRichiestaCheckData(TipoOperazione tipoOp, ConfigurazioneHandlerBean oldHandler, String nomePlugin, String stato,
- TipoPdD ruoloPorta, Long idPorta, String fase, String tipo, String messaggioHandlerRichiestaDuplicato) throws Exception{
- return handlerCheckData(tipoOp, oldHandler, nomePlugin, stato, ruoloPorta, idPorta, fase, tipo, messaggioHandlerRichiestaDuplicato);
- }
-
- public boolean handlerRispostaCheckData(TipoOperazione tipoOp, ConfigurazioneHandlerBean oldHandler, String nomePlugin, String stato,
- TipoPdD ruoloPorta, Long idPorta, String fase, String tipo, String messaggioHandlerRichiestaDuplicato) throws Exception{
- return handlerCheckData(tipoOp, oldHandler, nomePlugin, stato, ruoloPorta, idPorta, fase, tipo, messaggioHandlerRichiestaDuplicato);
- }
-
- public boolean handlerServizioCheckData(TipoOperazione tipoOp, ConfigurazioneHandlerBean oldHandler, String nomePlugin, String stato,
- TipoPdD ruoloPorta, Long idPorta, String fase, String tipo, String messaggioHandlerRichiestaDuplicato) throws Exception{
- return handlerCheckData(tipoOp, oldHandler, nomePlugin, stato, ruoloPorta, idPorta, fase, tipo, messaggioHandlerRichiestaDuplicato);
- }
-
- private boolean handlerCheckData(TipoOperazione tipoOp, ConfigurazioneHandlerBean oldHandler, String nomePlugin, String stato,
- TipoPdD ruoloPorta, Long idPorta, String fase, String tipo, String messaggioHandlerRichiestaDuplicato) throws Exception{
- try {
-
- /* ******** CONTROLLO PLUGIN *************** */
-
- if(nomePlugin == null || nomePlugin.equals(CostantiControlStation.PARAMETRO_TIPO_PERSONALIZZATO_VALORE_UNDEFINED)) {
- this.pd.setMessage("Indicare un valore nel campo '"+GruppoIntegrazione.PLUGIN.getCompactLabel()+"'");
- return false;
- }
-
- // stato
- if(stato == null) {
- this.pd.setMessage("Indicare un valore nel campo '"+ConfigurazioneCostanti.LABEL_PARAMETRO_CONFIGURAZIONE_HANDLERS_STATO+"'");
- return false;
- }
-
- // altri parametri
- boolean existsHandler = this.confCore.existsHandlerRichiesta(fase, ruoloPorta, idPorta, tipo);
- // controllo esistenza handler con lo stesso nome
- if (tipoOp.equals(TipoOperazione.ADD)) {
- if (existsHandler) {
- this.pd.setMessage(messaggioHandlerRichiestaDuplicato);
- return false;
- }
- }
-
- return true;
- } catch (Exception e) {
- this.logError("Exception: " + e.getMessage(), e);
- throw new DriverControlStationException(e);
- }
- }
- public void updateHandler(ConfigurazioneHandler handlerDestinazione, ConfigurazioneHandler handlerSorgente,
- TipoOperazione tipoOperazione) {
- handlerDestinazione.setPosizione(handlerSorgente.getPosizione());
- handlerDestinazione.setStato(handlerSorgente.getStato());
- handlerDestinazione.setTipo(handlerSorgente.getTipo());
- //handlerDestinazione.setId(handlerSorgente.getId());
- }
-
- public void addDescrizioneVerificaConnettivitaToDati(List<DataElement> dati, GenericProperties genericProperties,
- String server, boolean registro, String aliasConnettore) throws Exception {
-
- List<Connettore> l = ConnettoreCheck.convertPolicyToConnettore(genericProperties, this.log);
- if(l!=null && !l.isEmpty()) {
- for (Connettore connettore : l) {
-
- String tipo = ConnettoreCheck.getPropertyValue(connettore, ConnettoreCheck.POLICY_TIPO_ENDPOINT);
-
- List<Parameter> downloadCertServerParameters = new ArrayList<>();
-
- downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_TOKEN_NOME, genericProperties.getNome()));
- downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_TOKEN_TIPOLOGIA, genericProperties.getTipologia()));
- downloadCertServerParameters.add(new Parameter(ArchiviCostanti.PARAMETRO_ARCHIVI_CERTIFICATI_SERVER_TOKEN_TIPO, tipo!=null ? tipo : ""));
-
- this.addDescrizioneVerificaConnettivitaToDati(dati, connettore,
- server, registro, aliasConnettore,
- downloadCertServerParameters,
- true, true);
-
- }
- }
-
- }
- public List<DataElement> addTokenPolicyHiddenToDati(List<DataElement> dati, String id, String infoType) {
-
- DataElement de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID);
- de.setValue(id);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTORE_POLICY_TOKEN_ID);
- dati.add(de);
-
- de = new DataElement();
- de.setLabel(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- de.setValue(infoType);
- de.setType(DataElementType.HIDDEN);
- de.setName(ConfigurazioneCostanti.PARAMETRO_TOKEN_POLICY_TIPOLOGIA_INFORMAZIONE);
- dati.add(de);
-
- return dati;
- }
-
- public void addVisualizzaRuntimeButton(List<DataElement> e, String servletName, List<Parameter> parameters) {
- this.addAzioneButton(e, DataElementType.IMAGE,
- ConfigurazioneCostanti.ICONA_VISUALIZZA_RUNTIME_ALLARME_TOOLTIP,
- ConfigurazioneCostanti.ICONA_VISUALIZZA_RUNTIME_ALLARME, servletName,parameters);
- }
- }