use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.
the class BaseAction method createToken.
private void createToken(HttpServletRequest request) {
String flowKey = String.valueOf(new DateTimeService().getCurrentDateTime().getMillis());
FlowManager flowManager = (FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER);
if (flowManager == null) {
flowManager = new FlowManager();
request.getSession(false).setAttribute(Constants.FLOWMANAGER, flowManager);
}
flowManager.addFLow(flowKey, new Flow(), this.clazz.getName());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
}
use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.
the class BaseAction method joinToken.
private void joinToken(HttpServletRequest request) throws PageExpiredException {
String flowKey = request.getParameter(Constants.CURRENTFLOWKEY);
if (null == flowKey) {
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
}
FlowManager flowManager = (FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER);
if (flowKey == null || !flowManager.isFlowValid(flowKey)) {
throw new PageExpiredException("no flow for key " + flowKey);
}
}
use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.
the class BaseAction method postHandleTransaction.
protected void postHandleTransaction(HttpServletRequest request, TransactionDemarcate annotation) throws SystemException {
if (null != annotation && annotation.validateAndResetToken()) {
FlowManager flowManager = (FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER);
flowManager.removeFlow((String) request.getAttribute(Constants.CURRENTFLOWKEY));
request.setAttribute(Constants.CURRENTFLOWKEY, null);
}
}
use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.
the class AddGroupMembershipActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
UserContext userContext = TestObjectFactory.getContext();
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
FlowManager flowManager = new FlowManager();
request.getSession(false).setAttribute(Constants.FLOWMANAGER, flowManager);
request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
flowKey = createFlow(request, AddGroupMembershipAction.class);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
}
use of org.mifos.framework.util.helpers.FlowManager in project head by mifos.
the class OfficeActionStrutsTest method ignore_testFlowFailure.
public void ignore_testFlowFailure() throws Exception {
setRequestPathInfo("/offAction.do");
addRequestParameter("method", Methods.load.toString());
addRequestParameter("officeLevel", "5");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.load_success.toString());
flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
FlowManager fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
Assert.assertEquals(true, fm.isFlowValid(flowKey));
setRequestPathInfo("/offAction.do");
addRequestParameter("method", Methods.preview.toString());
addRequestParameter("officeName", "abcd");
addRequestParameter("shortName", "abcd");
addRequestParameter("officeLevel", "5");
addRequestParameter("parentOfficeId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyInputForward();
fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
Assert.assertEquals(true, fm.isFlowValid(flowKey));
setRequestPathInfo("/offAction.do");
addRequestParameter("method", Methods.create.toString());
addRequestParameter("officeName", "abcd");
addRequestParameter("shortName", "abcd");
addRequestParameter("officeLevel", "5");
addRequestParameter("parentOfficeId", "1");
addRequestParameter("address.line1", "123");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.create_success.toString());
fm = (FlowManager) SessionUtils.getAttribute(Constants.FLOWMANAGER, request.getSession());
Assert.assertEquals(false, fm.isFlowValid(flowKey));
setRequestPathInfo("/offAction.do");
addRequestParameter("method", Methods.create.toString());
addRequestParameter("officeName", "abcd");
addRequestParameter("shortName", "abcd");
addRequestParameter("officeLevel", "5");
addRequestParameter("parentOfficeId", "1");
addRequestParameter("address.line1", "123");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyActionErrors(new String[] { "exception.framework.PageExpiredException" });
verifyForwardPath("/pages/framework/jsp/pageexpirederror.jsp");
}
Aggregations