BPM file type to JMIX.core FileRef type conversion

How can io.jmix.bpm.entity.FileDescription (file attachment in a business process) be converted to io.jmix.core.FileRef?

Because setting the value of the FileRef (entity) = FileDescription (process variable) produces an error.

Thanks in advance.

Also is it possible to store BPM attached files on the filesystem or in the cloud?

Hello,

File Description convert

Simply, you can convert io.jmix.bpm.entity.FileDescription into io.jmix.core.FileRef only inside java code. So, you need to use ServiceTask to transform FileDescription into FileRef:

public FileRef fileRefFromFileDescription(FileDescription fileDescription) throws IOException {
         try (InputStream is = new ByteArrayInputStream(fileDescription.getFileContent())) {
            FileRef fileRef = fileStorage.saveStream(fileDescription.getFileName(), is);
            return fileRef;
        }
    }

In details, i answer it to you here.

About storing files in cloud.

Yes, this is possible and easy in Jmix.
Here documentation about cloud file storage. Our add-on capible with AWS S3 Format. So, you can use MINIO, S3, GCloud etc (all S3 back-capable services).