use of org.mifos.customers.office.business.service.OfficeBusinessService 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;
}
}
use of org.mifos.customers.office.business.service.OfficeBusinessService in project head by mifos.
the class BranchReportHelperIntegrationTest method testBatchCreatesRowForBranchReportBatchBO.
@Test
public void testBatchCreatesRowForBranchReportBatchBO() throws PersistenceException, ServiceException, BatchJobException {
branchReportHelper = new BranchReportHelper();
OfficeBO office = new OfficeBusinessService().getOffice(BRANCH_ID_SHORT);
BranchReportBO generatedBranchReport = branchReportHelper.createBranchReport(session, office, RUN_DATE);
IBranchReportService branchReportService = new BranchReportService();
BranchReportBO retrievedBranchReports = branchReportService.getBranchReport(BRANCH_ID_SHORT, RUN_DATE);
assertBranchReport(generatedBranchReport, retrievedBranchReports);
assertClientSummaryReport(generatedBranchReport.getClientSummaries(), branchReportService);
assertLoanArrearsAging(generatedBranchReport.getLoanArrearsAging(), branchReportService);
assertStaffSummary(generatedBranchReport.getStaffSummaries(), branchReportService);
assertStaffingLevelSummary(generatedBranchReport.getStaffingLevelSummaries(), branchReportService);
assertLoanDetails(generatedBranchReport.getLoanDetails(), branchReportService);
assertLoanArrearsProfile(generatedBranchReport.getLoanArrearsProfile(), branchReportService);
}
Aggregations