use of org.apache.struts.action.ActionForward in project head by mifos.
the class CenterCustAction method search.
/**
* invoked when searching for centers from group creation screen
*/
@Override
@TransactionDemarcate(joinToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward actionForward = super.search(mapping, form, request, response);
CenterCustActionForm actionForm = (CenterCustActionForm) form;
String searchString = actionForm.getSearchString();
CustomerSearch searchResult = this.customerServiceFacade.search(searchString);
addSeachValues(searchString, searchResult.getOfficeId(), searchResult.getOfficeName(), request);
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, searchResult.getSearchResult(), request);
return actionForward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class MeetingAction method edit.
@TransactionDemarcate(conditionToken = true)
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MeetingActionForm actionForm = (MeetingActionForm) form;
clearActionForm(actionForm);
CustomerBO customerInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerBO customer = this.customerDao.findCustomerById(customerInSession.getCustomerId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customer, request);
List<WeekDay> workingDays = getLocalizedWorkingDays();
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKDAYSLIST, workingDays, request);
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKRANKLIST, RankOfDay.getRankOfDayList(), request);
ActionForward forward = null;
if (customer.getCustomerMeeting() != null) {
MeetingBO meeting = customer.getCustomerMeeting().getMeeting();
setValuesInActionForm(actionForm, meeting);
forward = mapping.findForward(ActionForwards.edit_success.toString());
actionForm.setInput(MeetingConstants.INPUT_EDIT);
} else {
actionForm.setInput(MeetingConstants.INPUT_CREATE);
forward = mapping.findForward(ActionForwards.createMeeting_success.toString());
}
return forward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class LoanAccountAction method viewAndEditAdditionalInformation.
public ActionForward viewAndEditAdditionalInformation(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
Integer entityId = Integer.valueOf(request.getParameter("entityId"));
questionGroupFilter.setLoanOfferingBO(getLoan(entityId).getLoanOffering());
List<QuestionGroupInstanceDetail> questionGroupInstances = createLoanQuestionnaire.getQuestionGroupInstances(request, entityId);
request.getSession().setAttribute(LoanConstants.QUESTION_GROUP_INSTANCES, questionGroupInstances);
ActionForward forward = mapping.findForward(ActionForwards.viewAndEditAdditionalInformation.toString());
return new ActionForward(forward.getPath(), forward.getRedirect());
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class AccountApplyGroupIndividualAction method applyPayment.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward applyPayment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
UserContext userContext = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
AccountApplyPaymentActionForm actionForm = (AccountApplyPaymentActionForm) form;
Integer accountId = Integer.valueOf(actionForm.getAccountId());
String paymentType = request.getParameter(Constants.INPUT);
UserReferenceDto userReferenceDto = new UserReferenceDto(userContext.getId());
AccountPaymentDto accountPaymentDto = accountServiceFacade.getAccountPaymentInformation(accountId, paymentType, userContext.getLocaleId(), userReferenceDto, actionForm.getTrxnDate());
validateAccountPayment(accountPaymentDto, accountId, request);
validateAmount(accountPaymentDto, actionForm.getAmount());
PaymentTypeDto paymentTypeDto;
String amount = actionForm.getAmount();
if (accountPaymentDto.getAccountType().equals(AccountTypeDto.LOAN_ACCOUNT)) {
paymentTypeDto = getLoanPaymentTypeDtoForId(Short.valueOf(actionForm.getPaymentTypeId()));
} else {
paymentTypeDto = getFeePaymentTypeDtoForId(Short.valueOf(actionForm.getPaymentTypeId()));
}
AccountPaymentParametersDto accountPaymentParametersDto = new AccountPaymentParametersDto(userReferenceDto, new AccountReferenceDto(accountId), new BigDecimal(amount), actionForm.getTrxnDateAsLocalDate(), paymentTypeDto, AccountConstants.NO_COMMENT, actionForm.getReceiptDateAsLocalDate(), actionForm.getReceiptId(), accountPaymentDto.getCustomerDto());
if (paymentTypeDto.getValue().equals(this.legacyAcceptedPaymentTypeDao.getSavingsTransferId())) {
this.accountServiceFacade.makePaymentFromSavingsAcc(accountPaymentParametersDto, actionForm.getAccountForTransfer());
} else {
this.accountServiceFacade.makePayment(accountPaymentParametersDto);
}
request.getSession().setAttribute("globalAccountNum", ((AccountApplyPaymentActionForm) form).getGlobalAccountNum());
ActionForward findForward;
if (actionForm.getPrintReceipt()) {
findForward = mapping.findForward(getForward("PRINT"));
} else {
findForward = mapping.findForward(getForward(((AccountApplyPaymentActionForm) form).getInput()));
}
return findForward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class MifosExceptionHandler method execute.
/**
* Figures the type of exception and thus gets the page to which it should
* be forwarded. If the exception is of type {@link SystemException} it is
* forwarded to standard page which is obtained using Exception Config. If
* the exception is of type {@link ApplicationException} the page to which
* the request is forwarded is figured out using the string
* <method_invoked>+failure which should be defined in the ActionConfig.
*/
@Override
public ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException {
ActionForward forwardToBeReturned = null;
String input = null;
String parameter = null;
ActionMessage error = null;
if (ex instanceof ServiceUnavailableException) {
forwardToBeReturned = new ActionForward(ae.getPath());
error = new ActionMessage(((ServiceUnavailableException) ex).getKey(), ((ServiceUnavailableException) ex).getValues());
}
if (ex instanceof ConnectionNotFoundException) {
forwardToBeReturned = new ActionForward(ae.getPath());
error = new ActionMessage(((ConnectionNotFoundException) ex).getKey(), ((ConnectionNotFoundException) ex).getValues());
}
if (ex instanceof SystemException) {
forwardToBeReturned = new ActionForward(ae.getPath());
error = new ActionMessage(((SystemException) ex).getKey(), ((SystemException) ex).getValues());
} else if (ex instanceof PageExpiredException) {
forwardToBeReturned = new ActionForward(ae.getPath());
error = new ActionMessage(((PageExpiredException) ex).getKey(), ((PageExpiredException) ex).getValues());
} else if (ex instanceof ApplicationException || ex instanceof BusinessRuleException) {
String key = ex instanceof ApplicationException ? ((ApplicationException) ex).getKey() : ((BusinessRuleException) ex).getMessageKey();
Object[] values = ex instanceof ApplicationException ? ((ApplicationException) ex).getValues() : ((BusinessRuleException) ex).getMessageValues();
error = new ActionMessage(key, values);
parameter = request.getParameter("method");
// jsp to which the user should be returned is identified by
// methodname_failure e.g. if there is an exception in create the
// failure forward would be create_failure if input is not null it
// also tries to append that to parameter to find the action
// forward.If that is not availablee it still tries to find the
// forward with the actionforward being parameter_failure
input = request.getParameter("input");
if (null != input) {
parameter = parameter + "_" + input;
}
forwardToBeReturned = mapping.findForward(parameter + "_failure");
if (null == forwardToBeReturned) {
forwardToBeReturned = mapping.findForward(request.getParameter("method") + "_failure");
}
// is coming
if (null == forwardToBeReturned) {
input = mapping.getInput();
if (null != input) {
forwardToBeReturned = new ActionForward("ExceptionForward", input, false, null);
} else {
forwardToBeReturned = super.execute(ex, ae, mapping, formInstance, request, response);
// further statements
return forwardToBeReturned;
}
}
}
logException(ex);
// This will store the exception in the scope mentioned so that
// it can be displayed on the UI
this.storeException(request, error.getKey(), error, forwardToBeReturned, ae.getScope());
return forwardToBeReturned;
}
Aggregations