Difference between revisions of "OMR scripting"
From OpenKM Documentation
(Created page with '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. <…') |
|||
(12 intermediate revisions by 2 users not shown) | |||
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'''. | ||
+ | |||
+ | '''Code:''' | ||
<source lang="java"> | <source lang="java"> | ||
+ | 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; | import com.openkm.omr.OMRHelper; | ||
− | OMRHelper.processAndStoreMetadata( | + | 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); | ||
+ | } | ||
</source> | </source> | ||
Line 15: | Line 29: | ||
[[File:Okm_user_guide_436.png|center]] | [[File:Okm_user_guide_436.png|center]] | ||
+ | |||
+ | The '''script value''' is: | ||
+ | |||
+ | [[File:Okm_user_guide_437.png|center]] | ||
+ | |||
+ | Where '''omId value''' is '''template id'''; | ||
+ | |||
+ | [[File:Okm_user_guide_439.png|center|900px]] | ||
+ | |||
+ | |||
+ | Each time document is uploaded into folder path ( or subfolders ) the image is processed by OMR engine. | ||
+ | |||
+ | [[File:Okm_user_guide_438.png|center]] | ||
[[Category: Utilities]] | [[Category: Utilities]] |
Latest revision as of 12:34, 2 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.
Code:
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.
With one validation based on folder path and one scripting action.
The script value is:
Where omId value is template id;
Each time document is uploaded into folder path ( or subfolders ) the image is processed by OMR engine.