Package org.sourceid.saml20.adapter.gui
Class FieldDescriptor
- java.lang.Object
-
- org.sourceid.saml20.adapter.gui.FieldDescriptor
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbstractSelectionFieldDescriptor,AbstractTextFieldDescriptor,CheckBoxFieldDescriptor,FilterableSelectionFieldDescriptor,TextAreaFieldDescriptor,UploadFileFieldDescriptor
public abstract class FieldDescriptor extends Object implements Serializable
An abstract base type for describing GUI fields to be rendered in the PingFederate administration console. See the various subclasses for specific types (text field, drop down, checkbox, etc.).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classFieldDescriptor.FieldValidationWrapperA wrapper class to support the 'skip if' functionality inaddValidator(org.sourceid.saml20.adapter.gui.validation.FieldValidator, boolean).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValidator(FieldValidator validator)Adds a FieldValidator to the back of the ordered list of validators for this field.voidaddValidator(FieldValidator validator, boolean skipIfEmptyValue)Adds a FieldValidator to the back of the ordered list of validators for this field.StringgetDefaultForLegacyConfig()This method returns a default value for the field of a plugin instance created before adding the current field.StringgetDefaultValue()Gets the default value for this field.StringgetDescription()Gets a description of this field.StringgetFormattedValue(String value)Gets a value that is formatted according to this FieldDescriptor.StringgetLabel()Gets the label of this field that will be rendered in the administrative console configuration pages.StringgetName()Gets the name of this field.List<FieldDescriptor.FieldValidationWrapper>getValidationChain()Gets the ordered list of FieldValidators.booleanisHidden()This method returns a boolean indicating if the current field is hidden on the user interface.voidsetDefaultForLegacyConfig(String defaultValue)This method allows a newly added field to have a default value specifically for instances of a plugin that were created before adding this field.voidsetDefaultValue(String defaultValue)Sets the default value for this individual field.voidsetHidden(boolean hidden)This method sets whether this field is hidden in the user interface.voidsetLabel(String label)Sets the label of this field that will be rendered in the administrative console configuration pages.
-
-
-
Method Detail
-
getName
public String getName()
Gets the name of this field. The name of the field must be unique per Table or AdapterConfigurationGuiDescriptor. The field is used to identify the field during various processing steps.- Returns:
- the name of the field.
-
setLabel
public void setLabel(String label)
Sets the label of this field that will be rendered in the administrative console configuration pages. If set, the label will take precedence over the name for how the field is rendered in the administrative console. This is intended to be used as a strategy for renaming fields in future releases of a plugin, while preserving the handling of existing configuration.- Parameters:
label- The desired field label value.- Since:
- 9.0
-
getLabel
public String getLabel()
Gets the label of this field that will be rendered in the administrative console configuration pages. If it is not explicitly set, the name of the field will be returned as the label.- Returns:
- the label of the field.
- Since:
- 9.0
-
getDescription
public String getDescription()
Gets a description of this field.- Returns:
- a description
-
getDefaultValue
public String getDefaultValue()
Gets the default value for this field.- Returns:
- the default value.
-
getFormattedValue
public String getFormattedValue(String value)
Gets a value that is formatted according to this FieldDescriptor. It is meant to be overridden by subclasses. By default the specified value is simply returned.- Parameters:
value- The value to be formatted.- Returns:
- The formatted value that is understandable to this FieldDescriptor.
-
setDefaultValue
public void setDefaultValue(String defaultValue)
Sets the default value for this individual field.- Parameters:
defaultValue- for this field.
-
setDefaultForLegacyConfig
public void setDefaultForLegacyConfig(String defaultValue)
This method allows a newly added field to have a default value specifically for instances of a plugin that were created before adding this field.- Parameters:
defaultValue- The default value that should be used for legacy configurations.
-
getDefaultForLegacyConfig
public String getDefaultForLegacyConfig()
This method returns a default value for the field of a plugin instance created before adding the current field.- Returns:
- The default value that should be used for legacy configurations.
-
isHidden
public boolean isHidden()
This method returns a boolean indicating if the current field is hidden on the user interface.- Returns:
- True if this field is not shown in the user interface. False otherwise.
-
setHidden
public void setHidden(boolean hidden)
This method sets whether this field is hidden in the user interface.- Parameters:
hidden- True if this field is hidden from the user interface. False otherwise.
-
addValidator
public void addValidator(FieldValidator validator)
Adds a FieldValidator to the back of the ordered list of validators for this field. This method callsaddValidator(org.sourceid.saml20.adapter.gui.validation.FieldValidator, boolean)with false for the last parameter.- Parameters:
validator- the FieldValidator
-
addValidator
public void addValidator(FieldValidator validator, boolean skipIfEmptyValue)
Adds a FieldValidator to the back of the ordered list of validators for this field.- Parameters:
validator- validator the FieldValidatorskipIfEmptyValue- a boolean indicating if validator should be skipped when the field value is null or empty. This is useful for situations where you want to perform some validation on a field only if the user entered a value for the field. For example, you might want a field that is not required but must be an integer if used.
-
getValidationChain
public List<FieldDescriptor.FieldValidationWrapper> getValidationChain()
Gets the ordered list of FieldValidators.- Returns:
- the validation chain for this field.
-
-