Just curious to know is there any work around in the flow service to find out if the Document coming from the upstream flow is Document or DocumentList IDATA object?
The problem i have is if this its a Document then i will ignore it going thru a loop and default follow Loop process.
I tried using size of list or different methods in java service,probably i might have missed the easiest way of work around.
The “easiest” way is to specify a doc type when calling xmlNodeToDocument. IMO, doc type should always be specified unless there is an extremely compelling reason not to and the scenario you describe above has been addressed in some manner.
The reason is in some of our maps which have already in place returns output as Document IDATA and now due to valid reasons we wanted to change the output returned as DocumentList.And in our downstream flows we have now added a loop step this will work fine for Doclists and few maps already in production returns as Document and this causes loop step fail for going further processing.So we dont want to change output signature of already existing maps.
In general terms, if you get a cursor to the pipeline IData object and move it to the key/value pair you’re interested in, the getValue() method of the IDataCursor will return an instance of java.lang.Object. You can then use the getClass() method to return the class of the object whose name you can then get with the getName() method. A document list object would have a value which was itself another IData object where a document would have a conventional value. Not pretty, but it does work. I think you could do something similar by getting the string representation of the object returned by getValue() using the toString() method and evaluate it somehow. HTH,
What pryWM suggested is right.
Loop over the output of your flow service which in your case is MAP_OUTPUT. If it enters the loop, that means its a doument list, else it is a document. You can set a boolean variable like ‘isList’ to true or false in a map after either of the steps. Have this whole logic in one flow service. Call this to find out if its a document or document list. Let the input variable to this flow service be an object list.
Once you know what it is, either loop over it or just reference directly. This will solve your problem as I have applied the same techique in my project.