use of org.mifos.customers.group.struts.actionforms.GroupCustActionForm in project head by mifos.
the class GroupCustAction method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupCustActionForm actionForm = (GroupCustActionForm) form;
boolean isPendingApprovalDefined = ProcessFlowRules.isGroupPendingApprovalStateEnabled();
SessionUtils.setAttribute(CustomerConstants.PENDING_APPROVAL_DEFINED, isPendingApprovalDefined, request);
return createGroupQuestionnaire.fetchAppliedQuestions(mapping, actionForm, request, ActionForwards.preview_success);
}
use of org.mifos.customers.group.struts.actionforms.GroupCustActionForm in project head by mifos.
the class GroupCustAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupCustActionForm actionForm = (GroupCustActionForm) form;
actionForm.cleanForm();
// FIXME - store group identifier (id, globalCustNum) instead of entire business object
GroupBO group = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
group = this.customerDao.findGroupBySystemId(group.getGlobalCustNum());
logger.debug("Entering GroupCustAction manage method and customer id: " + group.getGlobalCustNum());
CenterDto groupDto = this.groupServiceFacade.retrieveGroupDetailsForUpdate(group.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, groupDto.getActiveLoanOfficersForBranch(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, groupDto.isCenterHierarchyExists(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.POSITIONS, groupDto.getCustomerPositionViews(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CLIENT_LIST, groupDto.getClientList(), request);
actionForm.setLoanOfficerId(String.valueOf(group.getLoanOfficerId()));
actionForm.setDisplayName(group.getDisplayName());
actionForm.setCustomerId(group.getCustomerId().toString());
actionForm.setGlobalCustNum(group.getGlobalCustNum());
actionForm.setExternalId(group.getExternalId());
actionForm.setAddress(group.getAddress());
actionForm.setCustomerPositions(groupDto.getCustomerPositionViews());
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
if (group.isTrained()) {
actionForm.setTrained(GroupConstants.TRAINED);
} else {
actionForm.setTrained(GroupConstants.NOT_TRAINED);
}
if (group.getTrainedDate() != null) {
actionForm.setTrainedDate(DateUtils.getUserLocaleDate(getUserContext(request).getPreferredLocale(), group.getTrainedDate().toString()));
}
logger.debug("Exiting GroupCustAction manage method ");
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.customers.group.struts.actionforms.GroupCustActionForm in project head by mifos.
the class GroupCustAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In GroupCustAction get method ");
// John W - UserContext object passed because some status' need to be looked up for internationalisation based
// on UserContext info
String groupSystemId = ((GroupCustActionForm) form).getGlobalCustNum();
GroupInformationDto groupInformationDto;
try {
groupInformationDto = this.groupServiceFacade.getGroupInformationDto(groupSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
SessionUtils.removeThenSetAttribute("groupInformationDto", groupInformationDto, request);
// John W - - not sure whether to leave these rules as is or do something else like bake the logic into the main
// dto and out of the jsp
SessionUtils.setAttribute(GroupConstants.IS_GROUP_LOAN_ALLOWED, ClientRules.getGroupCanApplyLoans(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, ClientRules.getCenterHierarchyExists(), request);
// John W - 'BusinessKey' attribute linked to GroupBo is still used by other actions (e.g. meeting related)
// further on and also breadcrumb.
GroupBO groupBO = (GroupBO) this.customerDao.findCustomerById(groupInformationDto.getGroupDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, groupBO, request);
setCurrentPageUrl(request, groupBO);
setQuestionGroupInstances(request, groupBO);
logger.debug("Exiting GroupCustAction get method ");
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.customers.group.struts.actionforms.GroupCustActionForm in project head by mifos.
the class GroupCustAction method cancel.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward cancel(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ActionForwards forward = null;
GroupCustActionForm actionForm = (GroupCustActionForm) form;
String fromPage = actionForm.getInput();
if (fromPage.equals(GroupConstants.MANAGE_GROUP) || fromPage.equals(GroupConstants.PREVIEW_MANAGE_GROUP)) {
forward = ActionForwards.cancelEdit_success;
} else if (fromPage.equals(GroupConstants.CREATE_GROUP)) {
forward = ActionForwards.cancelCreate_success;
}
return mapping.findForward(forward.toString());
}
use of org.mifos.customers.group.struts.actionforms.GroupCustActionForm in project head by mifos.
the class GroupCustAction method search.
@Override
@TransactionDemarcate(joinToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
GroupCustActionForm actionForm = (GroupCustActionForm) form;
UserContext userContext = getUserContext(request);
ActionForward actionForward = super.search(mapping, form, request, response);
String searchString = actionForm.getSearchString();
if (searchString == null) {
if (actionForm.getInput() != null && actionForm.getInput().equals(GroupConstants.GROUP_SEARCH_CLIENT_TRANSFER)) {
request.setAttribute(Constants.INPUT, CenterConstants.INPUT_SEARCH_TRANSFERGROUP);
} else {
request.setAttribute(Constants.INPUT, null);
}
throw new CustomerException(CenterConstants.NO_SEARCH_STRING);
}
addSeachValues(searchString, userContext.getBranchId().toString(), new OfficeBusinessService().getOffice(userContext.getBranchId()).getOfficeName(), request);
final String normalizedSearchString = SearchUtils.normalizeSearchString(searchString);
if (normalizedSearchString.equals("")) {
if (actionForm.getInput() != null && actionForm.getInput().equals(GroupConstants.GROUP_SEARCH_CLIENT_TRANSFER)) {
request.setAttribute(Constants.INPUT, CenterConstants.INPUT_SEARCH_TRANSFERGROUP);
} else {
request.setAttribute(Constants.INPUT, null);
}
throw new CustomerException(CenterConstants.NO_SEARCH_STRING);
}
boolean searchForAddingClientsToGroup = (actionForm.getInput() != null && actionForm.getInput().equals(GroupConstants.GROUP_SEARCH_ADD_CLIENTS_TO_GROUPS));
GroupSearchResultsDto searchResult = this.customerServiceFacade.searchGroups(searchForAddingClientsToGroup, normalizedSearchString, userContext.getId());
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, searchResult.getSearchResults(), request);
if (actionForm.getInput() != null && actionForm.getInput().equals(GroupConstants.GROUP_SEARCH_CLIENT_TRANSFER)) {
return mapping.findForward(ActionForwards.transferSearch_success.toString());
} else if (searchForAddingClientsToGroup) {
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, searchResult.getSearchForAddingClientToGroupResults(), request);
return mapping.findForward(ActionForwards.addGroupSearch_success.toString());
} else {
return actionForward;
}
}
Aggregations