Hello Ivy Team!
I have a question regarding the cms directory. I am writing a PDF file at runtime to the cms. Locally on my AxonIvy designer, the file writes and I can read It , but does not work on Axon ivy server itself. I want to find the cms directory on the server. I am using a Java method to write the file maybe am I doing something wrong below I have included a CMS write example. I have found https://developer.axonivy.com/doc/10.0/designer-guide/cms/writing.html. But I cannot seem to find that directory anywhere.
Here is the CMS write example code :
public void addFileToCMS(final FileUploadEvent event, final String newfileName, final String cmsDirectory) {
UploadedFile uploadedFile = event.getFile();
String originalFileName = uploadedFile.getFileName();
ContentObject baseFolder = Ivy.cms().root().child().folder(cmsDirectory);
String baseName = StringUtils.substringBeforeLast(newfileName, ".");
String fileExtension = StringUtils.substringAfterLast(originalFileName, ".");
ContentObject newFile = baseFolder.child().file(baseName, fileExtension);
ContentObjectValue cov = newFile.value().get();
try (InputStream inputStream = uploadedFile.getInputStream()) {
cov.write().inputStream(inputStream);
} catch (IOException e) {
Ivy.log().error("Failed to upload", e);
}
}
Designer version 10.0.19, Engine version 10