Page 1 of 1

Simple autotagging automation

PostPosted:Fri Feb 19, 2016 1:21 pm
by openkm_user
Hi,

I am not a java developer, I am trying to use a script for automation purpose. I used the following example,
http://wiki.openkm.com/index.php/Simple_autotagging

My requirement is simple, if there is a document with name _default (for example, documentname_default) uploaded to DMS, I need the document tagged with download Keyword. I would be grateful if someone can help with a working script.

Thanks!

Re: Simple autotagging automation

PostPosted:Sat Feb 20, 2016 11:03 am
by jllort
You only need two API calls, it's quite easy.
Code: Select all
String systemToken = DbSessionManager.getInstance().getSystemToken();
Document doc = OKMDocument.getIntance().getProperties(null, uuid);

if (doc.getName().contains("_default")) {
     	OKMProperty.getInstance().addKeyword(null, uuid, String keyword)
}
For future questions, take a look at API documentation ( java doc ):
http://docs.openkm.com/apidoc/ ( you must be interested on classes into com.openkm.api.* )

Re: Simple autotagging automation

PostPosted:Mon Feb 22, 2016 10:03 am
by openkm_user
Hi,

Thank you once again, but I found an easier way, enabled automation,
http://wiki.openkm.com/index.php/Enable_automation

Then it's just simple validation and action,
Capture.JPG
Capture.JPG (38.19 KiB) Viewed 2108 times
No need script and it works.

Thanks for the great tool!

Re: Simple autotagging automation

PostPosted:Wed Feb 24, 2016 12:15 pm
by jllort
Yes, It will get the same result.