SubsectionBean.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.Subsection;
  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.  *
  34.  * Bean di tipo Subsection arricchito delle informazioni grafiche.
  35.  *
  36.  * @author Pintori Giuliano (pintori@link.it)
  37.  * @author $Author$
  38.  * @version $Rev$, $Date$
  39.  *
  40.  */
  41. public class SubsectionBean extends BaseItemBean<Subsection>{

  42.     public SubsectionBean(Subsection section, String name, IProvider provider) {
  43.         super(section, name, provider);
  44.     }

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

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

  65.     @Override
  66.     public Property getSaveProperty() { return null; }
  67.    
  68.     @Override
  69.     public String getPropertyValue() { return null; }
  70.    
  71.     @Override
  72.     public void init(String value, ExternalResources externalResources) {
  73.         // nop
  74.     }
  75.    
  76.     @Override
  77.     public Conditions getConditions() {
  78.         return this.item.getConditions();
  79.     }
  80.    
  81.     @Override
  82.     public ItemType getItemType() {
  83.         return null;
  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. }