IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this community and its apps will no longer be available. More details available on our FAQ.
Topic
  • 5 replies
  • Latest Post - ‏2019-08-15T10:07:46Z by franzw
Prashant Nark
Prashant Nark
4 Posts

Pinned topic Map and List relevant data items not working as expected

‏2019-08-14T10:43:15Z | 7.0.1.7 isim

I have a javascript extension that returns HashMap<Integer, List<String>>.


The below code works fine in workflow javascript node.

<working_script>
    var dnMap = <extension call>

    var dnMap = approverMap.get();
    activity.auditEvent("dnMap.size " + dnMap.size());
    activity.auditEvent("dnMap.keySet " + dnMap.keySet());
    var keys = dnMap.keySet();
    var it = keys.iterator();
    while(it.hasNext())
    {
        activity.auditEvent(dnMap.get(it.next()));
    }
</working_script>
 

However, I have a requirement to use this map across workflow nodes so created relevant data item as Map and set above-returned map.

<not_working_script>
    var dnMap1 = <extension call>
    approverMap.set(dnMap1);

    var dnMap = approverMap.get();
    activity.auditEvent("dnMap.size " + dnMap.size());
    activity.auditEvent("dnMap.keySet " + dnMap.keySet());
    var keys = dnMap.keySet();
    var it = keys.iterator();
    while(it.hasNext())
    {
        activity.auditEvent(dnMap.get(it.next()));
    }
</not_working_script>
 

But after getting it is not working as expected and getting an error as 
Script interpreter error, line=15, col=25: Error calling method 'get()' on java class 'com.ibm.itim.workflow.script.wrappers.RelevantDataItemWrapper'

Even typecast doesn't work in ITIM

Can somebody explain how to use them as java object? 
 

 

  • franzw
    franzw
    519 Posts

    Re: Map and List relevant data items not working as expected

    ‏2019-08-14T11:43:28Z  

    I am not sure whether all wrappers work in the general workflow - dataitem situation.

    You have not shown exactly where the error is - but normally you will receive the data in some in a form you cannot store directly but either need API methods to handle or translate in JavaScript.

    The classical situation is when you receive a JavaArray (e.g. any DirectoryObject with multiple values e.g. a group) that needs to be translated to a JavaScript Array object before you can save it back.

    So my best advice is that you can probably us most data types on the relevant items when reading them - but when writing them back you need probably need to use a List and write it as a JavaScript Array.

    The wrappers here is more or less a black art subject and unluckily not well documented - there are methods to write (and IIRC even add your own datatypes) using special logic - but I will not have the chance in quick answer to go that deep level :-(

    HTH

    Regards

    Franz Wolfhagen

  • franzw
    franzw
    519 Posts

    Re: Map and List relevant data items not working as expected

    ‏2019-08-14T11:53:40Z  
    • franzw
    • ‏2019-08-14T11:43:28Z

    I am not sure whether all wrappers work in the general workflow - dataitem situation.

    You have not shown exactly where the error is - but normally you will receive the data in some in a form you cannot store directly but either need API methods to handle or translate in JavaScript.

    The classical situation is when you receive a JavaArray (e.g. any DirectoryObject with multiple values e.g. a group) that needs to be translated to a JavaScript Array object before you can save it back.

    So my best advice is that you can probably us most data types on the relevant items when reading them - but when writing them back you need probably need to use a List and write it as a JavaScript Array.

    The wrappers here is more or less a black art subject and unluckily not well documented - there are methods to write (and IIRC even add your own datatypes) using special logic - but I will not have the chance in quick answer to go that deep level :-(

    HTH

    Regards

    Franz Wolfhagen

    I forgot one thing :

    You can avoid the wrapper by telling it in scriptframework.properties likle this :

    wrapper$java.util.ArrayList=com.ibm.itim.script.wrappers.NO_WRAPwrapper

    This is for the java.util.ArrayList - be aware if you removes wrapping for somthing this may hit you if it used in the script engine somewhere else - so use this at your own risk :-)

    HTH

    Regards

    Franz Wolfhagen

  • Prashant Nark
    Prashant Nark
    4 Posts

    Re: Map and List relevant data items not working as expected

    ‏2019-08-14T12:10:30Z  
    • franzw
    • ‏2019-08-14T11:53:40Z

    I forgot one thing :

    You can avoid the wrapper by telling it in scriptframework.properties likle this :

    wrapper$java.util.ArrayList=com.ibm.itim.script.wrappers.NO_WRAPwrapper

    This is for the java.util.ArrayList - be aware if you removes wrapping for somthing this may hit you if it used in the script engine somewhere else - so use this at your own risk :-)

    HTH

    Regards

    Franz Wolfhagen

    Thank you for your inputs. I will try this and let you know whether it works.

  • Prashant Nark
    Prashant Nark
    4 Posts

    Re: Map and List relevant data items not working as expected

    ‏2019-08-14T13:56:34Z  

    Thank you for your inputs. I will try this and let you know whether it works.

    It looks that the appliance version has an issue to set $ character in property key. I am using ISIM 7.0.1.7.

  • franzw
    franzw
    519 Posts

    Re: Map and List relevant data items not working as expected

    ‏2019-08-15T10:07:46Z  

    It looks that the appliance version has an issue to set $ character in property key. I am using ISIM 7.0.1.7.

    Raise a support case (formerly known as a PMR) - that is one of the things I hate with the VA - too many restrictions made with no understanding of the finer details....

    You may be able to do this via the LMI REST api - it may be worth trying...

    I have been burned to many times by silly things like this - so I would normally recommend SW (ISIM 6) version - not because the idea of a VA is bad (it is IMHO very good) - but the lock down is simply creating too many support cases when going into this kind of things.

    HTH

    Regards

    Franz Wolfhagen