ScopeHelper.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.web.ctrlstat.servlet.scope;

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

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

  27. import org.apache.commons.lang.StringUtils;
  28. import org.openspcoop2.core.commons.Filtri;
  29. import org.openspcoop2.core.commons.ISearch;
  30. import org.openspcoop2.core.commons.Liste;
  31. import org.openspcoop2.core.commons.SearchUtils;
  32. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  33. import org.openspcoop2.core.registry.Scope;
  34. import org.openspcoop2.core.registry.constants.ScopeContesto;
  35. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  36. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  37. import org.openspcoop2.web.ctrlstat.costanti.InUsoType;
  38. import org.openspcoop2.web.ctrlstat.servlet.ConsoleHelper;
  39. import org.openspcoop2.web.ctrlstat.servlet.archivi.ExporterUtils;
  40. import org.openspcoop2.web.lib.mvc.AreaBottoni;
  41. import org.openspcoop2.web.lib.mvc.Costanti;
  42. import org.openspcoop2.web.lib.mvc.DataElement;
  43. import org.openspcoop2.web.lib.mvc.DataElementType;
  44. import org.openspcoop2.web.lib.mvc.PageData;
  45. import org.openspcoop2.web.lib.mvc.Parameter;
  46. import org.openspcoop2.web.lib.mvc.ServletUtils;
  47. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  48. /**
  49.  * ScopeHelper
  50.  *
  51.  * @author Poli Andrea (apoli@link.it)
  52.  * @author Giuliano Pintori (pintori@link.it)
  53.  * @author $Author$
  54.  * @version $Rev$, $Date$
  55.  */
  56. public class ScopeHelper extends ConsoleHelper{
  57.    
  58.     private static boolean mostraFiltroScopeTipologia = false;

  59.     public ScopeHelper(HttpServletRequest request, PageData pd,
  60.             HttpSession session) throws Exception {
  61.         super(request, pd,  session);
  62.     }
  63.     public ScopeHelper(ControlStationCore core, HttpServletRequest request, PageData pd,
  64.             HttpSession session) throws Exception {
  65.         super(core, request, pd,  session);
  66.     }

  67.     public List<DataElement> addScopeToDati(TipoOperazione tipoOP, Long scopeId, String nome, String descrizione, String tipologia,
  68.             String nomeEsterno, String contesto, List<DataElement> dati, String oldNomeScope) throws DriverConfigurazioneException {
  69.        
  70.         Scope scope = null;
  71.         if(TipoOperazione.CHANGE.equals(tipoOP) && oldNomeScope!=null && StringUtils.isNotEmpty(oldNomeScope)){
  72.             scope = this.scopeCore.getScope(oldNomeScope);
  73.         }
  74.        
  75.         if(TipoOperazione.CHANGE.equals(tipoOP)){
  76.            
  77.             List<Parameter> listaParametriChange = new ArrayList<>();
  78.             Parameter pId = new Parameter(ScopeCostanti.PARAMETRO_SCOPE_ID, scopeId+"");
  79.             listaParametriChange.add(pId);
  80.            
  81.             // In Uso Button
  82.             this.addComandoInUsoButton(nome,
  83.                     nome,
  84.                     InUsoType.SCOPE);
  85.            
  86.            
  87.             // se e' abilitata l'opzione reset cache per elemento, visualizzo il comando nell'elenco dei comandi disponibili nella lista
  88.             if(this.core.isElenchiVisualizzaComandoResetCacheSingoloElemento()){
  89.                 listaParametriChange.add(new Parameter(CostantiControlStation.PARAMETRO_ELIMINA_ELEMENTO_DALLA_CACHE, "true"));
  90.                 this.pd.addComandoResetCacheElementoButton(ScopeCostanti.SERVLET_NAME_SCOPE_CHANGE, listaParametriChange);
  91.             }      
  92.                    
  93.             // Proprieta Button
  94.             if(scope!=null && this.existsProprietaOggetto(scope.getProprietaOggetto(), scope.getDescrizione())) {
  95.                 this.addComandoProprietaOggettoButton(nome,
  96.                         nome, InUsoType.SCOPE);
  97.             }
  98.         }
  99.        
  100.         DataElement de = new DataElement();
  101.         de.setLabel(ScopeCostanti.LABEL_SCOPE);
  102.         de.setType(DataElementType.TITLE);
  103.         dati.add(de);
  104.        
  105.         if(scopeId!=null){
  106.             de = new DataElement();
  107.             de.setLabel(ScopeCostanti.PARAMETRO_SCOPE_ID);
  108.             de.setValue(scopeId.longValue()+"");
  109.             de.setType(DataElementType.HIDDEN);
  110.             de.setName(ScopeCostanti.PARAMETRO_SCOPE_ID);
  111.             de.setSize( getSize());
  112.             dati.add(de);
  113.         }
  114.        
  115.         de = new DataElement();
  116.         de.setLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME);
  117.         de.setValue(nome);
  118.         de.setType(DataElementType.TEXT_EDIT);
  119.         de.setName(ScopeCostanti.PARAMETRO_SCOPE_NOME);
  120.         de.setSize( getSize());
  121.         de.setRequired(true);
  122.         dati.add(de);

  123.         de = new DataElement();
  124.         de.setLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_DESCRIZIONE);
  125.         de.setValue(descrizione);
  126.         de.setType(DataElementType.TEXT_AREA);
  127.         de.setRows(2);
  128.         de.setName(ScopeCostanti.PARAMETRO_SCOPE_DESCRIZIONE);
  129.         de.setSize( getSize());
  130.         dati.add(de);

  131.         de = new DataElement();
  132.         de.setLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_TIPOLOGIA);
  133.         de.setType(DataElementType.SELECT);
  134.         de.setName(ScopeCostanti.PARAMETRO_SCOPE_TIPOLOGIA);
  135.        
  136.         de.setValue(tipologia);
  137.         if(mostraFiltroScopeTipologia)
  138.             de.setType(DataElementType.TEXT_EDIT);
  139.         else
  140.             de.setType(DataElementType.HIDDEN);
  141.         dati.add(de);
  142.        
  143.         de = new DataElement();
  144.         de.setLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME_ESTERNO);
  145.         de.setValue(nomeEsterno);
  146.         de.setType(DataElementType.TEXT_EDIT);
  147.         de.setName(ScopeCostanti.PARAMETRO_SCOPE_NOME_ESTERNO);
  148.         de.setSize( getSize());
  149.         dati.add(de);

  150.         de = new DataElement();
  151.         de.setLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_CONTESTO);
  152.         de.setType(DataElementType.SELECT);
  153.         de.setName(ScopeCostanti.PARAMETRO_SCOPE_CONTESTO);
  154.         de.setLabels(ScopeCostanti.getScopeContestoUtilizzoLabel());
  155.         de.setValues(ScopeCostanti.getScopeContestoUtilizzo());
  156.         de.setSelected(contesto);
  157.         dati.add(de);
  158.    
  159.         return dati;
  160.     }
  161.    
  162.    
  163.     // Controlla i dati del registro
  164.     public boolean scopeCheckData(TipoOperazione tipoOp, Scope scope) throws Exception {

  165.         try{

  166.             String nome = this.getParameter(ScopeCostanti.PARAMETRO_SCOPE_NOME);
  167.             String descrizione = this.getParameter(ScopeCostanti.PARAMETRO_SCOPE_DESCRIZIONE);
  168.             String nomeEsterno = this.getParameter(ScopeCostanti.PARAMETRO_SCOPE_NOME_ESTERNO);
  169.            
  170.             // Campi obbligatori
  171.             if (nome.equals("")) {
  172.                 String tmpElenco = "";
  173.                 if (nome.equals("")) {
  174.                     tmpElenco = ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME;
  175.                 }
  176.                 this.pd.setMessage("Dati incompleti. &Egrave; necessario indicare: " + tmpElenco);
  177.                 return false;
  178.             }

  179.             // Controllo che non ci siano spazi nei campi di testo
  180.             if ((nome.indexOf(" ") != -1) ) {
  181.                 this.pd.setMessage("Non inserire spazi nel campo '"+ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME+"'");
  182.                 return false;
  183.             }
  184.             if(!this.checkNCName(nome, ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME)){
  185.                 return false;
  186.             }
  187.             if(!this.checkLength255(nome, ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME)) {
  188.                 return false;
  189.             }
  190.            
  191.             if(descrizione!=null && !"".equals(descrizione) &&
  192.                 !this.checkLength4000(descrizione, ScopeCostanti.LABEL_PARAMETRO_SCOPE_DESCRIZIONE)) {
  193.                 return false;
  194.             }
  195.             if(nomeEsterno!=null && !"".equals(nomeEsterno) &&
  196.                 !this.checkLength255(nomeEsterno, ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME_ESTERNO)) {
  197.                 return false;
  198.             }

  199.             // Se tipoOp = add, controllo che il registro non sia gia' stato
  200.             // registrata
  201.             if (tipoOp.equals(TipoOperazione.ADD)) {
  202.                
  203.                 if(this.scopeCore.existsScope(nome)){
  204.                     this.pd.setMessage("Un scope con nome '" + nome + "' risulta gi&agrave; stato registrato");
  205.                     return false;
  206.                 }
  207.                
  208.             }
  209.             else{
  210.                
  211.                 if(!scope.getNome().equals(nome) &&
  212.                     this.scopeCore.existsScope(nome)){ // e' stato modificato ilnome
  213.                     this.pd.setMessage("Un scope con nome '" + nome + "' risulta gi&agrave; stato registrato");
  214.                     return false;
  215.                 }
  216.                
  217.             }
  218.                
  219.             return true;

  220.         } catch (Exception e) {
  221.             this.log.error("Exception: " + e.getMessage(), e);
  222.             throw new Exception(e);
  223.         }
  224.     }
  225.    
  226.    
  227.     // Prepara la lista di scope
  228.    
  229.     public static int POSIZIONE_FILTRO_PROTOCOLLO = 2; // parte da 0, e' alla quarta posizione se visualizzato
  230.     static {
  231.         if(mostraFiltroScopeTipologia) {
  232.             POSIZIONE_FILTRO_PROTOCOLLO = 3;
  233.         }
  234.     }
  235.    
  236.     public void prepareScopeList(ISearch ricerca, List<Scope> lista)
  237.             throws Exception {
  238.         try {
  239.             ServletUtils.addListElementIntoSession(this.request, this.session, ScopeCostanti.OBJECT_NAME_SCOPE);
  240.            
  241.             boolean modalitaCompleta = this.isModalitaCompleta();
  242.            
  243.             if(!modalitaCompleta) {
  244.                 this.pd.setCustomListViewName(ScopeCostanti.SCOPE_NOME_VISTA_CUSTOM_LISTA);
  245.             }

  246.             int idLista = Liste.SCOPE;
  247.             int limit = ricerca.getPageSize(idLista);
  248.             int offset = ricerca.getIndexIniziale(idLista);
  249.             String search = ServletUtils.getSearchFromSession(ricerca, idLista);

  250.             if(mostraFiltroScopeTipologia) {
  251.                 String filterScopeTipologia = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SCOPE_TIPOLOGIA);
  252.                 this.addFilterScopeTipologia(filterScopeTipologia, false);
  253.             }
  254.            
  255.             String filterScopeContesto = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SCOPE_CONTESTO);
  256.             this.addFilterScopeContesto(filterScopeContesto, false);
  257.            
  258.             String filterApiContesto = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_API_CONTESTO);
  259.             this.addFilterApiContesto(filterApiContesto, true);
  260.                        
  261.             // NOTA: ATTENZIONE!!! se sei agggiunge o elimina un filtro prima del protocollo indicato sotto, correggere la variabile POSIZIONE_FILTRO_PROTOCOLLO in questa classe
  262.            
  263.             String filterProtocollo = null;
  264.             String filterSoggetto = null;
  265.             boolean profiloSelezionato = false;
  266.             if(filterApiContesto!=null &&
  267.                     //!"".equals(filterApiContesto) &&
  268.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_CONTESTO_QUALSIASI.equals(filterApiContesto)) {
  269.                
  270.                 filterProtocollo = addFilterProtocol(ricerca, idLista, true);

  271.                 String protocollo = filterProtocollo;
  272.                 if(protocollo==null) {
  273.                     // significa che e' stato selezionato un protocollo nel menu in alto a destra
  274.                     List<String> protocolli = this.core.getProtocolli(this.request, this.session);
  275.                     if(protocolli!=null && protocolli.size()==1) {
  276.                         protocollo = protocolli.get(0);
  277.                     }
  278.                 }
  279.                
  280.                 if( (filterProtocollo!=null &&
  281.                         //!"".equals(filterProtocollo) &&
  282.                         !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_PROTOCOLLO_QUALSIASI.equals(filterProtocollo))
  283.                         ||
  284.                     (filterProtocollo==null && protocollo!=null)
  285.                         ) {
  286.                     profiloSelezionato = true;
  287.                 }
  288.                
  289.                 if( profiloSelezionato &&
  290.                         (!this.isSoggettoMultitenantSelezionato())) {
  291.                    
  292.                     filterSoggetto = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_SOGGETTO);
  293.                     boolean soloSoggettiOperativi = true;
  294.                     this.addFilterSoggetto(filterSoggetto,protocollo,soloSoggettiOperativi,true);
  295.                 }
  296.                 else {
  297.                     filterSoggetto=this.getSoggettoMultitenantSelezionato();
  298.                 }
  299.                
  300.             }
  301.            
  302.             String filterGruppo = null;
  303.             if(filterApiContesto!=null &&
  304.                     //!"".equals(filterApiContesto) &&
  305.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_CONTESTO_QUALSIASI.equals(filterApiContesto)) {
  306.                
  307.                 filterGruppo = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_GRUPPO);
  308.                 addFilterGruppo(filterProtocollo, filterGruppo, true);
  309.                
  310.             }
  311.             else {
  312.                 SearchUtils.clearFilter(ricerca, idLista, Filtri.FILTRO_GRUPPO);
  313.             }
  314.            
  315.             if(profiloSelezionato &&
  316.                     filterApiContesto!=null &&
  317.                     //!"".equals(filterApiContesto) &&
  318.                     !CostantiControlStation.DEFAULT_VALUE_PARAMETRO_API_CONTESTO_QUALSIASI.equals(filterApiContesto)) {
  319.                 String filterApiImplementazione = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_API_IMPLEMENTAZIONE);
  320.                 this.addFilterApiImplementazione(filterProtocollo, filterSoggetto, filterGruppo, filterApiContesto, filterApiImplementazione, false);
  321.             }
  322.             else {
  323.                 SearchUtils.clearFilter(ricerca, idLista, Filtri.FILTRO_API_IMPLEMENTAZIONE);
  324.             }
  325.            
  326.             this.pd.setIndex(offset);
  327.             this.pd.setPageSize(limit);
  328.             this.pd.setNumEntries(ricerca.getNumEntries(idLista));

  329.             // setto la barra del titolo
  330.             if (search.equals("")) {
  331.                 this.pd.setSearchDescription("");
  332.                 ServletUtils.setPageDataTitle(this.pd,
  333.                         new Parameter(ScopeCostanti.LABEL_SCOPE, ScopeCostanti.SERVLET_NAME_SCOPE_LIST));
  334.             }
  335.             else{
  336.                 ServletUtils.setPageDataTitle(this.pd,
  337.                         new Parameter(ScopeCostanti.LABEL_SCOPE, ScopeCostanti.SERVLET_NAME_SCOPE_LIST),
  338.                         new Parameter(Costanti.PAGE_DATA_TITLE_LABEL_RISULTATI_RICERCA, null));
  339.             }

  340.             // controllo eventuali risultati ricerca
  341.             this.pd.setSearchLabel(ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME);
  342.             if (!search.equals("")) {
  343.                 ServletUtils.enabledPageDataSearch(this.pd, ScopeCostanti.LABEL_SCOPE, search);
  344.             }

  345.             // setto le label delle colonne
  346.             this.setLabelColonne(modalitaCompleta);

  347.             // preparo i dati
  348.             List<List<DataElement>> dati = new ArrayList<>();

  349.             if (lista != null) {
  350.                 Iterator<Scope> it = lista.iterator();
  351.                 while (it.hasNext()) {
  352.                     List<DataElement> e = modalitaCompleta ? this.creaEntry(it) : this.creaEntryCustom(it);

  353.                     dati.add(e);
  354.                 }
  355.             }

  356.             this.pd.setDati(dati);
  357.             this.pd.setAddButton(true);
  358.            
  359.             // preparo bottoni
  360.             if(lista!=null && !lista.isEmpty() &&
  361.                 this.core.isShowPulsantiImportExport()) {

  362.                 ExporterUtils exporterUtils = new ExporterUtils(this.archiviCore);
  363.                 if(exporterUtils.existsAtLeastOneExportMode(org.openspcoop2.protocol.sdk.constants.ArchiveType.SCOPE, this.request, this.session)){

  364.                     List<AreaBottoni> bottoni = new ArrayList<>();

  365.                     AreaBottoni ab = new AreaBottoni();
  366.                     List<DataElement> otherbott = new ArrayList<>();
  367.                     DataElement de = new DataElement();
  368.                     de.setValue(ScopeCostanti.LABEL_SCOPE_ESPORTA_SELEZIONATI);
  369.                     de.setOnClick(ScopeCostanti.LABEL_SCOPE_ESPORTA_SELEZIONATI_ONCLICK);
  370.                     de.setDisabilitaAjaxStatus();
  371.                     otherbott.add(de);
  372.                     ab.setBottoni(otherbott);
  373.                     bottoni.add(ab);

  374.                     this.pd.setAreaBottoni(bottoni);

  375.                 }

  376.             }
  377.            
  378.         } catch (Exception e) {
  379.             this.log.error("Exception: " + e.getMessage(), e);
  380.             throw new Exception(e);
  381.         }
  382.     }
  383.     private List<DataElement> creaEntry(Iterator<Scope> it) {
  384.         Scope scope = it.next();

  385.         List<DataElement> e = new ArrayList<>();

  386.         DataElement de = new DataElement();
  387.         Parameter pId = new Parameter(ScopeCostanti.PARAMETRO_SCOPE_ID, scope.getId()+"");
  388.         de.setUrl(
  389.                 ScopeCostanti.SERVLET_NAME_SCOPE_CHANGE , pId);
  390.         de.setToolTip(scope.getDescrizione());
  391.         de.setValue(scope.getNome());
  392.         de.setIdToRemove(scope.getNome());
  393.         de.setToolTip(scope.getDescrizione());
  394.         de.setSize(this.core.getElenchiMenuIdentificativiLunghezzaMassima());
  395.         e.add(de);
  396.        
  397.         if(mostraFiltroScopeTipologia){
  398.             de = new DataElement();
  399.             de.setValue(scope.getTipologia());
  400.             e.add(de);
  401.         }
  402.        
  403.         de = new DataElement();
  404.         if(ScopeContesto.PORTA_APPLICATIVA.getValue().equals(scope.getContestoUtilizzo().getValue())){
  405.             de.setValue(ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_EROGAZIONE);
  406.         }
  407.         else if(ScopeContesto.PORTA_DELEGATA.getValue().equals(scope.getContestoUtilizzo().getValue())){
  408.             de.setValue(ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_FRUIZIONE);
  409.         }
  410.         else{
  411.             de.setValue(ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_QUALSIASI);
  412.         }
  413.         e.add(de);
  414.         return e;
  415.     }
  416.     private void setLabelColonne(boolean modalitaCompleta) {
  417.         if(!modalitaCompleta) {
  418.             String[] labels = {
  419.                     ScopeCostanti.LABEL_SCOPE
  420.             };
  421.             this.pd.setLabels(labels);
  422.         } else {
  423.             List<String> listLabels= new ArrayList<>();
  424.             listLabels.add(ScopeCostanti.LABEL_PARAMETRO_SCOPE_NOME);
  425.             if(mostraFiltroScopeTipologia){
  426.                 listLabels.add(ScopeCostanti.LABEL_PARAMETRO_SCOPE_TIPOLOGIA);
  427.             }
  428.             listLabels.add(ScopeCostanti.LABEL_PARAMETRO_SCOPE_CONTESTO);
  429.            
  430.             String[] labels = listLabels.toArray(new String[listLabels.size()]);
  431.             this.pd.setLabels(labels);
  432.         }
  433.     }
  434.    
  435.     private List<DataElement> creaEntryCustom(Iterator<Scope> it) {
  436.         Scope scope = it.next();

  437.         List<DataElement> e = new ArrayList<>();

  438.         // Titolo (nome)
  439.         DataElement de = new DataElement();
  440.         Parameter pId = new Parameter(ScopeCostanti.PARAMETRO_SCOPE_ID, scope.getId()+"");
  441.         de.setUrl(
  442.                 ScopeCostanti.SERVLET_NAME_SCOPE_CHANGE , pId);
  443.         de.setToolTip(scope.getDescrizione());
  444.         de.setValue(scope.getNome());
  445.         de.setIdToRemove(scope.getNome());
  446.         de.setToolTip(scope.getDescrizione());
  447.         de.setType(DataElementType.TITLE);
  448.         e.add(de);
  449.        
  450.        
  451.         de = new DataElement();
  452.        
  453.         String contestoLabel = "";
  454.         if(ScopeContesto.PORTA_APPLICATIVA.getValue().equals(scope.getContestoUtilizzo().getValue())){
  455.             contestoLabel = ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_EROGAZIONE;
  456.         }
  457.         else if(ScopeContesto.PORTA_DELEGATA.getValue().equals(scope.getContestoUtilizzo().getValue())){
  458.             contestoLabel = ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_FRUIZIONE;
  459.         }
  460.         else{
  461.             contestoLabel = ScopeCostanti.SCOPE_CONTESTO_UTILIZZO_LABEL_QUALSIASI;
  462.         }
  463.        
  464.         String identificativoEsternoLabelPrefix = "";
  465.         if(scope.getNomeEsterno()!=null) {
  466.             identificativoEsternoLabelPrefix = MessageFormat.format(ScopeCostanti.MESSAGE_METADATI_SCOPE_IDENTIFICATIVO_ESTERNO, scope.getNomeEsterno());
  467.         }
  468.                
  469.         if(mostraFiltroScopeTipologia){
  470.             de.setValue(identificativoEsternoLabelPrefix+MessageFormat.format(ScopeCostanti.MESSAGE_METADATI_SCOPE_CON_TIPO, contestoLabel, scope.getTipologia()));
  471.         } else {
  472.             de.setValue(identificativoEsternoLabelPrefix+MessageFormat.format(ScopeCostanti.MESSAGE_METADATI_SCOPE_SOLO_CONTESTO, contestoLabel));
  473.         }
  474.         de.setType(DataElementType.SUBTITLE);
  475.         e.add(de);
  476.        
  477.         List<Parameter> listaParametriChange = new ArrayList<>();
  478.         listaParametriChange.add(pId);
  479.         listaParametriChange.add(new Parameter(CostantiControlStation.PARAMETRO_RESET_CACHE_FROM_LISTA, "true"));

  480.         // In Uso Button
  481.         this.addInUsoButton(e, scope.getNome(), scope.getNome(), InUsoType.SCOPE);
  482.        
  483.         // se e' abilitata l'opzione reset cache per elemento, visualizzo il comando nell'elenco dei comandi disponibili nella lista
  484.         if(this.core.isElenchiVisualizzaComandoResetCacheSingoloElemento()){
  485.             this.addComandoResetCacheButton(e, scope.getNome(), ScopeCostanti.SERVLET_NAME_SCOPE_CHANGE, listaParametriChange);
  486.         }
  487.        
  488.         // Proprieta Button
  489.         /**if(this.existsProprietaOggetto(scope.getProprietaOggetto(), scope.getDescrizione())) {
  490.          * ** la lista non riporta le proprietà. Ma esistono e poi sarà la servlet a gestirlo
  491.          */
  492.         this.addProprietaOggettoButton(e, scope.getNome(), scope.getNome(), InUsoType.SCOPE);
  493.        
  494.         return e;
  495.     }
  496. }