Returns a list of repository items of the specified item type.

Class Name

atg.repository.servlet.PossibleValues

Component

/atg/dynamo/droplet/PossibleValues

Required Input Parameters

itemDescriptorName

The item descriptor within the repository.

propertyName

The name of the repository item’s property, required only for enumerated properties. For properties which are themselves item types, you can set itemDescriptorName and propertyName of the linked property, or set itemDescriptorName to the linked-to property.

repository

The name of the repository. If omitted, the default is obtained from the servlet bean’s properties file.

repositoryItem

Required only if parameters itemDescriptorName or repository are unspecified, used to obtain the item descriptor and its repository. Use this parameter if a repository item’s underlying type and source are unknown.

Optional Input Parameters

maxRepositoryItems

Sets the maximum number of repository items returned by this servlet bean. If omitted, the default is obtained from the servlet bean’s maxRepositoryItems property (initially set to 500). To specify no limit, set this parameter to -1.

returnValueObjects

If set to true, sets the output parameter values to an array of PossibleValue objects.

PossibleValue objects have the following properties:

sortProperties

Holds a string that specifies the order to render array items. The syntax of this parameter depends on the array item type: JavaBean, Dynamic Bean, Date, Number, or String.

To sort on the properties of a JavaBean, specify the value of sortProperties as a comma-separated list of property names. You can sort on an unlimited number of properties, where the first property name specifies the primary sort, the second property name specifies the secondary sort, and so on. To specify ascending sort order, prepend the property name with a plus + sign; to specify descending order, prepend with a minus - sign.

The following example sorts a JavaBean array alphabetically by title , then in descending order of size, use this input parameter:

<dsp:param name="sortProperties" value="+title,size"/>

If the array contains Dates, Numbers, or Strings, prepend the sortProperties value with a plus + or minus sign to specify ascending or descending sort order.

The following example sorts an output array of Strings in alphabetical order:

<dsp:param name="sortProperties" value="+"/>

In order to sort Map elements by key, set the value as follows:

{+|-}_key

For example:

<dsp:param name="sortProperties" value="_key"/>

A nested servlet bean inherits the parent servlet bean’s sortProperties setting, unless it is overridden by the nested servlet bean’s own sortProperties setting. For example, the following setting negates any parent sortProperties setting:

<dsp:param name="sortProperties" value=""/>

useCodeForValue

A Boolean parameter, specifies whether to return the string or integer code value for the enumerated property identified by the propertyName parameter. Each enumerated property has a string value and integer code value specified for it in the item descriptor that defines the property itself. When useCodeForValue is set to true for the property in its item descriptor and in the PossibleValues servlet bean, the integer code value is provided to the JSP. Any other combination of values causes the string value to return.

For information on useCodeForValue in the repository item descriptor, see the EnumeratedProperties section of the SQLRepositoryItemProperties chapter of the ATG Repository Guide.

Output Parameters

values

Contains the array of possible values for the named itemDescriptorName and propertyName; or an array of PossibleValue objects if input parameter returnValueObjects is set to true.

Open Parameters

output

Rendered once with the result of the repository query. In the case of enumerated property data types, the result is an array of java.lang.String objects. In the case of properties which are themselves item types, the result is an array of repository items.

Usage Notes

PossibleValues uses the specified (or repositoryItem-implied) repository and item descriptor to produce an array of RepositoryItems. If you specify a property name through the propertyName parameter, PossibleValues returns an array of property values, each one an enumerated list of strings. Alternatively, you can generate an array of PossibleValue objects by setting the returnValueObjects parameter to true.

Example

The following example uses the servlet beans PossibleValues and ForEach to create a form with input fields for setting an audio component’s type and manufacture. A fragment of a repository definition XML file shows the different property types to be retrieved:

<item-descriptor name="component">
  ...
  <property name="type" data-type="enumerated" ... >
    <attribute name="useCodeForValue" value="false"/>
    <option value="Receiver" code="0"/>
    <option value="Amplifier" code="1"/>
    <option value="Tuner" code="2"/>
    <option value="CD Player" code="3"/>
    <option value="DVD Player" code="4"/>
    <option value="Cassette Tape Player" code="5"/>
  </property>

  <property name="manufacturer" item-type="manufacturer" ... >

</item-descriptor>

<item-descriptor name="manufacturer">
  ...
  <property name="id" column-name="manufacturer_id"/>
  <property name="displayName" data-type="string"
    column-name="manufacturer_name"/>
  <property name="description" data-type="string" column-name="description"/>
  <property name="longDescription" data-type="big string"
    column-name="long_description"/>
</item-descriptor>

The JSP form is defined as follows:

<dsp:form action="Audio.jsp" method="POST">

  <%-- Generate the Component Type select tag from an enumerated type --%>
  <dsp:select bean="AudioComponent.type">
    <dsp:droplet name="PossibleValues">
      <dsp:param name="itemDescriptorName" value="component"/>
      <dsp:param name="propertyName" value="type"/>
      <dsp:oparam name="output">
        <dsp:droplet name="ForEach">
          <dsp:param name="array" param="values"/>
          <dsp:oparam name="output">
            <dsp:option param="element"/>
            <dsp:valueof param="element"/>
          </dsp:oparam>
        </dsp:droplet>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:select>

  <%-- Generate the Component Manufacturer select tag from an item type --%>
  <dsp:select bean="AudioComponent.manufacturer">
    <dsp:droplet name="PossibleValues">
      <dsp:param name="itemDescriptorName" value="component"/>
      <dsp:param name="propertyName" value="manufacturer"/>
      <dsp:param name="sortProperties" value="+displayName"/>
      <dsp:oparam name="output">
        <dsp:droplet name="ForEach">
          <dsp:param name="array" param="values"/>
          <dsp:oparam name="output">
            <dsp:option param="id"/>
            <dsp:valueof param="element.displayName"/>
          </dsp:oparam>
        </dsp:droplet>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:select>

</dsp:form>
 
loading table of contents...