Document list - DocumentList

List of generated documents

Component properties

Eximee Designer property
Attribute name in Source
Description

List of documents

items

List of documents to present

Component presentation as a button (Download all documents) (section Basic properties)

allowDownloadingOfAllDocuments

Presentation of the component as a single button enabling download of all documents. Default value "false". Availability of the feature depends on the license and may not be available in all deployments.

Showing a loader while generating the document (section Basic properties)

async

Option that shows a loader while the document is being generated. Default value "false".

The availability of features depends on the license and may not be available in all deployments.

Collapsible document list (Other section)

GesDocumentList.foldable

The presentation of the document list is hidden in a collapsible section.

Availability of the feature depends on the license and may not be available in all deployments

More information about component properties: Common component properties

Illustration 1. Example appearance of the component on the form

After adding the component from the palette, the remaining configuration (concerning the list of displayed documents) should be set on the Sourcetab. Example configuration for the component:

<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 parts of the above configuration are to specify:

  • fileName="my_file.pdf" - in quotes we provide the document name shown on the template.

  • documentTemplate="my_template.xsl-" - in quotes we provide the name of the xsl template in the format name- where the asterisk denotes the highest version of the component.

If the artifact attached in the Document List component is fed with data from the application form, you should add a listener on the DocumentList component, e.g. for currentPageMid (or another element that changes on the form when navigating between pages). This will prevent a situation where data changes are not reflected in the printout.


Configuring the items property to feed the document list with a PDF printout generated using an XSL template

Eximee Designer property
Attribute name in Source
Description

Name of the generator

Generator name

"fop" - if the data feeding the printout comes from the application form. "fopFromVariable" - if the data feeding the printout is generated from a variable xmlDocument (in which case the component must also listen to that variable!)

Document name

File name

the document name shown on the template

Artifact name

Document template

name of the component in the format name-* where the asterisk denotes the highest version of the component (there is also the possibility to specify a particular version)

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.

The availability of features depends on the license and may not be available in all deployments.

Demo form: demoWebview

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 absent, the file name is displayed),

  • source — the type of source (values: "externalWeb" or "internalDoc"), a constant that tells the platform whether the source system is the CMS ("externalWeb") or nemo ("internalDoc").

Keep in mind that if the document list is to be presented in channels other than native, the service must return values correlated with the current channel. For example, returning document identifiers makes no sense for the desktop channel.

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

@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 provided list of links to the DocumentList component. Sets the source to externalWeb or internalDoc depending on the provided 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;
    }
}

Feeding the document list with data from two services

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 absent, the file name is displayed),

  • fileContent - worth adding if we want to support more than 1 file - it allows us to set a file identifier and distinguish files from each other,

  • source - the type of source, 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, we 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 take the form parameter1=value&parameter2=value...

Example script service codes:

Script 1

function callService(context) {
    var fileName = context.getFirstParameter('fileName');
    return [{'fileName': fileName, 'fileMimeType': 'application/pdf', 'source': 'externalDocument', 'documentServiceName': 'script:document_list_example2', 'documentServiceParams': 'parameter1=value1&parameter2=value2' }];
}
Script 2 (contains example encoded file data)

function callService(context) {
    var parameter1 = context.getFirstParameter('parameter1');
    var parameter2 = context.getFirstParameter('parameter2');
    var content = "JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNCjw8DQovVHlwZSAvQ2F0YWxvZw0KL091dGxpbmVzIDIgMCBSDQovUGFnZXMgMyAwIFINCj4+DQplbmRvYmoNCg0KMiAwIG9iag0KPDwNCi9UeXBlIC9PdXRsaW5lcw0KL0NvdW50IDANCj4+DQplbmRvYmoNCg0KMyAwIG9iag0KPDwNCi9UeXBlIC9QYWdlcw0KL0NvdW50IDINCi9LaWRzIFsgNCAwIFIgNiAwIFIgXSANCj4+DQplbmRvYmoNCg0KNCAwIG9iag0KPDwNCi9UeXBlIC9QYWdlDQovUGFyZW50IDMgMCBSDQovUmVzb3VyY2VzIDw8DQovRm9udCA8PA0KL0YxIDkgMCBSIA0KPj4NCi9Qcm9jU2V0IDggMCBSDQo+Pg0KL01lZGlhQm94IFswIDAgNjEyLjAwMDAgNzkyLjAwMDBdDQovQ29udGVudHMgNSAwIFINCj4+DQplbmRvYmoNCg0KNSAwIG9iag0KPDwgL0xlbmd0aCAxMDc0ID4+DQpzdHJlYW0NCjIgSg0KQlQNCjAgMCAwIHJnDQovRjEgMDAyNyBUZg0KNTcuMzc1MCA3MjIuMjgwMCBUZA0KKCBBIFNpbXBsZSBQREYgRmlsZSApIFRqDQpFVA0KQlQNCi9GMSAwMDEwIFRmDQo2OS4yNTAwIDY4OC42MDgwIFRkDQooIFRoaXMgaXMgYSBzbWFsbCBkZW1vbnN0cmF0aW9uIC5wZGYgZmlsZSAtICkgVGoNCkVUDQpCVA0KL0YxIDAwMTAgVGYNCjY5LjI1MDAgNjY0LjcwNDAgVGQNCigganVzdCBmb3IgdXNlIGluIHRoZSBWaXJ0dWFsIE1lY2hhbmljcyB0dXRvcmlhbHMuIE1vcmUgdGV4dC4gQW5kIG1vcmUgKSBUag0KRVQNCkJUDQovRjEgMDAxMCBUZg0KNjkuMjUwMCA2NTIuNz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