UPD:
If your problem still not solved, i can offer you check this topic. In short, you need just transform FileDescription
into FileRef
as i said before.
Steps:
- Add service task with
SpringBean
type before EntityDataTask
- Extract your
FileDescription
and transform it inside spring bean
import io.jmix.bpm.entity.FileDescription;
import io.jmix.core.FileRef;
import io.jmix.core.FileStorage;
import org.springframework.stereotype.Component;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@Component
public class ProcessFileManager {
private FileStorage fileStorage;
public ProcessFileManager(FileStorage fileStorage) {
this.fileStorage = fileStorage;
}
public FileRef saveFileToFileStorage2(FileDescription fileDescription) throws IOException {
try (InputStream is = new ByteArrayInputStream(fileDescription.getFileContent())) {
FileRef fileRef = fileStorage.saveStream(fileDescription.getFileName(), is);
return fileRef;
}
}
}
-
Put into service task’s method argument your
FileDescription
(named fileVar
and marked as process variable)
-
Publish
ServiceTask
result as process variable (named fileRefVar
in screenshot)
As i said, you just need to transform FileDescription
into FileRef
.
-
Use your new
FileRef
by process variable named fileRefVar
Otherwise, you can use ServiceTask
inside of EntityDataTask
and taransoform and create necessary Entity insidea SpringBean manually to prevent bpmn schema
complication.
If you need more detail explanation/demo, attach your demo project.
Regard, Dmitry