Skip to main content

acs.genericlists: Authorable Title/Value Lists

Module README · Repository · Original ACS Commons Generic Lists

acs.genericlists lets authors maintain a page of ordered title/value pairs (shared dropdown options, country codes, status labels, ...) through a normal Touch UI dialog, and lets any other code read that list back via Page#adaptTo(GenericList.class). It replaces ACS Commons' Generic Lists with a Cloud Service-friendly layout under /content/generic-lists instead of the legacy /etc/acs-commons/lists root.

What you get​

  • core - GenericList / GenericListImpl / GenericListAdapterFactory: adapt a Page whose content resource type is acs-genericlists/components/utilities/genericlist and call getItems() or lookupTitle(value[, locale]).
  • ui.apps - Key/Value List component with a nested composite-multifield dialog and a datasource servlet for Granite select / radiogroup; the generic-list editable template (restricted to /content/generic-lists(/.*)?) ships in ui.content.

Rows are stored as items/itemN (jcr:title, value, optional translations); ACS-style ./list/ content is still read. Authoring uses a standard component dialog instead of ACS Commons' MCP-generated list editor.

When to use it​

Use generic lists when:

  • Multiple dialogs need the same option set and authors should maintain it without a code deploy.
  • Backend code needs to resolve a stored value to a display title (optionally localized).
  • You want shared dropdown data without hardcoding options in every _cq_dialog.

Prefer Tags / taxonomies for hierarchical, multilingual content classification. Prefer a plain dialog select when the option set is tiny and never changes outside releases.

Example: read a list in Java​

Page listPage = pageManager.getPage("/content/generic-lists/countries");
GenericList list = listPage.adaptTo(GenericList.class);

for (GenericList.Item item : list.getItems()) {
// item.getTitle(), item.getTitle(locale), item.getValue()
}

String title = list.lookupTitle("de"); // e.g. "Germany"

Example: feed a dialog select​

<country
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Country"
name="./country">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="acs-genericlists/components/utilities/genericlist/datasource"
path="/content/generic-lists/countries"/>
</country>

Authoring flow​

  1. Install the aggregate all package.
  2. Create pages under /content/generic-lists with the Generic List template.
  3. Edit the Key/Value List component on the page and add title/value rows.
  4. Point dialog datasources (or Java adapters) at those list page paths.

What was not ported​

  • ACS Commons' MCP-generated list editor and the /generic-lists.html console.
  • A page render script - a list page is a pure data container.

See the module README for the full rationale.

Building and deploying​

mvn clean install # build
mvn clean install -PautoInstallBundle # deploy core
mvn clean install -PautoInstallPackage # deploy ui.apps packages