Check if Pipeline Empty

Hi there. I’m working on a flow service where I want to check and see if the pipeline is empty, then exit the flow.

Is there a util or service that checks if the pipeline is empty or null? As shown in the screenshot there are no variables in the pipeline. So some service that returns pipelineIsEmpty == true, or something similar.

image

public static final void pipelineSize(IData pipeline) throws ServiceException {
	IDataCursor idc = pipeline.getCursor();
	int i = IDataUtil.size(idc);
	IDataUtil.put(idc, "size", i+"");
	IDataUtil.put(idc, "isEmpty", (i > 0) + "");
	idc.destroy();	
}

thanks for the response. so there’s no way outside of a java service to get this functionality?

Not that I know of. But even all of the services in WmPublic end up as Java at some point. :slight_smile:

I assume you have your own “Public” package to hold your common helper services for use by any/all packages. This would be a good one for that package. We have one that holds various string manipulations, hashmap, hashset, linked list, doc sorting (before WmPublic had one), I/O, replacement for all the math services to avoid using float/double, etc.

Going completely the other way, I’m not sure of the value of this particular service. What is the scenario in which a service would take an action only if the pipeline is empty (or not empty)?

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.