cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

HashTable as a function parameter from JAVA to ACL

sambasivarao.me
1-Newbie

HashTable as a function parameter from JAVA to ACL

Hi,

We are trying to pass HashTable as a function parameter from JAVA to ACL.
Following is the sample code snippet for the same. We are able to pass
the HashTable from java to ACL and also able to print the HashTable as
{KEY=VALUE} .

*SOS.java*:
Hashtable<string,string> hashTable = new
Hashtable<string,string>();
hashTable.put("ONE", "1111");
hashTable.put("TWO", "2222");
String cmd = "ditadocs::sos_link_insert(" + "\" + text +
"\" +"," + id + ",\"+hashTable+"\"+")";
Acl.eval(cmd);


*ditadocs.acl:*
function sos_link_insert($docname,$doc,$selectedTopics){
consoleT("DOCNAME:".$docname); /#DOCNAME:whatIsDocument1/
consoleT("DOC:".$doc); /#DOC40/

consoleT("SelectedTopics".$selectedTopics);*/#SelectedTopics{TWO=2222,
ONE=1111}/*

local arr[];
local i;

# Convert the ArrayList object to an ACL array
local size = java_array_to_acl($selectedTopics, $arr);
consoleT("SIZE".$size);

///#Exception occurred during event dispatching://
// #com.arbortext.epic.AclException: [A11276] Badly formed number
"{TWO=two, ONE=one}" in expression/

for ($junk in $selectedTopics) {
local $temp = $selectedTopics[$junk];
consoleT("TEMP".$temp);
}
/ #com.arbortext.epic.AclException: [A11284] Operand of "in" operator
must be array name: selectedTopics//
// #(at line 359 of file "C:\Program Files
(x86)\Arbortext\Editor\custom\init\ditadocs.acl")/

But some how, I could not able to iterate through HashTable in our ACL
function. Can we pass Hashtable as a function parameter? If so, Please
suggest on iterate through HashTable in ACL function.


Thanks,
Samba.
1 REPLY 1

The way I've done this in the past is to set the map to a known static variable that's accessible from ACL.

AclArrayBridge.setAclMap(map);

Then call a wrapper for the ACL function you want to call; that function would retrieve the map using something like this:

local map[];
local jmap = java_static("com.mycompany.AclArrayBridge", "getAclMap");
If (jmap) {
java_array_to_acl(map, jmap);
}
java_delete(jmap);
# Do something with map[]

Chris
Chris Nitchie
(734) 330-2978
chris.nitchie@oberontech.com<">mailto:chris.nitchie@oberontech.com>
www.oberontech.com

[cid:image001.jpg@01CE6901.A84DFC50]

[cid:image005.png@01CE6903.8131DC70]<">https://twitter.com/oberontech>

[cid:image006.png@01CE6903.8131DC70]<">http://www.linkedin.com/company/oberon-technologies>






Top Tags