ValueListProvider backed by Value list Document

Hi community,

I have a @ParametersInfo class that uses a @DropDownList valueListProvider with hard-coded values returned by getValueList(). Is it possible to get these values from, for example, a Value list Document instead? I tried to use SelectionUtil:getValueListByIdentifier, but RequestContextProvider.get().getSiteContentBaseBean() returns null (when trying to edit a catalog item from the Channel Manager)

Kind regards,

I got it working using the following code, but I’m hoping there’s a less ‘low level’ way:

public class MyValueListProvider extends GenericValueListProvider {

    public Map<String, String> getValueList() {
        try {
            HstRequestContext context = RequestContextProvider.get();
            Node rootNode = context.getSession().getRootNode();
            Node valueListNode = JcrUtils.getNodeIfExists(rootNode, "content/documents/administration/valuelists/myvaluelist");
            HstQueryResult result = context.getQueryManager().createQuery(valueListNode, ValueList.class).execute();
            ValueList valueList = (ValueList) result.getHippoBeans().nextHippoBean();
            return SelectionUtil.valueListAsMap(valueList);
        } catch (Exception e) {
            log.error("Error resolving valuelist", e);

        return new HashMap<>();

Not sure about your use case but did you see the Spring instantiated ValueListManager to make ValueLists available in the delivery tier?


Hi Jeroen,

Thank you for your reply. The ValueListManager you mention is what I initially tried (indirectly through SelectionUtil). Should it be possible to getSiteContentBaseBean() when editing a catalog item from the Channel Manager? Any idea why it would return null for me?

Kind regards,

Hi @Davey_Chu,

Did you have to do anything special to get access to the RequestContextProvider.get()? When I try to use your low level solution I get the error below.

java.lang.IllegalStateException: No content bean annotation class resource path found.
[INFO] [talledLocalContainer] at org.hippoecm.hst.content.tool.DefaultContentBeansTool.getAnnotatedClasses(
[INFO] [talledLocalContainer] at org.hippoecm.hst.content.tool.DefaultContentBeansTool.getObjectConverter(
[INFO] [talledLocalContainer] at
[INFO] [talledLocalContainer] at
[INFO] [talledLocalContainer] at
[INFO] [talledLocalContainer] at
[INFO] [talledLocalContainer] at com.staplesconnect.cms.components.ArticleCategoryValueListProvider.(
[INFO] [talledLocalContainer] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Note that you need to setup a few things in the cms webapp to get hold of a valuelist object as bean:
in your web.xml


Add this to your cms-dependencies.xml


And try again