Table of Contents

Attachment manager

Attachments (~binary files) can be attached to an entity, which implements AttachableEntity interface. This entity is called attachment owner. Any owner can have more attachments. When owner is deleted, then all his attachments should be deleted too - override owner service delete method properly.

Attachments metadata are stored in database:

AttachmentManager features:

Attachment binary data are stored on filesystem by default implementation (DefaultAttachmentManager). Different AttachmentManager can be added to store binary data in other document management system (DMS).

Default implementation

DefaultAttachmentManager stores binary files on file system. Path to storage on file system has to be configured. Default storage path is under user home directory (System.getProperty("user.home")/idm_data).

Configure storage path, where binary files will be saved. Otherwise will be storage created automatically under user home directory by default (System.getProperty("user.home")/idm_data) - it's not recommended to use this location in production. Warning about default storage location usage is written into logs, when attachment is saved.

When binary file is saved, then uuid content identifier (contentId) is generated and used as file name on filesystem with .bin extension. Content path in storage is prepared from actual date with pattern yyyy/MM/dd/uuid.bin. So content will be saved on path e.g. <storagePath>/2017/12/01/e963dd20-0a10-4052-8355-1425d021299a.bin.

Temporary files and attachments

Attachment manager is responsible for maintaining temporary files and temporary attachments. Temporary files are used e.g. by report renderers, when output data are created and downloaded. Temporary attachments are used for uploading new files into CzechIdM - e.g. for extended attributes with persistent type ATTACHMENT. Attachment is uploaded as temporary and when original form is submitted (owner's form), then the temporary attachment is moved under currently persisted owner (~renamed). When owner is deleted, all attachments are deleted too, but when owner's form is not submitted, then attachments remains marked as temporary.
Old temporary files and temporary attachments created by this manager are purged automatically (see temporary file time to live configuration).

Path to temporary files on file system has to be configured too (same as above). Default temp path is under storage path configured above (getStoragePath()/temp). When storage path above is configured, then this configuration can be leaved empty - folder /temp will be created automatically in storage path.

Configuration

All configuration properties are described in backend congifuration.

Future development