A typical requirement in Java service

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.

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.

Hi Team,

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

Thanks,
Anil.

Hi Team,

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

Thanks,
Anil.

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,

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,