# Document list - DocumentList

List of generated documents

![](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/P3U3G22KMeqlhO1dNU0V/4k_files/image2025-5-16_13-24-5.png)

## Component properties

| Eximee Designer property                                                                                                          | Attribute name in the Source   | Description                                                                                                                                                                                                     |
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Document list**                                                                                                                 | items                          | List of documents to display                                                                                                                                                                                    |
| <p><strong>Display the component as a button</strong> (Download all documents)<br>(section <strong>Basic properties</strong>)</p> | allowDownloadingOfAllDocuments | Displaying the component as a single button that allows downloading all documents. Default value "false". Availability of the functionality depends on the license and may not be available in all deployments. |
| **Displaying the loader while generating a document** (section **Basic properties**)                                              | async                          | <p>An option that displays the loader while generating a document. Default value "false".</p><p>Availability of the functionality depends on the license and may not be available in all deployments.</p>       |
| **Collapsible document list** (Other section)                                                                                     | GesDocumentList.foldable       | <p>The document list display is hidden in a collapsible section.</p><p>Availability of the functionality depends on the license and may not be available in all deployments</p>                                 |

> More information about the component properties: [Common component properties](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/praca-z-komponentami-bazowymi/wspolne-wlasciwosci-komponentow)

![Figure 1. Example appearance of the component on the application](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/tgMErBPhyHKPJt9iL0LE/4k_files/image2025-5-16_13-22-33.png)

After adding the component from the palette, the remaining configuration (regarding the list of displayed documents) should be set in the **Source**. Example configuration for the component:

```xml
<p1:GesDocumentList id="GesDocumentList1" mid="GesDocumentList1" labelKey="GesDocumentList1.label" ariaLabelKey="GesDocumentList1.ariaLabel" ariaDescriptionKey="GesDocumentList1.ariaDescription" documentsAreNotReadyMessageKey="GesDocumentList1.documentsAreNotReadyMessage">
    <data:ListeningOn>
        <data:ListenField id="currentPageMid"/>
    </data:ListeningOn>
    <data:ClearOn/>
    <p1:GesDocumentList.layoutData>
        <ns6:GridData horizontalAlignment="FILL" horizontalSpan="16" verticalAlignment="CENTER"/>
    </p1:GesDocumentList.layoutData>
    <data:DocumentGeneratorItems>
        <data:DocumentGeneratorItem generatorName="fop" fileName="my_file.pdf" documentTemplate="my_template.xsl-*"/>
    </data:DocumentGeneratorItems>
    <data:GesDocumentList.foldable enabled="false"/>
</p1:GesDocumentList>
```

The most important thing in the above configuration is to set:

* fileName="my\_file.pdf" - in quotation marks we specify the document name displayed on the template.
* documentTemplate="my\_template.xsl-\**" -* in quotation marks we specify the xsl template name in the format `name-*`, where the asterisk means the highest version of the component.

If the artifact attached in the Document List component is fed with data from the application, you need to add a listener on the DocumentList component, e.g. on **currentPageMid** (or another element that changes in the application when moving between pages). This will avoid a situation where a data change is not reflected in the printout.

{% hint style="warning" %}
If the generated document is to be saved to DMS, you need to add this document to the document generator on the last page before submitting the application (more here: [Document Generator - Document Generator](https://github.com/Consdata/eximee-docs/blob/main/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/5-dokumenty-i-zaloczniki/generator-dokumentow-documentgenerator/README.md)), specifying the document in 'items'.
{% endhint %}

***

## Configuring the items property for feeding the document list with a PDF printout generated using an XSL template

<table><thead><tr><th width="200.4833984375">Eximee Designer property</th><th width="183.1165771484375">Attribute name in the Source</th><th>Description</th></tr></thead><tbody><tr><td><strong>Generator name</strong></td><td>Generator name</td><td>"fop" - if the data used to generate the printout comes from the application. "fopFromVariable" - if the data used to generate the printout is generated from a variable <strong>xmlDocument</strong> (in that case the component must also listen to this variable!)</td></tr><tr><td><strong>Document name</strong></td><td>File name</td><td>document name displayed on the template</td></tr><tr><td><strong>Artifact name</strong></td><td>Document template</td><td>component name in the format name-* where the asterisk means the highest version of the component (it is also possible to specify a specific version)</td></tr></tbody></table>

## Feeding the document list with data from a service

The component can be fed with data from a service attached to the component or to the page.

### Feeding the document list with links from a service (external links)

{% hint style="info" %}
Availability of the functionality depends on the license and may not be available in all deployments.
{% endhint %}

{% hint style="info" %}
Demo application: demoWebview
{% endhint %}

We attach the service to the component in the standard way via **EXTERNAL DATA SOURCE** (External Data Source). It should return (endpoint names are bolded):

* **documentLink** — a list of links or document identifiers that we want to display,
* **fileName** — the file name to download,
* **documentLabel** — optionally, a label displayed next to the file (if there is none, the file name is displayed),
* **source** — source type (values: "externalWeb" or "internalDoc"), a constant that lets the platform know whether the source system is cms ("externalWeb") or nemo ("internalDoc").

Note that if the document list is to be displayed in channels other than native, the service must return values correlated with the current channel. E.g. returning document identifiers makes no sense for the desktop channel.

Example service code (Java, OSGI/Charon component):

{% code expandable="true" %}

```java
@Component
@Service(AbstractServiceProxy.class)
public class DemoDocumentLinkServiceProxy extends AbstractServiceProxy {
    static final String INPUT_LINK_LIST = "linkList";
    static final String INPUT_IS_EXTERNAL = "isExternalSource";
    static final String OUTPUT_SOURCE = "source";
    static final String OUTPUT_LINK = "link";
    static final String OUTPUT_FILE_NAME = "fileName";
    static final String EXTERNAL_WEB_SOURCE = "externalWeb";
    static final String INTERNAL_DOC = "internalDoc";

    private static final Logger LOGGER = LoggerFactory.getLogger(DemoDocumentLinkServiceProxy.class);
    private static final Logger SENSITIVE_LOGGER = SensitiveLoggerFactory.getSensitiveLogger(DemoDocumentLinkServiceProxy.class);

    public DemoDocumentLinkServiceProxy() {
        this.name = "DemoDocumentLinkServiceProxy";
        this.description = "Returns the passed link list to the DocumentList component. Sets externalWeb or internalDoc as the source depending on the passed isExternalSource";
        this.inputFields.add(new ServiceProxyField(INPUT_LINK_LIST));
        this.inputFields.add(new ServiceProxyField(INPUT_IS_EXTERNAL));
        this.outputFields.add(new ServiceProxyField(OUTPUT_SOURCE));
        this.outputFields.add(new ServiceProxyField(OUTPUT_LINK));
        this.outputFields.add(new ServiceProxyField(OUTPUT_FILE_NAME));
    }

    @Override
    public List<Map<String, String>> callService(Map<String, List<String>> values) throws ServiceProxyException {
        LOGGER.info(">> Service called with values: {}", values);
        SENSITIVE_LOGGER.info(">> Service called with values: {}", values);
        List<Map<String, String>> result = new ArrayList<>();
        final Boolean isExternal = getBooleanValue(values, INPUT_IS_EXTERNAL, true);
        final String source = isExternal ? EXTERNAL_WEB_SOURCE : INTERNAL_DOC;
        final List<String> inputLinkList = values.get(INPUT_LINK_LIST);
        for (String inputLink : inputLinkList) {
            result.add(createEntry(inputLink, source));
        }
        LOGGER.info("<< Service finished with result: {}", result);
        SENSITIVE_LOGGER.info("<< Service finished with result: {}", result);
        return result;
    }

    private Map<String, String> createEntry(final String link, final String source) {
        Map<String, String> entry = new HashMap<>();
        entry.put(OUTPUT_SOURCE, source);
        entry.put(OUTPUT_LINK, link);
        entry.put(OUTPUT_FILE_NAME, (isNotBlank(link) && link.contains("/")) ? substringAfterLast(link, "/") : link);
        return entry;
    }
}
```

{% endcode %}

### Feeding the document list with data from two services

{% hint style="warning" %}
For the functionality to work, the flag server.features.externalDocumentResourceProviderEnabled=true must be set in webforms.xml
{% endhint %}

The content of the PDF file encoded in Base64 was passed to the component using two scripts:

* *document\_list\_example1* - the script retrieves the input parameter fileName from the application and returns output data for the component.
* *document\_list\_example2* - the script retrieves the parameters passed from the first script and returns the file content in Base64.

We attach the first service to the component in the standard way via **EXTERNAL DATA SOURCE** (External Data Source). It should return (endpoint names are bolded):

* **fileName** - the file name to download,
* **fileMimeType** - the file type to download,
* **documentLabel** - an optional label displayed next to the file (if there is none, the file name is displayed),
* **fileContent** - should be added if we want to support more than 1 file - it allows us to set the file identifier and distinguish files from one another,
* **source** - source type, in this case the value '**externalDocument**',
* **documentServiceName** - the name of the second service that is called to fetch the file content. If it is a script service, add the prefix **script:** (without this prefix the system will look for a Charon/OSGI service),
* **documentServiceParams** - optional parameters that we want to pass to the service fetching the file content. They have the form parameter1=value\&parameter2=value...

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FfOGCp2PvvYnJ7MYYq1PR%2Fobraz.png?alt=media&#x26;token=bbb7dd82-ae8c-40be-84bc-0032002b1db0" alt=""><figcaption><p><em><strong>Figure 1.</strong> Attaching output parameters</em></p></figcaption></figure>

Example codes of script services:

{% code title="document\_list\_example1.js" %}

```javascript
function callService(context) {
    const fileName = context.getFirstParameter('fileName');
    return [{ fileName: fileName, fileMimeType: 'application/pdf', source: 'externalDocument', documentServiceName: 'script:document_list_example2', documentServiceParams: 'parameter1=value1&parameter2=value2' }];
}
```

{% endcode %}

{% code title="document\_list\_example2.js" %}

```javascript
function callService(context) {
    const content = "JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNCjw8DQovVHlwZSAvQ2F0YWxvZw0KL091dGxpbmVzIDIgMCBSDQovUGFnZXMgMyAwIFINCj4+DQplbmRvYmoNCg0KMiAwIG9iag0KPDwNCi9UeXBlIC9PdXRsaW5lcw0KL0NvdW50IDANCj4+DQplbmRvYmoNCg0KMyAwIG9iag0KPDwNCi9UeXBlIC9QYWdlcw0KL0NvdW50IDINCi9LaWRzIFsgNCAwIFIgNiAwIFIgXSANCj4+DQplbmRvYmoNCg0KNCAwIG9iag0KPDwNCi9UeXBlIC9QYWdlDQovUGFyZW50IDMgMCBSDQovUmVzb3VyY2VzIDw8DQovRm9udCA8PA0KL0YxIDkgMCBSIA0KPj4NCi9Qcm9jU2V0IDggMCBSDQo+Pg0KL01lZGlhQm94IFswIDAgNjEyLjAwMDAgNzkyLjAwMDBdDQovQ29udGVudHMgNSAwIFINCj4+DQplbmRvYmoNCg0KNSAwIG9iag0KPDwgL0xlbmd0aCAxMDc0ID4+DQpzdHJlYW0NCjIgSg0KQlQNCjAgMCAwIHJnDQovRjEgMDAyNyBUZg0KNTcuMzc1MCA3MjIuMjgwMCBUZA0KKCBBIFNpbXBsZSBQREYgRmlsZSApIFRqDQpFVA0KQlQNCi9GMSAwMDEwIFRmDQo2OS4yNTAwIDY4OC42MDgwIFRkDQooIFRoaXMgaXMgYSBzbWFsbCBkZW1vbnN0cmF0aW9uIC5wZGYgZmlsZSA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NCg0KMTAgMCBvYmoNCjw8DQovQ3JlYXRvciAoUmF2ZSBcKGh0dHA6Ly93d3cubmV2cm9uYS5jb20vcmF2ZVwpKQ0KL1Byb2R1Y2VyIChOZXZyb25hIERlc2lnbnMpDQovQ3JlYXRpb25EYXRlIChEOjIwMDYwMzAxMDcyODI2KQ0KPj4NCmVuZG9iag0KDQp4cmVmDQowIDExDQowMDAwMDAwMDAwIDY1NTM1IGYNCjAwMDAwMDAwMTkgMDAwMDAgbg0KMDAwMDAwMDA5MyAwMDAwMCBuDQowMDAwMDAwMTQ3IDAwMDAwIG4NCjAwMDAwMDAyMjIgMDAwMDAgbg0KMDAwMDAwMDM5MCAwMDAwMCBuDQowMDAwMDAxNTIyIDAwMDAwIG4NCjAwMDAwMDE2OTAgMDAwMDAgbg0KMDAwMDAwMjQyMyAwMDAwMCBuDQowMDAwMDAyNDU2IDAwMDAwIG4NCjAwMDAwMDI1NzQgMDAwMDAgbg0KDQp0cmFpbGVyDQo8PA0KL1NpemUgMTENCi9Sb290IDEgMCBSDQovSW5mbyAxMCAwIFINCj4+DQoNCnN0YXJ0eHJlZg0KMjcxNA0KJSVFT0YNCg==";
    return [{ output: content }];
}
```

{% endcode %}

{% hint style="warning" %}
The file content itself must be encoded in base64 and returned under a parameter named **output**. Otherwise, the document list will not download the attachment.
{% endhint %}

{% hint style="info" %}
Demo application: demoDocuments
{% endhint %}
