• Keywords, versions and folder handling

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #43410  by greengold
 
Hi,
I'm affraid I need to ask you for clarification of multiple aspects here:

Document versioning:
What I do is that when I upload a new version of the document, I create Version obj, set it's name and then get's a document by 'uuid' assign it version object and then I call "setProperties" for setting the document new document properties. Code:
Code: Select all
Version v = new Version();
v.setActual(true);
v.setName(version);

Document document = okmWebSrv.getOkmService().getDocumentProperties(docUUID);
document.setActualVersion(v)

okmWebSrv.getOkmService().lock(docUUID);
okmWebSrv.getOkmService().checkin(docUUID, data, "");
okmWebSrv.getOkmService().lock(docUUID);
okmWebSrv.getOkmService().setProperties(document);
okmWebSrv.getOkmService().unlock(docUUID);
thing is that version is never set. it keep's incrementing by minor number regardless of what I set.

Folder manipulation:
First, when I create a folder, I need it to have some keywords assigned, by of which I want to be able to do search later. This is how I create folder:
Code: Select all
Folder folder = new Folder();
folder.setPath(currentTemplate.getName());
folder.setKeywords(currentTemplate.getKeywords());
created = okmWebSrv.getOkmService().createFolder(folder);
and indeed, folder is being ceated but with no keywords assigned, that I can see in the UI. (same with the document keywords)

Ghost folders:
What has surprised me is that as I have created folder structure, I have kept the UUID of lowermost folder in the hierarchy. Than I deleted the uppermost folder of this hierarchy in the UI and whole tree has dissapeared - as expected. Weird thing is that when I supply that UUID I kept to the:
Code: Select all
okmWebSrv.getOkmService().getFolderProperties({UUID});
I can still see this folder existing! Even document creation under this (deleted) folder fails with "ItemExistsException" as if it would exists. I don't see it in the UI, even after tomcat restart.

I'm using local instance of OpenKM version 6.3.2 build 8289 with Java openKM SDK.
Thanks for helping!
 #43420  by jllort
 
About document version, really when you do a checkin, it's automatically set a new version ( core does it for you, there's a specific logic for the whole repository what is applied ). About setProperties, this is a method what usually cause confusion, read here about what it changes and what not here https://docs.openkm.com/kcenter/view/ok ... Properties

You must set keywords later ( there are two steps, first create object, then set keyword ). Take a look here https://docs.openkm.com/kcenter/view/ok ... addKeyword

About methods like create(Folder fld) create(Document) etc... although you see we use a complex element for creating, really we only use few vars from the used Object. Almost methods are thinked to perform atomic actions. Take a look here https://docs.openkm.com/kcenter/view/ok ... older.html ( compare create and createSimple methods ).
These methods had been created from the first OpenKM versions and for compatibility reasons we still work with them, but really the initial idea was not use all Folder vars for creating a node. We know it creates some confusion.

About delete, take in consideration delete a node really moves to trash ( openkm node ) and purge is what really makes it disappear definitively.

If you want to start playing with 6.3.3 the source code is available at https://github.com/openkm/document-management-system ( only it remain release the files, the code is yet complete for the official release )

Hope I had provided you some clue for working with API.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.