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
  • 2 replies
  • Latest Post - ‏2019-07-17T18:37:00Z by AndrewPaier
Deb2013
Deb2013
54 Posts

Pinned topic Map to Business Object Conversion in IBM BPM 8.5.7

‏2019-07-16T22:39:05Z | serialization

Hi,

Is there any way to convert a Map to BO.

for example - I have a Map with following elements.

tw.local.resultMapList=new tw.object.listOf.Map();

tw.local.resultMapList[0]=new tw.object.Map();
tw.local.resultMapList[0].put("TKIID", "1234");
tw.local.resultMapList[0].put("TAD_DISPLAY_NAME", "Test Subject");
tw.local.resultMapList[0].put("PRIORITY", 30);

 

I want a BO to be created with variables TKIID, TAD_DISPLAY_NAME, PRIORITY automatically.

Do you know if there is any simpler process.

 

Regards,

Deba

 

  • Atanu
    Atanu
    209 Posts

    Re: Map to Business Object Conversion in IBM BPM 8.5.7

    ‏2019-07-17T06:24:55Z  

    Why don't you use a list of complex object to store the task details, list of Map is not really a good idea.

     

     - Atanu Roy

  • AndrewPaier
    AndrewPaier
    1197 Posts

    Re: Map to Business Object Conversion in IBM BPM 8.5.7

    ‏2019-07-17T18:37:00Z  

    I agree with @Atanu in that I really dislike using untyped variables unless absolutely necessary.  It makes it very difficult for the next person enhancing the solution to understand the details of what is going on, and, in the long term can create a significant problem.

    That having been said, a long time ago there was a data type in the System Data Toolkit called a "Record" which was really under the covers just a name/value pair.  If I remember correctly, if you created the Record so that the members exactly matched a BO's members you could cast one to the other.  However, if you are already writing code that hard codes the member names (per your example), I'm not sure what is gained by avoiding the use of an actual Business Object.

    -Andrew Paier