SectionBean.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.lib.mvc.properties.beans;

  21. import org.openspcoop2.web.lib.mvc.DataElement;
  22. import org.openspcoop2.web.lib.mvc.DataElementType;
  23. import org.openspcoop2.web.lib.mvc.byok.LockUtilities;
  24. import org.openspcoop2.web.lib.mvc.properties.exception.UserInputValidationException;

  25. import java.util.Map;

  26. import org.openspcoop2.core.mvc.properties.Conditions;
  27. import org.openspcoop2.core.mvc.properties.Property;
  28. import org.openspcoop2.core.mvc.properties.Section;
  29. import org.openspcoop2.core.mvc.properties.constants.ItemType;
  30. import org.openspcoop2.core.mvc.properties.provider.ExternalResources;
  31. import org.openspcoop2.core.mvc.properties.provider.IProvider;

  32. /**
  33.  *  Bean di tipo Section arricchito delle informazioni grafiche.
  34.  *
  35.  * @author Pintori Giuliano (pintori@link.it)
  36.  * @author $Author$
  37.  * @version $Rev$, $Date$
  38.  *
  39.  */
  40. public class SectionBean extends BaseItemBean<Section>{

  41.     public SectionBean(Section section, String name, IProvider provider) {
  42.         super(section, name, provider);
  43.     }

  44.     @Override
  45.     public DataElement toDataElement(ConfigBean config, Map<String, String> mapNameValue, ExternalResources externalResources, LockUtilities lockUtilities) {
  46.         DataElement de = new DataElement();
  47.         de.setName(this.getName());
  48.         de.setLabel(this.getItem().getLabel());
  49.         if(this.visible != null && this.visible) {
  50.             if(this.getItem()!=null && this.getItem().isHidden()) {
  51.                 de.setType(DataElementType.HIDDEN);
  52.             }
  53.             else {
  54.                 de.setType(DataElementType.TITLE);
  55.             }
  56.         }else
  57.             de.setType(DataElementType.HIDDEN);
  58.         return de;
  59.     }

  60.     @Override
  61.     public void setValueFromRequest(String parameterValue, ExternalResources externalResources, LockUtilities lockUtilities) {
  62.         // nop
  63.     }

  64.     @Override
  65.     public Property getSaveProperty() { return null; }
  66.    
  67.     @Override
  68.     public String getPropertyValue() { return null; }
  69.    
  70.     @Override
  71.     public void init(String value, ExternalResources externalResources) {
  72.         // nop
  73.     }
  74.    
  75.     @Override
  76.     public Conditions getConditions() {
  77.         return this.item.getConditions();
  78.     }
  79.    
  80.     @Override
  81.     public ItemType getItemType() {
  82.         return null;
  83.     }
  84.    
  85.     @Override
  86.     public String getLabel() {
  87.         return this.item.getLabel();
  88.     }
  89.    
  90.     @Override
  91.     public void validate(ExternalResources externalResources) throws UserInputValidationException {
  92.         // nop
  93.     }
  94. }