Hello everybody,
i have an issue: in my java application i want to create a document, but the "user" will not know, if a document with the same name already exist. So i want to increase the version number, if the document already exist. How can i solve this issue?
I have a while loop, which repaet until the document was created. In the catch section i will try to increase the version number, but then i need the uuid from the existing document, but how will i get the uuid? The process will be without user interaction, so the increase should be automatically, something like: actualVersionNumber + 1
i have an issue: in my java application i want to create a document, but the "user" will not know, if a document with the same name already exist. So i want to increase the version number, if the document already exist. How can i solve this issue?
I have a while loop, which repaet until the document was created. In the catch section i will try to increase the version number, but then i need the uuid from the existing document, but how will i get the uuid? The process will be without user interaction, so the increase should be automatically, something like: actualVersionNumber + 1
Code: Select all
OKMWebservices okm = OKMWebservicesFactory.newInstance(url, user, pass);
try {
InputStream is = null;
String docExtension = ".pdf";
Document doc = new Document();
String docPath = uploadFolder + "/" + docName + docExtension;
doc.setPath(docPath);
doc.setDescription("");
doc.getKeywords().add("");
doc.getKeywords().add("");
boolean created = false;
while (!created) {
try {
is = new FileInputStream(zugferdPdfFile.getAbsolutePath());
okm.createDocument(doc, is);
created = true;
} catch (ItemExistsException ex) {
// increase version number
// ??
} finally {
IOUtils.closeQuietly(is);
}
}
} catch (Exception ex) {
}