Edit Property Factory
The EditPropertyFactory allows you to generate a list of inputs with minimal repeat code.
Attributes
spec: JSONObject. Represents the current specification attached to the factory. When an EditProperty is added to the factory, the value will be loaded from the spec. The spec will be empty for new instances unless otherwise set. Otherwise, a default value will be loaded.
eps: List<EditProperty>. The list of properties. Starts out empty.
messageSource: (Optional). Represents a Spring MessageSource. The factory has some methods that automatically generate common fields. The message source is used to get i18 strings, based on the current language.
Constructor
Instantiate a new instance, eps
and spec
are empty. Use this constructor if you don't intend to use
auto-generated properties:
EditPropertyFactory()
Instantiate a new instance, eps
and spec
are empty. Use this constructor if you intend to use
auto-generated properties:
EditPropertyFactory(MessageSource messageSource)
The most common usage for writing connectors. The factory will set the values of each property if they are present,
or use the default value:
EditPropertyFactory(JSONObject docSpec, MessageSource messageSource)
For Authentication Connection use. This constructor converts the authSpec
into spec
:
EditPropertyFactory(Map<String,String> authSpec, MessageSource messageSource)
Methods
The factory methods use slightly different names for the EditProperty fields they set:
- paramName: Always refers to the
id
- label: Refers to the
displayName
- defval: The default
value
of the field, should one not be available - desc: Refers to the
description
- min: The
minValue
- max: The
maxValue
- validator: Same as on
EditProperty
- options: Same as on
EditProperty
Basic Methods
Add an EditProperty to the list:
add(EditProperty ep)
Add all properties in epList
to the current list:
addList(List<EditProperty> epList)
Retrieve the EditProperty based on key value, or null
if it is not present:
public EditProperty getPropByKey(String propKey)
Add Property Methods
public void addInfoEP(String paramName,String label)
public void addTextEP(String paramName,String label,String defval,String desc)
public void addTextEP(String paramName,String label,String defval,String desc,String validator)
public void addTagsEP(String paramName, String label)
public void addTagsEP(String paramName, String label, String defval)
public void addTagsEP(String paramName, String label, String defval, String description)
public void addTagsEP(String paramName, String label, String defval, int min, int max)
public void addTagsEP(String paramName, String label, String defval, String description, int min, int max)
public void addTextEP(String paramName,String label)
public void addTextEP(String paramName,String label,String defval)
public void addIntEP(String paramName, String label, int min, int max, int defval, String desc)
public void addIntEP(String paramName, String label, int min, int max, int defval)
public void addIntEP(String paramName, String label, int defVal)
public void addIntEP(String paramName, String label, int defVal, String description)
public void addLongEP(String paramName,String label,long defVal)
public void addLongEP(String paramName,String label,long defVal,String desc)
public void addCheckEP(String paramName, String label, boolean defval, String desc)
public void addCheckEP(String paramName, String label, String desc)
public void addCheckEP(String paramName, String label, boolean defval)
public void addCheckEP(String paramName, String label)
public void addSelectEP(String paramName,String label,String defval,List<EditPropertyOption> options)
public void addSelectEP(String paramName,String label,String defval,List<EditPropertyOption> options,boolean multiple)
public void addSelectEP(String paramName,String label,String defval,List<EditPropertyOption> options,String description)
public void addSelectEP(String paramName,String label,List<EditPropertyOption> options)
public void addReadioEP(String paramName,String label,List<EditPropertyOption> options)
public void addTextAreaEP(String paramName,String label,String description)
public void addTextAreaEP(String paramName,String label,String description,String defVal)
public void addTextAreaEP(String paramName,String label)
public void addPassEP(String paramName,String label)
public void addPassEP(String paramName,String label,String description)
public void addReadOnlyEP(String paramName,String label,String description)
public void addReadOnlyEP(String paramName,String label,String deval,String description)
public void addDateTimeEP(String paramName,String label)
public void addDateTimeEP(String paramName,String label,long devVal)
public void addDateTimeEP(String paramName,String label,String description)
public void addDateTimeEP(String paramName,String label,String description,long min,long max)
public void addHiddenEP(String paramName)
public void addHiddenEP(String paramName,String value)
public void addIntervalEP(String paramName,String label)
public void addCodeEP(String paramName,String label)
public void addCodeEP(String paramName,String label,String defaultValue)
public void addCodeEP(String paramName,String label,String defaultValue,String description)
Build Methods
Return eps
:
public List<EditProperty> getEpList()
Return the property list as an EditPropertyCollection
object, which are used to generate job specifications:
public EditPropertyCollection getAsEditPropertyCollection()
Return 'eps' as an EditPropertyTab
, which are used by Authentication Connections:
public EditPropertyTab getAsEditPropertyTab(String id, String tabLabel)
- id: The id of the tab, must be unique or the tabs will not function
- tabLabel: The label to display on the tab
public EditPropertyTab getAsEditPropertyTab(String id, String tabLabel, boolean active)
- id: The id of the tab, must be unique or the tabs will not function
- tabLabel: The label to display on the tab
- active: Sets this tab to be the active tab when the page loads. Multiple active tabs will cause unexpected behavior
Remove all items from eps
:
public void clearProperties()
Auto Generated Field Methods
Message Source Required
These fields use some generic labels that require the Message Source be set. If it doesn't then only the message keys will be displayed.
public void addIncludeUnmappedCheck()
Adds "Include Unmapped Properties" checkbox
public void addGetVersionsCheck()
Adds "Get Versions" checkbox
public void addOutputFolderId()
Adds "Output Folder Id" text box
public void addOutputFolderPath()
Adds "Output Folder Path" text box
public void addDateFormatField()
Adds text box with default date format. Value: yyyy-MM-dd
public void addDateTimeFormatField()
Adds text box with default datetime format Value: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
public void addDTFormatFields()
Adds both date and datetime text boxes
public void addMultiValueSeparator()
Adds "Multi-value separator" text box. Value: ,
public void addAspectRemoveFieldMapping()
Adds empty "Aspect Remove Field Mapping" textarea.
public void addProxyFields()
Adds the following:
- Proxy Address - Text Field
- Proxy Port - Integer Field
- Proxy Username - Text field
- Proxy Password - Password field
public void addOAuthFields()
-
Adds the following:
- Client Id - Text Field
- Client Secret - Integer Field
- Code - ReadOnly field
- Token - ReadOnly field
- Refresh Token - ReadOnly field
public void addBasicAuthFields(boolean withUrl, boolean withPort)
Adds a Username and Password field
- withUrl - Add a text input for a server url
- withPort - Add a number input for server port
public void addBasicAuthFields(boolean withUrl, boolean withPort, int defaultPort)
Adds a Username and Password field
- withUrl - Add a text input for a server url
- withPort - Add a number input for server port
- defaultPort - Default value for the port field if it isn't present in the spec.
Link Methods
Property Dependencies
An EditProperty can only "depend on" a single other property. Be careful when chaining properties or using the multi-property link methods, as this value may get overwritten.
public void linkProperties(String checkKey, String propKey)
Links a property to a checkbox so that it will be invisible unless the box is checked.
- checkKey - The id of the checkbox property to link to
- propKey - The property to hide if the box is not checked
public void linkMultiple(String checkKey, List<String> propKeys)
Performs the link operation on the listed properties.
- checkKey - The id of the checkbox property to link to
- propKeys - List of properties to link
public void linkSelectValues(String selectKey, String propKey, String... showOnValues)
Links a property to a dropdown object so that it will only appear if the values in showOnValues
- selectKey - The id of the dropdown property to link to
- propKey - The property to hide if the specified values are not selected
- showOnValues - Pass is as a variable number of strings. These are the values that will make the property appear.
public void linkSelectMultiple(String selectKey, List<String> propKeys, String... showOnValues)
Perform the linkSelectValues operation on multiple properties.
- selectKey - The id of the dropdown property to link to
- propKeys - List of properties to link
- showOnValues - Pass is as a variable number of strings. These are the values that will make the property appear.
public void linkRadioValues(String selectKey, String propKey, String... showOnValues)
Links a property to a collection of radio buttons, so that it will only appear if the values in showOnValues
- selectKey - The id of the dropdown property to link to
- propKey - The property to hide if the specified values are not selected
- showOnValues - Pass is as a variable number of strings. These are the values that will make the property appear.
public void linkRadioMultiple(String selectKey, List<String> propKeys, String... showOnValues)
Perform the linkRadioValues operation on multiple properties.
- selectKey - The id of the dropdown property to link to
- propKeys - List of properties to link
- showOnValues - Pass is as a variable number of strings. These are the values that will make the property appear.