Introduction
This How to article focuses on adding documents and its metadata to a case, the same way you can add an uploaded file to a case. When opening the case, you want to see all the files belonging to that case. For displaying the files an AQ_InstanceList container is used:
In this situation, a case is represented as an Aggregate, see Designing cases using aggregates.
Example
In this example a Blueriq Document will be stored in a Document instance, which is related to a case (in this case a permit, in Dutch 'vergunning'). This ERD describes the relation:
First step is to create the file from the Document and store it on the filesystem, second step is to get all necessary metadata to display in the list. This results in this flow:
The first servicecall is of type 'AQ_Document_Generate', the second of type 'AQ_File_GetMetaData'.
AQ_Document_Generate
Service configuration
Shown below is the screen for the AQ_Document_Generate service.
Parameters
In AQ_Document_Generate all parameters are discussed. In this article, the focus is on the following parameters:
- CreateInstance
Because the document/file has to appear in an instancelist, I have to create a new instance. In this example a 'Document' instance is created, based in on the entity mentioned in the FileID parameter. - Relation
The new Document instance will be added to the Vergunning.Bewijs relation, because in my example the instancelist only contains 'Vergunning' documents. - Persistence
Persistence has to be permanent - in this example on the filesystem - because the file has to be kept in storage due to audittrails. Temporary persistence in memory isn't a suitable solution, because the file will be gone when restarting the Runtime for example.
In the example above a Document instance is created and added to the Vergunning.Bewijs relation. After generating the file the metadata filename and filetype are set, as well as the file ID.
In the AQ_Document_Generate service you cannot specify all metadata from the file as information of the Document instance. To retrieve this information - like file size, date created and created by - from the created file, the service AQ_File_GetMetaData can be used.
AQ_File_GetMetadata
Service configuration
Shown below is the screen for the AQ_File_GetMetadata service.
Parameters
In AQ_File_GetMetaData all parameters are discussed. In this example only the filetype, size and creationdate are added as information to the Document instance, the rest is already known from the AQ_Document_Generate service or isn't applicable.