Difference between revisions of "OMR scripting"

From OpenKM Documentation
Jump to: navigation, search
Line 1: Line 1:
 
The script process an image with OMR engine from Automation scripting feature, each time new document is uploaded. With minimal changes can be used in conjuntion with crontab.
 
The script process an image with OMR engine from Automation scripting feature, each time new document is uploaded. With minimal changes can be used in conjuntion with crontab.
  
* omId value is the template id
+
* '''omId''' value is the '''template id'''.
  
 
<source lang="java">
 
<source lang="java">

Revision as of 19:59, 1 May 2013

The script process an image with OMR engine from Automation scripting feature, each time new document is uploaded. With minimal changes can be used in conjuntion with crontab.

  • omId value is the template id.
import com.openkm.bean.Document;
import com.openkm.module.db.stuff.DbSessionManager;
import com.openkm.api.OKMDocument;
import com.openkm.api.OKMRepository;
import com.openkm.omr.OMRHelper;

long omId= 4;
String systemToken = DbSessionManager.getInstance().getSystemToken();
String docPath = OKMRepository.getInstance().getNodePath(systemToken, uuid);
Document doc = OKMDocument.getInstance().getProperties(systemToken, docPath);
if (OMRHelper.isValid(doc)) {
	OMRHelper.processAndStoreMetadata(omId, uuid);	
}

Example

Create a automation task based on event document creation and post execution.

Okm user guide 435.png

With one validation based on folder path and one scripting action.

Okm user guide 436.png

The script value is:

Okm user guide 437.png

Where omId value is template id;

Okm user guide 439.png

Each time document is uploaded to folder path ( or subfolders ) the image is processed by OMR.

Okm user guide 438.png