28 using BusyHandler = std::function<WorkflowControl (
WorkflowRequest&,
const QSharedPointer<WorkflowRequest>&,
const QSharedPointer<WorkflowRequest>&)>;
31 const std::function<QSharedPointer<WorkflowController>(
const QSharedPointer<WorkflowContext>& pContext)> mGeneratorController;
32 const std::function<QSharedPointer<WorkflowContext>()> mGeneratorContext;
33 const BusyHandler mBusyHandler;
35 QSharedPointer<WorkflowController> mController;
36 QSharedPointer<WorkflowContext> mContext;
38 template<
typename Controller,
typename Context,
typename ... Args>
39 static auto getGenerator(Args&& ... pArgs)
41 const auto& controller = [](
const QSharedPointer<WorkflowContext>& pContext){
42 return QSharedPointer<Controller>::create(pContext.staticCast<Context>());
45 const auto& context = [pArgs ...]()
mutable {
46 return QSharedPointer<Context>::create(std::forward<Args>(pArgs) ...);
49 return qMakePair(controller, context);
53 template<
typename Controller,
typename Context,
typename Request =
WorkflowRequest,
typename ... Args>
56 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
57 return QSharedPointer<Request>::create(controller, context);
61 template<
typename Controller,
typename Context,
typename Request =
WorkflowRequest,
typename ... Args>
64 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
65 return QSharedPointer<Request>::create(controller, context, pBusyHandler);
69 WorkflowRequest(
const std::function<QSharedPointer<WorkflowController>(
const QSharedPointer<WorkflowContext>& pContext)>& pGeneratorController,
70 const std::function<QSharedPointer<WorkflowContext>()>& pGeneratorContext,
71 const BusyHandler& pBusyHandler = BusyHandler());
76 [[nodiscard]] QSharedPointer<WorkflowController>
getController()
const;
77 [[nodiscard]] QSharedPointer<WorkflowContext>
getContext()
const;
78 [[nodiscard]] WorkflowControl
handleBusyWorkflow(
const QSharedPointer<WorkflowRequest>& pActiveWorkflow,
const QSharedPointer<WorkflowRequest>& pWaitingWorkflow);
Definition: WorkflowController.h:20
Definition: WorkflowRequest.h:25
Action getAction() const
Definition: WorkflowRequest.cpp:41
static QSharedPointer< WorkflowRequest > createWorkflowRequestHandler(const BusyHandler &pBusyHandler, Args &&... pArgs)
Definition: WorkflowRequest.h:62
void initialize()
Definition: WorkflowRequest.cpp:26
QSharedPointer< WorkflowContext > getContext() const
Definition: WorkflowRequest.cpp:53
QSharedPointer< WorkflowController > getController() const
Definition: WorkflowRequest.cpp:47
WorkflowControl handleBusyWorkflow(const QSharedPointer< WorkflowRequest > &pActiveWorkflow, const QSharedPointer< WorkflowRequest > &pWaitingWorkflow)
Definition: WorkflowRequest.cpp:59
bool isInitialized() const
Definition: WorkflowRequest.cpp:35
WorkflowRequest(const std::function< QSharedPointer< WorkflowController >(const QSharedPointer< WorkflowContext > &pContext)> &pGeneratorController, const std::function< QSharedPointer< WorkflowContext >()> &pGeneratorContext, const BusyHandler &pBusyHandler=BusyHandler())
static QSharedPointer< WorkflowRequest > createWorkflowRequest(Args &&... pArgs)
Definition: WorkflowRequest.h:54
A simple template renderer.
Definition: ActivationContext.h:15
defineEnumType(ActivationType, UNKNOWN, SHOWUI, STATUS, TCTOKENURL) defineEnumType(StatusFormat
Format types for status responses.