The SelectProvider
is not a sub-type of Provider, but a distinct type of worker object. Select providers allow users to select items from a list of options.
They are referenced in the tasks.xml
input
element; for example:
<input type="select" selectprovider="wizardSelectProvider">
You can constrain users to a single selection or allow multi-select. This example shows a single-select option in the user interface:
[N] Non Switching Datasource
*[S] Switching Datasource
Select one > N
For a multiselect list, a Done option is included automatically:
[1] Reporting
[2] Staging Server
[D] Done
Select zero or more >
Two properties enable this functionality:
minOccurs
defines the minimum number that must be selected; default is 1maxOccurs
defines the maximum number that can be selected; default is 1
Infinity is represented by -1.
Single selection is the default, but it can be explicitly instantiated with minOccurs=1
and maxOccurs=1
.
The multi-select option allows users to choose multiple selections, separate by spaces. Default selections are marked with an asterisk. Multiselects can use a range of either zero-to-many, one-to-many, or many-to-many. Ranges are numerically based (0-1, 1-1, 5-10 are all valid examples). Users mark their selections by entering a space-separated list. Entering an item that is already selected deselects it. Validation ensures that the selection is within the minOccurs
and maxOccurs
range.
The ISelectProvider
interface is shown here:
package atg.cim.worker; import java.util.List; import atg.cim.model.SelectProviderOption; /** * ISelectProvider objects are javabeans that provide values to the CIM Framework by exposing properties based on a use input. They also provide a list of choices to the UI */ public interface ISelectProvider { /** * Called by the CIM Framework before calling provideChoices(). * * @return true if the object can provide values */ public boolean canProvide(); /** * create a list of choices to display to the UI. The List will be modified * by the users selection and it will be passed to setUserSelection after user *input. * * * @throws ProviderException */ public List<SelectProviderOption> provideChoices() throws ProviderException; /** * * This method is called by the framework immediately after a user * makes a selection. * set the bean values to expose depending on the choice from the UI. * The selected options are flaged as Selected in the SelectProviderOption List * that was created from the Provide Method * @param pChoices The list of {@link SelectProviderOption}. Call isSelected on *each * {@link SelectProviderOption} to find what the user has selected. * * @throws ProviderException */ public void setUserSelection(List<SelectProviderOption> pChoices) throws ProviderException; /** * called by framework to override the minOccurs property * * @param pMinOccurs */ public void setMinOccurs(int pMinOccurs); /** * called by framework to override the maxOccurs property * * @param pMaxOccurs */ public void setMaxOccurs(int pMaxOccurs); /** * called by framework to get the minOccurs property * */ public int getMinOccurs(); /** * called by framework to get the maxOccurs property * */ public int getMaxOccurs(); }
The property name of the SelectProvider
has to match the property name of a task that you’re using the SelectProvider
for.