bool FlowController::PrepareRequest(Context &ctx) { StartTrace(FlowController.PrepareRequest); long reqNr = GetRequestNr(ctx); // number of runs of pre depends on number of slots in anything long nrOfPreRunRequests = fConfig["PreRun"].GetSize(); Anything tmpStore = ctx.GetTmpStore(); Anything flowState = tmpStore["FlowState"]; if (!flowState["PreRunDone"].AsBool(1)) { Trace("PRE RUN NOT DONE "); if (reqNr < nrOfPreRunRequests) { DoPrepare(tmpStore, fConfig["PreRun"][reqNr]); flowState["RequestNr"] = ++reqNr; TraceAny(tmpStore["FlowState"], "Flow State on exit"); return true; } else { // PreRun done , reset for normal run reqNr = 0; flowState["RunNr"] = 0L; flowState["PreRunDone"] = true; } } long nrOfRuns = 0; String appName; Application *application = Application::GetGlobalApplication(appName); if (application) { nrOfRuns = application->Lookup("NumberOfRuns", fConfig["NumberOfRuns"].AsLong(1)); Trace(appName << " application found" ); } else { nrOfRuns = fConfig["NumberOfRuns"].AsLong(1); } long runNr = flowState["RunNr"].AsLong(0); Trace("INIT Number of Run: " << runNr << " of " << nrOfRuns); while (runNr < nrOfRuns) { // loop thru steps and incr. runNr after each batch has been processed Trace("Number of Run: " << runNr << " of " << nrOfRuns); TraceAny(fConfig["Run"], "Config Run"); long nrOfRequests = fConfig["Run"].GetSize(); if (reqNr < nrOfRequests) { DoPrepare(tmpStore, fConfig["Run"][reqNr]); flowState["RequestNr"] = ++reqNr; TraceAny(tmpStore, "tmpStore on exit"); TraceAny(tmpStore["FlowState"], "Flow State on exit"); return true; } reqNr = 0; // reset request number flowState["RunNr"] = ++runNr; } TraceAny(tmpStore["FlowState"], "Flow State on exit with false"); return false; }