IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  A typical requirement in Java service

    Posted Thu October 01, 2015 09:29 AM

    Hi All,

    Hope everyone is doing well.

    I have a java service which has below one initialized with values.

    List<ArrayList> output;

    Now I want to assign each element of this above list to a document so that list becomes document array in my java service so that I can use that document in some other flow.

    Please kindly help me how can get this done.

    Thanks,
    Anil.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: A typical requirement in Java service

    Posted Thu October 01, 2015 10:31 AM

    Hi, below is teh java code:

        IDataCursor pipelineCursor = pipeline.getCursor();
    String	configurationName = IDataUtil.getString( pipelineCursor, "configurationName" );
    ArrayList<ListOrderedMap> valueList;
    IDataCursor ComplexValueListCursor=null;
    int NoOfRows=0;
    List<ArrayList<ListOrderedMap>> output =null;
    String error="";      
    String name="aaa";
    Object ob=name;
    List<Object> list=new ArrayList<Object>();
    list.add(ob);
    list.add(ob);
    
    try{
    Configuration cf = Configuration.getInstance();
    Map<String, String> wMap = new LinkedHashMap<String, String>();
    LinkedHashMap<String, Object> wNCache = (LinkedHashMap<String, Object>)cf.getCache(configurationName,list);
    Integer i=0;
    if (wNCache != null && !wNCache.isEmpty()) {
    output = new ArrayList<ArrayList<ListOrderedMap>>(wNCache.keySet().size());
    NoOfRows=wNCache.keySet().size();
    
    for (String key : wNCache.keySet()) { 
    valueList = (ArrayList<ListOrderedMap>)wNCache.get(key); 
    output.add(valueList);
    }
    }
    

    }catch (Exception e) { // catch divide-by-zero
    error = e+“”;
    }
    pipelineCursor.destroy();
    IDataCursor pipelineCursor_1 = pipeline.getCursor();

    IData ComplexValueList = new IData[NoOfRows];
    for (int j=0; j< NoOfRows; j++) {
    ComplexValueList[j] = IDataFactory.create();
    ComplexValueListCursor = ComplexValueList[j].getCursor();
    }

    for (int k=0; k<output.size(); k++) {
    IDataUtil.put(ComplexValueListCursor,Integer.toString(k),output.get(k));
    }

    IDataUtil.put( pipelineCursor_1, “ComplexValueList”, ComplexValueList );
    // ComplexValueListCursor.destroy();

    I want to use output data as part of my flow service.So I thought to map the entire data of output variable to a document array but unable to do it. Please suggest

    Thanks a lot for your help.

    Thanks,
    Anil.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: A typical requirement in Java service

    Posted Thu October 01, 2015 04:07 PM

    Hi Team,

    Can someone suggest me how to get this done. Thanks a lot in advance for your help.

    Thanks,
    Anil.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: A typical requirement in Java service

    Posted Thu October 01, 2015 04:08 PM

    Hi Team,

    Can someone suggest me how to get this done. Thanks a lot in advance for your help.

    Thanks,
    Anil.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: A typical requirement in Java service

    Posted Fri October 02, 2015 03:39 PM

    Anil – You loop over List<ArrayList>.

    After getting each row, you add it to String variable of your document which is part of document List. With this you will have document list where each document contains a string which has your row ( data ).

    Thanks,


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 6.  RE: A typical requirement in Java service

    Posted Fri October 02, 2015 03:40 PM

    Anil – You loop over List<ArrayList>.

    After getting each row, you add it to String variable of your document which is part of document List. With this you will have document list where each document contains a string which has your row ( data ).

    Thanks,


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB