Package org.bardframework.flow
Class FlowHandlerAbstract<D extends FlowData>
- java.lang.Object
-
- org.bardframework.flow.FlowHandlerAbstract<D>
-
- All Implemented Interfaces:
FlowHandler
- Direct Known Subclasses:
FlowHandlerChain,FlowHandlerImpl
public abstract class FlowHandlerAbstract<D extends FlowData> extends Object implements FlowHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,List<FormProcessor>>actionProcessorsprotected FlowDataRepository<D>flowDataRepositoryprotected List<FlowFormTemplate>formsprotected static org.slf4j.LoggerLOGGERprotected List<FormProcessor>postProcessorsprotected List<FormProcessor>preProcessors
-
Constructor Summary
Constructors Constructor Description FlowHandlerAbstract(FlowDataRepository<D> flowDataRepository, List<FlowFormTemplate> forms)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaction(String flowToken, String action, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)protected voidcleanFlowData(String flowToken)protected voidfillFlowData(Map<String,String> flowData, Map<String,String> formData, FlowFormTemplate currentFormTemplate, Locale locale, javax.servlet.http.HttpServletRequest httpRequest)اعتبارسنجی داده های ارسالی و افزودن به فلو دیتاMap<String,List<FormProcessor>>getActionProcessors()org.bardframework.flow.FlowResponse<String>getCurrent(String flowToken, Locale locale, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)این متد فقط فرم جاری را برمیگرداند و پیش پردازش های آن را اجرا نمی کندprotected FlowFormTemplategetCurrentFormTemplate(D flowData)FlowDataRepository<D>getFlowDataRepository()List<FlowFormTemplate>getForms(FlowData flowData)protected FlowFormTemplategetNextFormTemplate(D flowData)List<FormProcessor>getPostProcessors()List<FormProcessor>getPreProcessors()protected intgetStepsCounts(FlowData flowData)protected voidinvalidateFlow(InvalidateFlowException ex)protected booleanisStarted(String flowToken)protected voidonFinished(String flowToken, D flowData, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)protected booleanprocess(List<FormProcessor> processors, String flowToken, D flowData, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)protected booleanprocessAction(String flowToken, String action, D flowData, Map<String,String> formData, FlowFormTemplate currentFormTemplate, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)protected org.bardframework.flow.FlowResponse<String>processNextForm(String flowToken, D flowData, Map<String,String> formData, String responseData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)1.voidsetActionProcessors(Map<String,List<FormProcessor>> actionProcessors)voidsetPostProcessors(List<FormProcessor> postProcessors)voidsetPreProcessors(List<FormProcessor> preProcessors)org.bardframework.flow.FlowResponse<String>start(Locale locale, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)org.bardframework.flow.FlowResponse<String>submit(String flowToken, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)protected org.bardframework.flow.FlowResponse<String>toResponse(FlowFormTemplate formTemplate, D flowData, String responseData, javax.servlet.http.HttpServletRequest httpRequest)تبدیل به فرمprotected voidupdateFlowData(String flowToken, D flowData)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bardframework.flow.FlowHandler
generateFlowToken
-
-
-
-
Field Detail
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
flowDataRepository
protected final FlowDataRepository<D extends FlowData> flowDataRepository
-
forms
protected final List<FlowFormTemplate> forms
-
preProcessors
protected List<FormProcessor> preProcessors
-
postProcessors
protected List<FormProcessor> postProcessors
-
actionProcessors
protected Map<String,List<FormProcessor>> actionProcessors
-
-
Constructor Detail
-
FlowHandlerAbstract
public FlowHandlerAbstract(FlowDataRepository<D> flowDataRepository, List<FlowFormTemplate> forms)
-
-
Method Detail
-
start
public org.bardframework.flow.FlowResponse<String> start(Locale locale, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Specified by:
startin interfaceFlowHandler- Throws:
Exception
-
submit
public org.bardframework.flow.FlowResponse<String> submit(String flowToken, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Specified by:
submitin interfaceFlowHandler- Throws:
Exception
-
action
public void action(String flowToken, String action, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Specified by:
actionin interfaceFlowHandler- Throws:
Exception
-
getCurrent
public org.bardframework.flow.FlowResponse<String> getCurrent(String flowToken, Locale locale, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
این متد فقط فرم جاری را برمیگرداند و پیش پردازش های آن را اجرا نمی کند- Specified by:
getCurrentin interfaceFlowHandler- Throws:
Exception
-
processAction
protected boolean processAction(String flowToken, String action, D flowData, Map<String,String> formData, FlowFormTemplate currentFormTemplate, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Throws:
Exception
-
fillFlowData
protected void fillFlowData(Map<String,String> flowData, Map<String,String> formData, FlowFormTemplate currentFormTemplate, Locale locale, javax.servlet.http.HttpServletRequest httpRequest) throws Exception
اعتبارسنجی داده های ارسالی و افزودن به فلو دیتا- Throws:
Exception
-
processNextForm
protected org.bardframework.flow.FlowResponse<String> processNextForm(String flowToken, D flowData, Map<String,String> formData, String responseData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
1. محاسبه فرم بعدی
2. اجرای پیش پردازش های فرم
3. ذخیره داده های فلو- Throws:
Exception
-
getNextFormTemplate
protected FlowFormTemplate getNextFormTemplate(D flowData) throws Exception
- Throws:
Exception
-
getCurrentFormTemplate
protected FlowFormTemplate getCurrentFormTemplate(D flowData) throws Exception
- Throws:
Exception
-
onFinished
protected void onFinished(String flowToken, D flowData, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Throws:
Exception
-
invalidateFlow
protected void invalidateFlow(InvalidateFlowException ex)
-
toResponse
protected org.bardframework.flow.FlowResponse<String> toResponse(FlowFormTemplate formTemplate, D flowData, String responseData, javax.servlet.http.HttpServletRequest httpRequest) throws Exception
تبدیل به فرم- Throws:
Exception
-
getStepsCounts
protected int getStepsCounts(FlowData flowData)
-
cleanFlowData
protected void cleanFlowData(String flowToken)
-
process
protected boolean process(List<FormProcessor> processors, String flowToken, D flowData, Map<String,String> formData, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws Exception
- Throws:
Exception
-
isStarted
protected boolean isStarted(String flowToken) throws InvalidateFlowException
- Throws:
InvalidateFlowException
-
getFlowDataRepository
public FlowDataRepository<D> getFlowDataRepository()
-
getForms
public List<FlowFormTemplate> getForms(FlowData flowData)
-
getPreProcessors
public List<FormProcessor> getPreProcessors()
-
setPreProcessors
public void setPreProcessors(List<FormProcessor> preProcessors)
-
getPostProcessors
public List<FormProcessor> getPostProcessors()
-
setPostProcessors
public void setPostProcessors(List<FormProcessor> postProcessors)
-
getActionProcessors
public Map<String,List<FormProcessor>> getActionProcessors()
-
setActionProcessors
public void setActionProcessors(Map<String,List<FormProcessor>> actionProcessors)
-
-