• Beanshell uuid variable

  • 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.
 #52153  by thatguy
 
Just wanted to verify something in regards to automation and the build in beanshell. Example below:

OKMPropertyGroup.getInstance().setPropertySimple(null, uuid, "okg:IandT", "okp.IandT.link", http);

I have a script run when someones adds a document to a metadata group. This script puts in a html formatted string into one of the metadata fields (click the link to get to the associated ticket in jira).

I am using the variable uuid (injected directly, object unique identify , from documentation). When the script runs, is it setting the "uuid" string variable to the uuid of the document that was just added to the metadata? Whenever i run my script with uuid (via automation), it always overflows with bsh target exceptions. When i run the same code/script with a hardcoded document uuid, script has no issues. Am i using the uuid correctly? Or is there another way to get the uuid of the document that the automation beanshell script is working on? Thanks!
 #52156  by thatguy
 
Edit:
I found i can use this, OKMRepository.getInstance().getNodeUuid(null, "your path here");. Really what i am trying to do is have the automation script act on the current document getting added to the metadata group. How can the automation script know the current documents uuid or path without being hardcoded?

Edit2: Using any of the below built-in variables results in null pointer or overflow errors.

Variable Status Description
systemToken The system token
node Involved node (NodeDocument, NodeFolder, etc.. ) - Null pointer
uuid Object unique identify - Overflow error but script still executes, so it is receiving the
actual "uuid" from this variable
file Only available when uploading or updating a new document content. - null pointer
userId The user id (not tested)
nodeUuid deprecated Object unique identify (overflow)
nodePath deprecated Object path (overflow)

String uuid = AutomationUtils.getUuid(env); also leads to overflow error

Once again, i am just trying to have the automation script happen and do things with the document that was just added to a metadata group. Any help, greatly appreciated.
Code: Select all
//Create html link to Jira
http= "<a href=http://jira.dev.net/browse/"+projectname+"/"+projectname+"-"+ticketnumber+">http://jira.dev.net/browse/"+projectname+"/"+projectname+"-"+ticketnumber+"</a>";

//Add link to metadata field
OKMPropertyGroup.getInstance().setPropertySimple(null, uuid, "okg:IandT", "okp.IandT.link", http);
Code: Select all
Sourced file: inline evaluation of: ``package com.openkm; import com.openkm.api.*; import com.openkm.core.*; import . . . '' : Method Invocation setPropertySimple : at Line: 38 : in file: inline evaluation of: ``package com.openkm; import com.openkm.api.*; import com.openkm.core.*; import . . . '' : .setPropertySimple ( null , uuid , "okg:IandT" , "okp.IandT.link" , http ) Target exception:
Target exception: java.lang.StackOverflowError
'''

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.