When creating a configurable property, you can create a list of values of possible values. The enumerated string
property type allows you to specify a single-value property or a collection.
For example, when you specify a collection, a user can select any number between 0 and the number of potential values available. With a single-value property, the user can select 0 or 1, unless the property is set to required, and then the user must select 1. For additional information on enumerated strings, refer to the ATG Repository Guide.
Note: Performance issues may occur if you create lists with large amount of data. Use enumerated strings to display a limited number of items.
Enumerated strings work in the same way as normal enumerated properties; however, they save a string to the database instead of an integer. Except where values are specified using option tags in the SiteRepository.xml
file, values are provided by a StringEnumProvider
, which can be customized for your configuration.
The stringEnumProvider
returns two arrays: the first array is the code that is saved in the database, and the second array is the value displayed by the UI. When a user saves a shareable type, it is only successful if the code being saved exists in the array of codes returned from the stringEnumProvider
.
For example:
$class=atg.adapter.gsa.StringEnumProviderImpl codes=code1,code2 resources=value1,value2
To specify a list of values, the data-type
property, or component-data-type
within your siteRespository.xml
file must set to enumerated
string
, and you must provide the property with the values by adding the following attribute that calls a nucleus component path:
<attribute name="stringEnumProvider" value="
location of
StringEnumProvider
"/>
The attribute value
is an implementation of the atg.adapter.gsa.StringEnumProvider
interface. This default class can have its values appended to array properties.
For example, Site Administration uses enumerated strings in the Site Repository for site groups. A site group is made up of a collection of sites and a collection of shareableTypes
that are registered with /atg/multisite/SiteGroupManager
. As such, the site group shareableTypes
property is of type enumerated string
, and its stringEnumProvider
returns the shareableTypes
from SiteGroupManager
. This allows Site Administration to validate, at the repository level, that only a valid shareable type can be saved in a site group:
<table name="site_types" type="multi" id-column-names="id"> <property name="siteTypes" column-names="site_type" data- type="set" component-data-type="enumerated string" category resource="categoryBasics" display-name-resource="siteTypes"> <attribute name="stringEnumProvider" value="/atg/multisite/SiteTypesProvider"/> <attribute name="propertySortPriority" value="100"/> </property> </table>
Whenever an enumerated string is used, the corresponding Web application must be updated to process the property values.
Internationalized Enumerated Strings
If you need to create an internationalized enumerated string, ensure that your resource property contains the same array of resource keys as the resource keys in your resource bundle.
For example:
$class=atg.adapter.gsa.StringEnumProviderImpl codes=code1,code2 resources=value1,value2 resourceBundle=atg.multisite.newResourceBundle
Aside from the resource keys, you create internationalized enumerated strings in the same manner as regular enumerated strings.
Note: This method of internationalization is used only when employing StringEnumProviders
. If using option
tags, specify the resources in the siteRepository.xml
file as you would with a normal enumerated property.
Deleting Enumerated Strings
To delete an enumerated string, remove the string from the appropriate file. Note that if you have any saved assets that reference the deleted string, when the asset is next updated, the system will remove saved values that are no longer in the enumeration.
For additional information on enumerated strings, refer to the ATG Repository Guide.